From d5e0c5021cf17939facd866f2a1ecb6d386bab19 Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Sun, 3 Feb 2002 14:56:11 +0000 Subject: Neato demo-effect when game selected. ;) svn-id: r3563 --- dc/selector.cpp | 72 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 15 deletions(-) (limited to 'dc') diff --git a/dc/selector.cpp b/dc/selector.cpp index d58dcced81..b79f058752 100644 --- a/dc/selector.cpp +++ b/dc/selector.cpp @@ -243,6 +243,12 @@ int getCdState() return param[0]; } +static void drawBackground() +{ + draw_solid_quad(20.0, 20.0, 620.0, 460.0, + 0xff0000, 0x00ff00, 0x0000ff, 0xffffff); +} + void waitForDisk() { Label lab; @@ -265,9 +271,8 @@ void waitForDisk() } ta_begin_frame(); - - draw_solid_quad(20.0, 20.0, 620.0, 460.0, - 0xff0000, 0x00ff00, 0x0000ff, 0xffffff); + + drawBackground(); ta_commit_end(); @@ -286,10 +291,19 @@ void waitForDisk() } } +static void drawGameLabel(Game &game, int pal, float x, float y, + unsigned int argb, int fade = 0, float scale = 1.0) +{ + unsigned int fade_alpha = (255-fade)<<24; + + game.icon.draw(x, y, x+32.0*scale, y+32.0*scale, pal, 0xffffff|fade_alpha); + game.label.draw(x+54.0*scale, y+4.0*scale, argb|fade_alpha, scale); +} + int gameMenu(Game *games, int num_games) { int top_game = 0, selector_pos = 0; - int16 mousex = 0, mousey = 0; + int16 mousex = 0, mousey = 64; if(!num_games) return -1; @@ -301,24 +315,21 @@ int gameMenu(Game *games, int num_games) ta_begin_frame(); - draw_solid_quad(20.0, 20.0, 620.0, 460.0, - 0xff0000, 0x00ff00, 0x0000ff, 0xffffff); + drawBackground(); ta_commit_end(); float y = 40.0; for(int i=top_game, cnt=0; cnt<10 && i=16) { + if(mousey>=64+16) { if(selector_pos + top_game + 1 < num_games) if(++selector_pos >= 10) { --selector_pos; ++top_game; } mousey -= 16; - } else if(mousey<=-16) { + } else if(mousey<=64-16) { if(selector_pos + top_game > 0) if(--selector_pos < 0) { ++selector_pos; -- cgit v1.2.3