コード例 #1
0
ファイル: title.cpp プロジェクト: Rox64/NXEngine
static void draw_title()
{
	// background is dk grey, not pure black
	ClearScreen(0x20, 0x20, 0x20);
	
	// top logo
	int tx = (SCREEN_WIDTH / 2) - (sprites[SPR_TITLE].w / 2) - 2;
	draw_sprite(tx, 40, SPR_TITLE);
	
	// draw menu
	int cx = (SCREEN_WIDTH / 2) - (sprites[SPR_MENU].w / 2) - 8;
	int cy = (SCREEN_HEIGHT / 2) + 8;
	for(int i=0;i<sprites[SPR_MENU].nframes;i++)
	{
		draw_sprite(cx, cy, SPR_MENU, i);
		if (i == title.cursel)
		{
			draw_sprite(cx - 16, cy - 1, title.sprite, title.selframe);
		}
		
		cy += (sprites[SPR_MENU].h + 4);
	}
	
	// animate character
	if (++title.seltimer > 8)
	{
		title.seltimer = 0;
		if (++title.selframe >= sprites[title.sprite].nframes)
			title.selframe = 0;
	}
	
	// accreditation
	cx = (SCREEN_WIDTH / 2) - (sprites[SPR_PIXEL_FOREVER].w / 2);
	int acc_y = SCREEN_HEIGHT - 48;
	draw_sprite(cx, acc_y, SPR_PIXEL_FOREVER);
	
	// version
	static const char *VERSION = "NXEngine v. 1.0.0.4";
	static const int SPACING = 5;
	int wd = GetFontWidth(VERSION, SPACING);
	cx = (SCREEN_WIDTH / 2) - (wd / 2);
	font_draw(cx, acc_y + sprites[SPR_PIXEL_FOREVER].h + 4, VERSION, SPACING);
	
	// draw Nikumaru display
	if (title.besttime != 0xffffffff)
		niku_draw(title.besttime, true);
}
コード例 #2
0
ファイル: title.cpp プロジェクト: CliffsDover/NXEngine-iOS
static void draw_title()
{
	// background is dk grey, not pure black
	ClearScreen(0x20, 0x20, 0x20);
	
	// top logo
	int tx = (Graphics::SCREEN_WIDTH / 2) - (sprites[SPR_TITLE].w / 2) - 2;
	draw_sprite(tx, 40, SPR_TITLE);
	
	// draw menu
	int cx = (Graphics::SCREEN_WIDTH / 2) - (sprites[SPR_MENU].w / 2) - 8;
	int cy = (Graphics::SCREEN_HEIGHT / 2) - 8;
	for(int i=0;i<sprites[SPR_MENU].nframes;i++)
	{
		draw_sprite(cx, cy, SPR_MENU, i);
		if (i == title.cursel)
		{
			draw_sprite(cx - 16, cy - 1, title.sprite, title.selframe);
		}
		
        //RectI r = Sprites::get_sprite_rect(cx, cy, SPR_MENU, i);
        //Graphics::DrawRect(r.x, r.y, r.x + r.w, r.y + r.h, 255,255,255);
        
		cy += (sprites[SPR_MENU].h + 18);
	}
	
	// animate character
	if (++title.seltimer > 8)
	{
		title.seltimer = 0;
		if (++title.selframe >= sprites[title.sprite].nframes)
			title.selframe = 0;
	}
	
	// accreditation
	cx = (Graphics::SCREEN_WIDTH / 2) - (sprites[SPR_PIXEL_FOREVER].w / 2);
	int acc_y = Graphics::SCREEN_HEIGHT - 48;
	draw_sprite(cx, acc_y, SPR_PIXEL_FOREVER);
	
	// version
	static const char *VERSION = "NXEngine v. 1.0.0.4";
	static const int SPACING = 5;
	int wd = GetFontWidth(VERSION, SPACING);
	cx = (Graphics::SCREEN_WIDTH / 2) - (wd / 2);
	font_draw(cx, acc_y + sprites[SPR_PIXEL_FOREVER].h + 4, VERSION, SPACING);
	
	// draw Nikumaru display
	if (title.besttime != 0xffffffff)
		niku_draw(title.besttime, true);
    
    // options
    {
        const char *str = "F3:Options";
        cx = (Graphics::SCREEN_WIDTH / 2) - (GetFontWidth(str, 0) / 2) - 4;
        cy = (Graphics::SCREEN_HEIGHT - 8) - GetFontHeight();
        int f3wd = font_draw(cx, cy, "F3", 0);
        font_draw(cx + f3wd, cy, ":Options", 0, &bluefont);
        
#ifdef CONFIG_USE_TAPS
        RectI r = RectI(cx, cy, GetFontWidth(str, 0), GetFontHeight());
        debug_absbox(r.x, r.y, r.x + r.w, r.y + r.h, 255, 255, 255);
        if (VJoy::ModeAware::wasTap(r))
        {
            game.pause(GP_OPTIONS);
        }
#endif
        
    }
}