예제 #1
0
void DrawScrollBar(int selIndex, int max, int y_inc, int xOff, u8 alpha)
{
    int game_y = 120;
    int maxPerPage = (512 - (game_y * 2)) / y_inc;
    float pLoc = (float)selIndex / (float)max;
    int yTotal = 512 - (game_y * 2);
    
    if (max < maxPerPage)
        return;
    
    if (idle_time > 80)
    {
        int dec = (idle_time - 80) * 4;
        if (dec > alpha)
            dec = alpha;
        alpha -= dec;
    }
    
    SetFontAlign(0);
    
    //Draw box
	DrawTextureCenteredX(menu_textures[scroll_bg_png_index], xOff, game_y, 0, 6, yTotal, 0xffffff00 | alpha);
    
    //Draw cursor
	DrawTextureCenteredX(menu_textures[scroll_lock_png_index], xOff, (int)((float)yTotal * pLoc) + game_y, 0, 4, maxPerPage * 2, 0xffffff00 | alpha);
}
예제 #2
0
// -------------------------------------------------------------------
CairoDevice::CairoDevice(cairo_t * dev, VGSystem * sys) 
	: fNativeDevice(0), fSystem(sys), fTextFont(0), fMusicFont(0), fFillColor(0,0,0), fPenColor(0,0,0)
{
	fNativeDevice = cairo_reference (dev);
	SetFontColor( VGColor(0,0,0,ALPHA_OPAQUE) );
	SetFontBackgroundColor( VGColor(255,255,255,ALPHA_TRANSPARENT) );	// transparent
	SetFontAlign( kAlignLeft | kAlignBase );
}
예제 #3
0
CairoDevice::CairoDevice(int w, int h, VGSystem * sys) 
	: fNativeDevice(0), fSystem(sys), fTextFont(0), fMusicFont(0), fFillColor(255,255,255), fPenColor(0,0,0)
{
	cairo_surface_t* surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w, h);
	fNativeDevice = cairo_create (surface);
	cairo_surface_destroy (surface);	
	SetFontColor( VGColor(0,0,0,ALPHA_OPAQUE) );
	SetFontBackgroundColor( VGColor(255,255,255,ALPHA_TRANSPARENT) );	// transparent
	SetFontAlign( kAlignLeft | kAlignBase );
}
예제 #4
0
// --------------------------------------------------------------
void GDeviceWin32::initialize(VGSystem* sys)
{
	SelectPen( VGColor(0,0,0,ALPHA_OPAQUE), 1);		//opaque black
	SelectFillColor( VGColor(0,0,0,ALPHA_OPAQUE) );	//opaque black
	SetFontColor( VGColor(0,0,0) );					//opaque black
	SetFontBackgroundColor( VGColor(255,255,255,ALPHA_TRANSPARENT) );	//transp. white
	SetFontAlign( kAlignLeft | kAlignBase );

	// guido hack - must be removed asap
	mSys = sys;
}
예제 #5
0
void DrawCheatsList(int selIndex, struct game_entry game, u8 alpha)
{
    SetFontSize(14, 16);
    
    int game_y = 80, y_inc = 20;
    int maxPerPage = (512 - (game_y * 2)) / y_inc;
    
    int x = selIndex - (maxPerPage / 2);
    int max = maxPerPage + selIndex;
    
    if (max > game.code_count)
        max = game.code_count;
    
    for (; x < max; x++)
    {
        int xo = 0; //(((selIndex - x) < 0) ? -(selIndex - x) : (selIndex - x));
        
        if (x >= 0 && game.codes[x].name)
        {
            //u32 color = game.codes[x].activated ? 0x4040C000 : 0x00000000;
			u8 a = (u8)((alpha * CalculateAlphaList(x, selIndex, maxPerPage)) / 0xFF);
            SetFontColor(0x00000000 | a, 0x00000000);
            //printf ("Drawing code name %d\n", x);
			SetCurrentFont(font_comfortaa_regular);
            float dx = DrawString(MENU_ICON_OFF + (MENU_TITLE_OFF * 3) - xo, game_y, game.codes[x].name);
            //DrawString(MENU_ICON_OFF + (MENU_TITLE_OFF * 3), game_y, game.codes[x].name);
            
            if (game.codes[x].activated)
            {
				DrawTexture(menu_textures[cheat_png_index], MENU_ICON_OFF, game_y, 0, (MENU_TITLE_OFF * 3) - 15, y_inc + 2, 0xFFFFFF00 | a);

				SetFontSize((int)(y_inc * 0.6), (int)(y_inc * 0.6));
                SetFontAlign(3);
				//SetCurrentFont(font_comfortaa_light);
				SetFontColor(0xFFFFFF00 | a, 0);
				DrawString(MENU_ICON_OFF + ((MENU_TITLE_OFF * 3) - 15) / 2, game_y + 2, game.codes[x].cwrite ? "constant" : "once");
                SetFontAlign(0);
                SetFontSize(14, 16);
                
                if (game.codes[x].options_count > 0 && game.codes[x].options)
                {
                    int od = 0;
                    for (od = 0; od < game.codes[x].options_count; od++)
                    {
                        if (game.codes[x].options[od].sel >= 0 && game.codes[x].options[od].name && game.codes[x].options[od].name[game.codes[x].options[od].sel])
                        {
							SetCurrentFont(font_comfortaa_bold);

                            //Allocate option
                            char * option = malloc(strlen(game.codes[x].options[od].name[game.codes[x].options[od].sel]) + 4);
                            memset(option, 0, sizeof(option));
                            //If first print "(NAME", else add to list of names ", NAME"
                            sprintf(option, (od == 0) ? " (%s" : ", %s", game.codes[x].options[od].name[game.codes[x].options[od].sel]);
                            
                            //If it's the last one then end the list
                            if (od == (game.codes[x].options_count - 1))
                                option[strlen(option)] = ')';
                            
							SetFontColor(0x00000000 | a, 0x00000000);
                            dx = DrawString(dx, game_y, option);
                            
                            free (option);
                        }
                    }
                }
                
            }
        }
        
        if (x == selIndex)
        {
            //Draw selection bar
            int c = 0;
            for (c = 0; c < 848; c++)
				DrawTexture(menu_textures[mark_line_png_index], c, game_y, 0, menu_textures[mark_line_png_index].texture.width, menu_textures[mark_line_png_index].texture.height, 0xFFFFFF00 | alpha);
        
			DrawTextureCenteredX(menu_textures[mark_arrow_png_index], MENU_ICON_OFF - 20, game_y, 0, (2 * y_inc) / 3, y_inc + 2, 0xFFFFFF00 | alpha);
		}
        
        game_y += y_inc;
    }
    
    DrawScrollBar(selIndex, game.code_count, y_inc, 800, alpha);
    
}