Ok, so what I am trying to do works fine but I can't capture the Enter key and the ESC key.
What I have is a menu state and a game state. What I want to happen is when a player presses "ENTER" on the game menu it then moves to the game state.
If the player presses "ESC" while in the game state it will go back to the menu state.
Now if the player presses "ESC" during the menu state it will quit the program.
Problem I am having is that the program will read other keys but no the "ENTER" key, so it just wont work at all. The other problem is that "ESC" won't switch back to case 0 in my switch statement but will exit the program entirely no matter where I am. Please help.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// we give the x,y coord's variables so that when we assign them to an object we can adjust them and manouver the object
int ballposx = 120;
int ballposy = 300;
int ballspeedx = 10;
int Screen = 0;
do
{
switch (Screen)
{
case 0:
ClearScreen();
if ( IsKeyDown('CR'))
{
Screen = 1;
}
DrawSprite(gamemenu);
MoveSprite( gamemenu, 640, 370 );
break;
case 1:
ClearScreen();
if ( IsKeyDown('ESC'))
{
Screen = 0;
}
ballposx += ballspeedx;
MoveSprite( iPlayerSprite, ballposx, ballposy );
if( ballposx + ballw > screenw || ballposx < 0 )
{
ballspeedx *= -1;
}
DrawSprite(iPlayerSprite);
break;
}
} while ( FrameworkUpdate() == false );
Shutdown();
return 0;
}