GP32 From Splash Screen To Main Game


solarice

Member
Joined
Jan 29, 2004
Messages
120
Location
UK
Website
Visit site
Hi,

Quick question.

I've got my splash screen appearing in the game im making and a command that checks if start is being pressed in order for you to start the game. However when start is pressed the map appears but as soon as the start button is released it defaults back to main screen. Am i right in thinking i'll probably have to put the main game section in its own loop so when start is pressed it jumps to that loop instead of it being in one big one.

perhaps a stupid question but hey :D

also any idea of the code would be appreciated.

Thanks in Advance
 
I can't fully understand you, but I am handling those things the following way:

LOOP
LOOP
Titlescreen stuff
UNTIL start is pressed

LOOP
Gameplay stuff
UNTIL game over

LOOP
Game Over screen stuff
UNTIL button pressed
UNTIL well till the end of time. or your batteries. whatever comes first.

If I understood you completely wrong, and you are just saying that your START-button is "bouncing", just
include a delay after the title screen, like 1 second. Then clear your button registers and all should be fine.
 
in your main game loop you could call a function by a function pointer. The function pointer could point to a function that draws your splash screen until you press a button, at which point you change the function pointer to point to the function that draws your game.

eg:
Code:
/* Declare Functions */
int MainGameLoop(int nInfo);
int SplashScreen(int nInfo);

/* Declare Function Pointers */
int (*pUpdateFunction)(int);

int Main()
{
   /* Declare vars */
int bGameExit = 1;
   /* Set up function pointer */
   pUpdateFunction = SplashScreen;

   /* Main Game Loop */
   while (!bGameExit)						
   {
      pUpdateFunction(1);
      
      GpKeyGetEx(&nButtonsPressed);
      if (nButtonsPressed & GPC_VK_START)
     {
         pUpdateFunction = MainGameLoop;
     }
   }
}
[CODE]

Also, can someone tell me how to keep the indentation when I post code please?
 
Back
Top