/[enigma]/enigma/src/game.cc
ViewVC logotype

Diff of /enigma/src/game.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by mhawlisch, Thu Apr 3 11:02:34 2003 UTC revision 1.14 by reallysoft, Fri Apr 11 13:33:29 2003 UTC
# Line 23  Line 23 
23  #include "options.hh"  #include "options.hh"
24  #include "video.hh"  #include "video.hh"
25  #include "sound.hh"  #include "sound.hh"
26    #include "help.hh"
27    
28  #include "px/sdl.hh"  #include "px/sdl.hh"
29    
# Line 76  namespace Line 77  namespace
77          gui::Widget *resume, *restart, *options, *abort;          gui::Widget *resume, *restart, *options, *abort;
78      };      };
79    
     class HelpMenu : public gui::Menu {  
     public:  
         HelpMenu();  
     private:  
         bool on_event (const SDL_Event &e);  
         void on_action(gui::Widget *w);  
         void draw_background(px::GC &gc);  
         gui::Widget *ok;  
     };  
   
80      class Game {      class Game {
81      public:      public:
82          Game();          Game();
# Line 184  GameMenu::on_action(gui::Widget *w) { Line 175  GameMenu::on_action(gui::Widget *w) {
175      }      }
176  }  }
177    
 //----------------------------------------  
 // HelpMenu impl  
 //----------------------------------------  
 HelpMenu::HelpMenu()  
 : ok(new gui::TextButton("Ok", this))  
 {  
     add(ok,     Rect(640-170,480-60,150,40));  
 }  
   
 bool  
 HelpMenu::on_event (const SDL_Event &e)  
 {  
     if (e.type == SDL_MOUSEBUTTONDOWN  
         && e.button.button == SDL_BUTTON_RIGHT)  
     {  
         Menu::quit();  
         return true;  
     }  
     return false;  
 }  
   
 void  
 HelpMenu::on_action(gui::Widget *w)  
 {  
     if (w == ok)  
         Menu::quit();  
 }  
   
 void  
 HelpMenu::draw_background(px::GC &gc)  
 {  
     blit(gc, 0,0, enigma::GetImage("menu_bg"));  
     Font *f = enigma::GetFont("menufont");  
   
     int x = 60;  
     int x2 = x+200;  
     int y = 60;  
     int yskip = 30;  
   
     f->render(gc,x,y,  "Left mouse button:");  
     f->render(gc,x2,y, "Activate/drop leftmost inventory item");  
     y += yskip;  
   
     f->render (gc,x,y, "Right mouse button:");  
     f->render (gc,x2,y,"Rotate inventory items");  
     y += yskip;  
   
     f->render (gc,x,y, "Escape:");  
     f->render (gc,x2,y,"Show game menu");  
     y += yskip;  
   
     f->render (gc,x,y, "F1:");  
     f->render (gc,x2,y,"Show this help");  
     y += yskip;  
   
     f->render (gc,x,y, "F3:");  
     f->render (gc,x2,y,"Kill current marble");  
     y += yskip;  
   
     f->render (gc,x,y, "F10:");  
     f->render (gc,x2,y,"Make screenshot");  
     y += yskip;  
   
     f->render (gc,x,y, "Left arrow:");  
     f->render (gc,x2,y,"Decrease mouse speed");  
     y += yskip;  
   
     f->render (gc,x,y, "Right arrow:");  
     f->render (gc,x2,y,"Increase mouse speed");  
     y += yskip;  
   
     f->render (gc,x,y, "Alt+x:");  
     f->render (gc,x2,y,"Return to level menu");  
     y += yskip;  
   
     f->render (gc,x,y, "Alt+Return:");  
     f->render (gc,x2,y,"Switch between fullscreen and window");  
     y += yskip;  
 }  
   
178    
179    
180    
# Line 749  Game::on_keydown(SDL_Event &e) Line 660  Game::on_keydown(SDL_Event &e)
660      }      }
661  }  }
662    
663    static const char *helptext_ingame[] = {
664        "Left mouse button:",       "Activate/drop leftmost inventory item",
665        "Right mouse button:",      "Rotate inventory items",
666        "Escape:",                  "Show game menu",
667        "F1:",                      "Show this help",
668        "F3:",                      "Kill current marble",
669        "F10:",                     "Make screenshot",
670        "Left arrow:",              "Decrease mouse speed",
671        "Right arrow:",             "Increase mouse speed",
672        "Alt+x:",                   "Return to level menu",
673        "Alt+Return:",              "Switch between fullscreen and window",
674    
675        0
676    };
677    
678  void  void
679  Game::show_help()  Game::show_help()
680  {  {
681      sdl::TempInputGrab grab(SDL_GRAB_OFF);      sdl::TempInputGrab grab(SDL_GRAB_OFF);
682    
683      video::ShowMouse();      video::ShowMouse();
684      HelpMenu().manage(screen);  
685        displayHelp(screen, helptext_ingame, 200);
686    
687      video::HideMouse();      video::HideMouse();
688      update_mouse_button_state();      update_mouse_button_state();
689      last_tick_time = SDL_GetTicks();      last_tick_time = SDL_GetTicks();

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26