Esempio n. 1
0
void GameOptions(Game *game,int options)   /*new game, quit, select difficulty*/
{
  Uint8 *keys;
  Sprite *menu;
  int done = 0;
  menu = LoadSprite("images/menu.png",640,480);
  do
  {
    ResetBuffer();
    SDL_PumpEvents();
    MouseThink();
    keys = SDL_GetKeyState(NULL);    
    if(keys[SDLK_ESCAPE] == 1)
    {
        exit(0);
    }
    if(keys[SDLK_RETURN] == 1)
    {
      FreeSprite(menu);
      SDL_PumpEvents();
      return;
    }
    if(keys[SDLK_F2] == 1)
    {
      NewGame(game);
      NewLevel(game,8,4);  /*sets up a new level*/
      done = 1;
      FreeSprite(menu);
    }
    DrawMessages();
    DrawSprite(menu,screen,(screen->w - 640)/2,(screen->h - 480)/2,0);
    DrawText("New Game  : F2",screen,(screen->w - 640)/2 + 50,(screen->h - 480)/2 + 160,IndexColor(LightGreen),F_Medium);
    DrawText("Quit      : Escape",screen,(screen->w - 640)/2 + 50,(screen->h - 480)/2 + 200,IndexColor(LightGreen),F_Medium);
    if(options == 0)
    {
      DrawText("This Menu : F1",screen,(screen->w - 640)/2 + 50,(screen->h - 480)/2 + 180,IndexColor(LightGreen),F_Medium);
    }
    else
    {
      DrawText("Cancel    : Enter",screen,(screen->w - 640)/2 + 50,(screen->h - 480)/2 + 180,IndexColor(LightGreen),F_Medium);
      DrawText("Game Paused",screen,(screen->w / 2) - 80,(screen->h - 480)/2 + 440,IndexColor(LightRed),F_Small);
    }
    DrawMouse();
    NextFrame();
  }while(!done);
  
}
Esempio n. 2
0
void mainMenu()
{
  int done;
  int keyn;
  Uint8 *keys;
  
  done = 0;
  do
  {
    ResetBuffer();
    Updateskybox();
    done = updateMainMenu();
    DrawMessages();
    DrawMouse();
    NextFrame();
    SDL_PumpEvents();
    keys = SDL_GetKeyState(&keyn);
    if(keys[SDLK_ESCAPE])exit(1);
  }while(!done);

}
Esempio n. 3
0
File: game.c Progetto: jc429/276game
void DrawMainMenu(){
	DrawMenus();
	DrawMouse();
}