A simple OutRun on Casio Graph 90+E
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
OutRun/src/src/menus.cc

759 lines
23 KiB

#include "../include/menus.h"
#include <gint/display.h>
#include <gint/keyboard.h>
#include "../parameters.h"
#include <gint/usb.h>
#include <gint/usb-ff-bulk.h>
extern bopti_image_t mainscreen;
extern bopti_image_t africa1, desert1, finland1, plains1, usa1;
extern bopti_image_t flag, linear, circular;
extern font_t autofont, autofontsmall;
extern bool record;
extern bool screenshot;
bool doneTitle = false;
bool doneMainMenu = false;
uint8_t MainMenuSelection=0;
bool doneMenuCircuit = false;
int8_t CircuitSelection=0;
bool doneMenuCredit = false;
bool doneOptions = false;
uint8_t OptionsSelection=0;
bool donePauseQuit = false;
uint8_t PauseQuitSelection=0;
extern bool BDrawDeco;
extern bool BDrawClds;
extern bool BDrawCars;
extern bool BDrawFPS;
extern bool BDrawBack;
extern bool exitToOS;
extern bool stop;
extern bool SkipTime;
void drawStartTitle( void )
{
uint16_t pulse=0;
doneTitle = false;
while (!doneTitle)
{
dclear( C_BLACK );
dsubimage( 0, 32, &mainscreen, 0, 32, 396, 160, DIMAGE_NONE);
dfont(&autofont);
dprint_opt(198, 2, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "OUTRUN FOR FX-CG50" );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, "PRESS EXE TO START" );
// CODE HERE TO PRINT WELCOME MENU
dupdate();
pulse++;
getInputStartTitle();
#if IS_FXLIB==1
if (screenshot && usb_is_open())
{
usb_fxlink_screenshot(false);
screenshot = false;
}
if(record && usb_is_open())
{
usb_fxlink_videocapture(false);
}
#endif
}
}
void getInputStartTitle( void )
{
int opt = GETKEY_DEFAULT & ~GETKEY_REP_ARROWS;
int timeout = 1;
while(1)
{
key_event_t ev = getkey_opt(opt, &timeout);
if(ev.type == KEYEV_NONE) return;
int key = ev.key;
if (key==KEY_EXE)
doneTitle = true;
#if IS_FXLIB==1
if(keydown(KEY_F5)) screenshot = true;
if(keydown(KEY_F6)) record = !record;
#endif // IS_FXLIB
}
}
int drawMainMenu( void )
{
uint16_t pulse=0;
doneMainMenu = false;
MainMenuSelection=0;
while (!doneMainMenu)
{
dclear(0x0000);
dimage( 0, 0, &mainscreen);
dfont(&autofont);
dprint_opt(102, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "ARCADE GAME" );
if (MainMenuSelection!=0) dprint_opt(100, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "ARCADE GAME" );
else dprint_opt(100, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "ARCADE GAME" );
dprint_opt(102, 62, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "TIME ATTACK" );
if (MainMenuSelection!=1) dprint_opt(100, 60, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "TIME ATTACK" );
else dprint_opt(100, 60, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "TIME ATTACK" );
dprint_opt(102, 102, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPTIONS" );
if (MainMenuSelection!=2) dprint_opt(100, 100, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPTIONS" );
else dprint_opt(100, 100, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPTIONS" );
dprint_opt(102, 142, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CREDITS" );
if (MainMenuSelection!=3) dprint_opt(100, 140, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CREDITS" );
else dprint_opt(100, 140, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CREDITS" );
dprint_opt(102, 182, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "QUIT TO OS" );
if (MainMenuSelection!=4) dprint_opt(100, 180, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "QUIT TO OS" );
else dprint_opt(100, 180, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "QUIT TO OS" );
dimage( 10, 10+40*MainMenuSelection, &flag );
// CODE HERE TO PRINT WELCOME MENU
dupdate();
pulse++;
getInputMainMenu();
#if IS_FXLIB==1
if (screenshot && usb_is_open())
{
usb_fxlink_screenshot(false);
screenshot = false;
}
if(record && usb_is_open())
{
usb_fxlink_videocapture(false);
}
#endif
}
return MainMenuSelection;
}
void getInputMainMenu( void )
{
int opt = GETKEY_DEFAULT & ~GETKEY_REP_ARROWS;
int timeout = 1;
while(1)
{
key_event_t ev = getkey_opt(opt, &timeout);
if(ev.type == KEYEV_NONE) return;
int key = ev.key;
if (key==KEY_EXE)
doneMainMenu = true;
if (key==KEY_UP)
{
if (MainMenuSelection==0) MainMenuSelection=4;
else MainMenuSelection--;
}
if (key==KEY_DOWN)
{
if (MainMenuSelection==4) MainMenuSelection=0;
else MainMenuSelection++;
}
#if IS_FXLIB==1
if(keydown(KEY_F5)) screenshot = true;
if(keydown(KEY_F6)) record = !record;
#endif // IS_FXLIB
}
}
void drawRectangle( uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color, uint8_t thick )
{
for(int u=0; u<=thick; u++)
{
dline( x, y+u, x+w, y+u, color );
dline( x, y+h-u, x+w, y+h-u, color );
dline( x+u, y, x+u, y+h, color );
dline( x+w-u, y, x+w-u, y+h, color );
}
}
int drawMenuCircuitSelect( void )
{
uint16_t pulse=0;
doneMenuCircuit = false;
CircuitSelection=0;
while (!doneMenuCircuit)
{
dclear( C_BLACK );
dsubimage( 0, 32, &mainscreen, 0, 32, 396, 160, DIMAGE_NONE);
dfont(&autofont);
dprint_opt(198, 2, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_TOP, "SELECT A CIRCUIT" );
dimage( 16, 45, &plains1 );
dimage( 16, 45, &linear );
if (CircuitSelection!=0) drawRectangle( 16, 45, 60, 60, C_WHITE, 3 );
else
{
drawRectangle( 16, 45, 60, 60, C_RGB(pulse%256,0,pulse%256), 3 );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, ">EUROPEAN PLAINS" );
}
dimage( 92, 45, &desert1 );
dimage( 92, 45, &linear );
if (CircuitSelection!=1) drawRectangle( 92, 45, 60, 60, C_WHITE, 3 );
else
{
drawRectangle( 92, 45, 60, 60, C_RGB(pulse%256,0,pulse%256), 3 );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, ">ATACAMA DESERT" );
}
dimage( 168, 45, &usa1 );
dimage( 168, 45, &linear );
if (CircuitSelection!=2) drawRectangle( 168, 45, 60, 60, C_WHITE, 3 );
else
{
drawRectangle( 168, 45, 60, 60, C_RGB(pulse%256,0,pulse%256), 3 );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, ">US ROAD 66" );
}
dimage( 244, 45, &finland1 );
dimage( 244, 45, &linear );
if (CircuitSelection!=3) drawRectangle( 244, 45, 60, 60, C_WHITE, 3 );
else
{
drawRectangle( 244, 45, 60, 60, C_RGB(pulse%256,0,pulse%256), 3 );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, ">SNOW IN FINLAND" );
}
dimage( 320, 45, &africa1 );
dimage( 320, 45, &linear );
if (CircuitSelection!=4) drawRectangle( 320, 45, 60, 60, C_WHITE, 3 );
else
{
drawRectangle( 320, 45, 60, 60, C_RGB(pulse%256,0,pulse%256), 3 );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, ">KENYAN SAVANAH" );
}
dimage( 16, 120, &plains1 );
dimage( 16, 120, &circular );
if (CircuitSelection!=5) drawRectangle( 16, 120, 60, 60, C_WHITE, 3 );
else
{
drawRectangle( 16, 120, 60, 60, C_RGB(pulse%256,0,pulse%256), 3 );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, ">EUROPEAN PLAINS" );
}
dimage( 92, 120, &desert1 );
dimage( 92, 120, &circular );
if (CircuitSelection!=6) drawRectangle( 92, 120, 60, 60, C_WHITE, 3 );
else
{
drawRectangle( 92, 120, 60, 60, C_RGB(pulse%256,0,pulse%256), 3 );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, ">ATACAMA DESERT" );
}
dimage( 168, 120, &usa1 );
dimage( 168, 120, &circular );
if (CircuitSelection!=7) drawRectangle( 168, 120, 60, 60, C_WHITE, 3 );
else
{
drawRectangle( 168, 120, 60, 60, C_RGB(pulse%256,0,pulse%256), 3 );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, ">US ROAD 66" );
}
dimage( 244, 120, &finland1 );
dimage( 244, 120, &circular );
if (CircuitSelection!=8) drawRectangle( 244, 120, 60, 60, C_WHITE, 3 );
else
{
drawRectangle( 244, 120, 60, 60, C_RGB(pulse%256,0,pulse%256), 3 );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, ">SNOW IN FINLAND" );
}
dimage( 320, 120, &africa1 );
dimage( 320, 120, &circular );
if (CircuitSelection!=9) drawRectangle( 320, 120, 60, 60, C_WHITE, 3 );
else
{
drawRectangle( 320, 120, 60, 60, C_RGB(pulse%256,0,pulse%256), 3 );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, ">KENYAN SAVANAH" );
}
//dimage( 10, 10+40*CircuitSelection, &flag );
// CODE HERE TO PRINT WELCOME MENU
dupdate();
pulse++;
getInputCircuitSelect();
#if IS_FXLIB==1
if (screenshot && usb_is_open())
{
usb_fxlink_screenshot(false);
screenshot = false;
}
if(record && usb_is_open())
{
usb_fxlink_videocapture(false);
}
#endif
if (CircuitSelection==-1) return -1;
}
return CircuitSelection;
}
void getInputCircuitSelect( void )
{
int opt = GETKEY_DEFAULT & ~GETKEY_REP_ARROWS;
int timeout = 1;
while(1)
{
key_event_t ev = getkey_opt(opt, &timeout);
if(ev.type == KEYEV_NONE) return;
int key = ev.key;
if (key==KEY_EXE)
doneMenuCircuit = true;
if (key==KEY_EXIT)
CircuitSelection = -1;
if (key==KEY_UP || key==KEY_LEFT)
{
if (CircuitSelection==0) CircuitSelection=9;
else CircuitSelection--;
}
if (key==KEY_DOWN || key==KEY_RIGHT)
{
if (CircuitSelection==9) CircuitSelection=0;
else CircuitSelection++;
}
#if IS_FXLIB==1
if(keydown(KEY_F5)) screenshot = true;
if(keydown(KEY_F6)) record = !record;
#endif // IS_FXLIB
}
}
void drawCredit( void )
{
uint16_t pulse=0;
int16_t offset=240;
doneMenuCredit = false;
while (!doneMenuCredit)
{
dclear( 0x0000 );
dimage( 0, 0, &mainscreen );
dfont(&autofont);
dprint_opt(202, offset + 4, C_RGB(0,0,0), C_NONE, DTEXT_CENTER, DTEXT_TOP, "OUTRUN FOR GRAPH90" );
dprint_opt(200, offset + 2, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_TOP, "OUTRUN FOR GRAPH90" );
dfont(&autofontsmall);
dprint_opt(200, offset + 32, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "PROUDLY CODED BY" );
dprint_opt(200, offset + 62, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "SLYVTT / MARCH 2022" );
dfont(&autofont);
dprint_opt(202, offset + 124, C_RGB(0,0,0), C_NONE, DTEXT_CENTER, DTEXT_TOP, "CODE :" );
dprint_opt(200, offset + 122, C_RGB(255,0,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "CODE :" );
dfont(&autofontsmall);
dprint_opt(200, offset + 162, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "SLYVTT" );
dprint_opt(200, offset + 192, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "WITH SUPPORT FROM LEPHE" );
dfont(&autofont);
dprint_opt(202, offset + 254, C_RGB(0,0,0), C_NONE, DTEXT_CENTER, DTEXT_TOP, "VISUALS" );
dprint_opt(200, offset + 252, C_RGB(255,0,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "VISUALS" );
dfont(&autofontsmall);
dprint_opt(200, offset + 292, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "SLYVTT" );
dprint_opt(200, offset + 322, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "WITH SUPPORT FROM INTERNET" );
dprint_opt(200, offset + 352, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "GOOGLE IS MY BEST FRIEND" );
dfont(&autofont);
dprint_opt(202, offset + 414, C_RGB(0,0,0), C_NONE, DTEXT_CENTER, DTEXT_TOP, "MUSIC" );
dprint_opt(200, offset + 412, C_RGB(255,0,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "MUSIC" );
dfont(&autofontsmall);
dprint_opt(200, offset + 452, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "SORRY, NO MUSIC ..." );
dprint_opt(200, offset + 482, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "... MAYBE ONE DAY !!!" );
dfont(&autofont);
dprint_opt(202, offset + 544, C_RGB(0,0,0), C_NONE, DTEXT_CENTER, DTEXT_TOP, "THANKS FOR PLAYING" );
dprint_opt(202, offset + 574, C_RGB(0,0,0), C_NONE, DTEXT_CENTER, DTEXT_TOP, "HOPE YOU ENJOYED" );
dprint_opt(200, offset + 542, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_TOP, "THANKS FOR PLAYING" );
dprint_opt(200, offset + 572, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_TOP, "HOPE YOU ENJOYED" );
dupdate();
#if IS_FXLIB==1
if (screenshot && usb_is_open())
{
usb_fxlink_screenshot(false);
screenshot = false;
}
if(record && usb_is_open())
{
usb_fxlink_videocapture(false);
}
#endif
pulse++;
offset--;
getInputCredit();
}
return;
}
void getInputCredit( void )
{
int opt = GETKEY_DEFAULT & ~GETKEY_REP_ARROWS;
int timeout = 1;
while(1)
{
key_event_t ev = getkey_opt(opt, &timeout);
if(ev.type == KEYEV_NONE) return;
int key = ev.key;
if (key==KEY_EXE)
doneMenuCredit = true;
#if IS_FXLIB==1
if(keydown(KEY_F5)) screenshot = true;
if(keydown(KEY_F6)) record = !record;
#endif // IS_FXLIB
}
}
void drawOptions( void )
{
uint16_t pulse=0;
doneOptions = false;
OptionsSelection=0;
while (!doneOptions)
{
dclear(0x0000);
dimage( 0, 0, &mainscreen);
dfont(&autofont);
if (BDrawDeco)
{
dprint_opt(102, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [Y]" );
if (OptionsSelection!=0) dprint_opt(100, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [Y]" );
else dprint_opt(100, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [Y]" );
}
else
{
dprint_opt(102, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [N]" );
if (OptionsSelection!=0) dprint_opt(100, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [N]" );
else dprint_opt(100, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [N]" );
}
if (BDrawCars)
{
dprint_opt(102, 52, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [Y]" );
if (OptionsSelection!=1) dprint_opt(100, 50, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [Y]" );
else dprint_opt(100, 50, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [Y]" );
}
else
{
dprint_opt(102, 52, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [N]" );
if (OptionsSelection!=1) dprint_opt(100, 50, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [N]" );
else dprint_opt(100, 50, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [N]" );
}
if (BDrawClds)
{
dprint_opt(102, 82, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [Y]" );
if (OptionsSelection!=2) dprint_opt(100, 80, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [Y]" );
else dprint_opt(100, 80, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [Y]" );
}
else
{
dprint_opt(102, 82, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [N]" );
if (OptionsSelection!=2) dprint_opt(100, 80, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [N]" );
else dprint_opt(100, 80, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [N]" );
}
if (BDrawBack)
{
dprint_opt(102, 112, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [Y]" );
if (OptionsSelection!=3) dprint_opt(100, 110, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [Y]" );
else dprint_opt(100, 110, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [Y]" );
}
else
{
dprint_opt(102, 112, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [N]" );
if (OptionsSelection!=3) dprint_opt(100, 110, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [N]" );
else dprint_opt(100, 110, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [N]" );
}
if (BDrawFPS)
{
dprint_opt(102, 142, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [Y]" );
if (OptionsSelection!=4) dprint_opt(100, 140, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [Y]" );
else dprint_opt(100, 140, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [Y]" );
}
else
{
dprint_opt(102, 142, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [N]" );
if (OptionsSelection!=4) dprint_opt(100, 140, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [N]" );
else dprint_opt(100, 140, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [N]" );
}
dprint_opt(102, 172, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" );
if (OptionsSelection!=5) dprint_opt(100, 170, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" );
else dprint_opt(100, 170, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" );
dimage( 10, 5+30*OptionsSelection, &flag );
// CODE HERE TO PRINT WELCOME MENU
dupdate();
pulse++;
getInputOptions();
#if IS_FXLIB==1
if (screenshot && usb_is_open())
{
usb_fxlink_screenshot(false);
screenshot = false;
}
if(record && usb_is_open())
{
usb_fxlink_videocapture(false);
}
#endif
}
SkipTime = true; // To avoid counting or de-counting time during menu
return;
}
void getInputOptions( void )
{
int opt = GETKEY_DEFAULT & ~GETKEY_REP_ARROWS;
int timeout = 1;
while(1)
{
key_event_t ev = getkey_opt(opt, &timeout);
if(ev.type == KEYEV_NONE) return;
int key = ev.key;
if (key==KEY_EXE)
{
if (OptionsSelection==0) BDrawDeco = !BDrawDeco;
else if (OptionsSelection==1) BDrawCars = !BDrawCars;
else if (OptionsSelection==2) BDrawClds = !BDrawClds;
else if (OptionsSelection==3) BDrawBack = !BDrawBack;
else if (OptionsSelection==4) BDrawFPS = !BDrawFPS;
else doneOptions=true;
}
if (key==KEY_UP)
{
if (OptionsSelection==0) OptionsSelection=5;
else OptionsSelection--;
}
if (key==KEY_DOWN)
{
if (OptionsSelection==5) OptionsSelection=0;
else OptionsSelection++;
}
#if IS_FXLIB==1
if(keydown(KEY_F5)) screenshot = true;
if(keydown(KEY_F6)) record = !record;
#endif // IS_FXLIB
}
}
void drawPauseQuit( void )
{
uint16_t pulse=0;
donePauseQuit = false;
PauseQuitSelection=0;
while (!donePauseQuit)
{
dclear(0x0000);
dimage( 0, 0, &mainscreen);
dfont(&autofont);
dprint_opt(102, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "GAME PAUSED" );
dprint_opt(100, 20, C_RGB(255,0,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "GAME PAUSED" );
dprint_opt(102, 82, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "FINISH RACE" );
if (PauseQuitSelection!=0) dprint_opt(100, 80, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "FINISH RACE" );
else dprint_opt(100, 80, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "FINISH RACE" );
dprint_opt(102, 122, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "MAIN MENU" );
if (PauseQuitSelection!=1) dprint_opt(100, 120, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "MAIN MENU" );
else dprint_opt(100, 120, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "MAIN MENU" );
dprint_opt(102, 162, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO OS" );
if (PauseQuitSelection!=2) dprint_opt(100, 160, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO OS" );
else dprint_opt(100, 160, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO OS" );
dimage( 10, 70+40*PauseQuitSelection, &flag );
// CODE HERE TO PRINT WELCOME MENU
dupdate();
pulse++;
getInputPauseQuit();
#if IS_FXLIB==1
if (screenshot && usb_is_open())
{
usb_fxlink_screenshot(false);
screenshot = false;
}
if(record && usb_is_open())
{
usb_fxlink_videocapture(false);
}
#endif
}
SkipTime = true; // To avoid counting or de-counting time during menu
return;
}
void getInputPauseQuit( void )
{
int opt = GETKEY_DEFAULT & ~GETKEY_REP_ARROWS;
int timeout = 1;
while(1)
{
key_event_t ev = getkey_opt(opt, &timeout);
if(ev.type == KEYEV_NONE) return;
int key = ev.key;
if (key==KEY_EXE)
{
if (PauseQuitSelection==0)
{
donePauseQuit=true;
}
else if (PauseQuitSelection==1)
{
stop=true;
donePauseQuit=true;
}
else if (PauseQuitSelection==2)
{
stop =true;
exitToOS=true;
donePauseQuit=true;
}
}
if (key==KEY_UP)
{
if (PauseQuitSelection==0) PauseQuitSelection=2;
else PauseQuitSelection--;
}
if (key==KEY_DOWN)
{
if (PauseQuitSelection==2) PauseQuitSelection=0;
else PauseQuitSelection++;
}
#if IS_FXLIB==1
if(keydown(KEY_F5)) screenshot = true;
if(keydown(KEY_F6)) record = !record;
#endif // IS_FXLIB
}
}