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

Diff of /enigma/src/menus.cc

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

revision 1.64.2.2 by dheck, Tue Sep 23 22:46:20 2003 UTC revision 1.64.2.3 by dheck, Fri Sep 26 14:48:21 2003 UTC
# Line 507  ValueButton::on_action(Widget */*w*/) Line 507  ValueButton::on_action(Widget */*w*/)
507    
508  namespace  namespace
509  {  {
     class FullscreenButton : public TextButton {  
         // ActionListener interface.  
         void on_action(Widget *) {  
             bool old = FullScreen;  
             FullScreen = video::ToggleFullscreen();  
             if (old != FullScreen)  
                 update();  
             else  
                 options::MustRestart = true;  
         }  
     public:  
         FullscreenButton() : TextButton("", this) { update(); }  
   
         void update() {  
             if (FullScreen > 0)  
                 set_text("Fullscreen");  
             else  
                 set_text("Window");  
         }  
     };  
   
510      class MouseSpeedButton : public ValueButton {      class MouseSpeedButton : public ValueButton {
511          int get_value() const     { return int(MouseSpeed+.5); }          int get_value() const     { return int(MouseSpeed+.5); }
512          void set_value(int value) { MouseSpeed = value; }          void set_value(int value) { MouseSpeed = value; }
# Line 539  namespace Line 518  namespace
518          }          }
519      public:      public:
520          MouseSpeedButton()          MouseSpeedButton()
521              : ValueButton("", minMouseSpeed, maxMouseSpeed)          : ValueButton("", minMouseSpeed, maxMouseSpeed)
522          { update(); }          { update(); }
523      };      };
524    
# Line 631  namespace Line 610  namespace
610          void update() {          void update() {
611              string sound_set;              string sound_set;
612              switch (SoundSet) {              switch (SoundSet) {
613                  case 0: sound_set = "Default"; break;              case 0: sound_set = "Default"; break;
614                  case 1: sound_set = "Enigma"; break;              case 1: sound_set = "Enigma"; break;
615                default :
616                    switch (OxydVersion(SoundSet-2)) {
617                    case OxydVersion_Oxyd1:          sound_set = "Oxyd"; break;
618                    case OxydVersion_OxydMagnum:     sound_set = "Magnum"; break;
619                    case OxydVersion_OxydMagnumGold: sound_set = "Mag.Gold"; break;
620                    case OxydVersion_OxydExtra:      sound_set = "Extra"; break;
621                    case OxydVersion_PerOxyd:        sound_set = "Per.Oxyd"; break;
622                  default :                  default :
623                      switch (OxydVersion(SoundSet-2)) {                      fprintf(stderr, "Invalid soundset %i\n", SoundSet);
                         case OxydVersion_Oxyd1:          sound_set = "Oxyd"; break;  
                         case OxydVersion_OxydMagnum:     sound_set = "Magnum"; break;  
                         case OxydVersion_OxydMagnumGold: sound_set = "Mag.Gold"; break;  
                         case OxydVersion_OxydExtra:      sound_set = "Extra"; break;  
                         case OxydVersion_PerOxyd:        sound_set = "Per.Oxyd"; break;  
                         default :  
                             fprintf(stderr, "Invalid soundset %i\n", SoundSet);  
                             break;  
                     }  
624                      break;                      break;
625                    }
626                    break;
627              }              }
628    
629              sound_set += " sound";              sound_set += " sound";
# Line 686  namespace Line 665  namespace
665          SkipSolvedButton() : TextButton("", this) { update(); }          SkipSolvedButton() : TextButton("", this) { update(); }
666      };      };
667    
     class DifficultyButton : public TextButton {  
         void update() {  
             if (Difficulty == DIFFICULTY_EASY)  
                 set_text("Difficulty: Easy");  
             else  
                 set_text("Difficulty: Normal");  
         }  
         void on_action(Widget *) {  
             Difficulty = (DIFFICULTY_EASY+DIFFICULTY_HARD)-Difficulty;  
             options::MustRestartLevel = true;  
             update();  
         }  
     public:  
         DifficultyButton() : TextButton("", this) { update(); }  
     };  
   
668      class VideoModeButton : public TextButton {      class VideoModeButton : public TextButton {
669          video::VideoModes get_mode() {          video::VideoModes get_mode() {
670              int mode = Clamp(options::VideoMode, 0, int(video::VM_COUNT));              int mode = Clamp(options::VideoMode, 0, int(video::VM_COUNT));
# Line 724  namespace Line 687  namespace
687      };      };
688  }  }
689    
690    
691    FullscreenButton::FullscreenButton() : TextButton("", this)
692    {
693        update();
694    }
695    
696    void FullscreenButton::on_action(Widget *)
697    {
698        bool old = FullScreen;
699        FullScreen = video::ToggleFullscreen();
700        if (old != FullScreen)
701            update();
702        else
703            options::MustRestart = true;
704    }
705    
706    
707    void FullscreenButton::update()
708    {
709        if (FullScreen > 0)
710            set_text("Fullscreen");
711        else
712            set_text("Window");
713    }
714    
715    DifficultyButton::DifficultyButton() : TextButton("", this)
716    {
717        update();
718    }
719    
720    void DifficultyButton::update()
721    {
722        if (Difficulty == DIFFICULTY_EASY)
723            set_text("Difficulty: Easy");
724        else
725            set_text("Difficulty: Normal");
726    }
727    
728    void DifficultyButton::on_action(Widget *)
729    {
730        Difficulty = (DIFFICULTY_EASY+DIFFICULTY_HARD)-Difficulty;
731        options::MustRestartLevel = true;
732        update();
733    }
734    
735    
736    
737  //----------------------------------------------------------------------  //----------------------------------------------------------------------
738  // Options menu  // Options menu
# Line 745  OptionsMenu::OptionsMenu(px::Surface *ba Line 754  OptionsMenu::OptionsMenu(px::Surface *ba
754      left.add (fullscreen);      left.add (fullscreen);
755      left.add (new MouseSpeedButton);      left.add (new MouseSpeedButton);
756      left.add (new SkipSolvedButton);      left.add (new SkipSolvedButton);
757      left.add (new DifficultyButton);  //    left.add (new DifficultyButton);
758      left.add (new VideoModeButton);      left.add (new VideoModeButton);
759    
760      right.add (new SoundVolumeButton);      right.add (new SoundVolumeButton);
# Line 825  LevelMenu::LevelMenu(LevelPack *lp, unsi Line 834  LevelMenu::LevelMenu(LevelPack *lp, unsi
834    back        (new TextButton("Back", this)),    back        (new TextButton("Back", this)),
835    m_nextlp    (new TextButton(">", this)),    m_nextlp    (new TextButton(">", this)),
836    m_prevlp    (new TextButton("<", this)),    m_prevlp    (new TextButton("<", this)),
837      m_difficulty(new DifficultyButton),
838    m_lpbutton  (new TextButton("Level Pack", this)),    m_lpbutton  (new TextButton("Level Pack", this)),
839    m_infobutton(new Label("")),    m_infobutton(new Label("")),
840    m_levelinfo (new Label("")),    m_levelinfo (new Label("")),
# Line 836  LevelMenu::LevelMenu(LevelPack *lp, unsi Line 846  LevelMenu::LevelMenu(LevelPack *lp, unsi
846      const int      const int
847          BX=140,                 // button xsize          BX=140,                 // button xsize
848          BY=35,                  // button ysize          BY=35,                  // button ysize
 //         SX=5,                   // x spacing  
 //         SY=2,                   // y spacing  
 //         OX=(BX+SX),  
 //         OY=(BY+SY),  
 //         RJ=(605+SX),            // right justification  
849          Y1=60,                  // y position for level preview          Y1=60,                  // y position for level preview
850          Y2=10,                  // y position for information area          Y2=10,                  // y position for information area
851          Y3=430;                 // y position for bottom button row          Y3=430;                 // y position for bottom button row
# Line 852  LevelMenu::LevelMenu(LevelPack *lp, unsi Line 857  LevelMenu::LevelMenu(LevelPack *lp, unsi
857          unsolved = new ImageButton("ic-unsolved", "ic-unsolved1", this);          unsolved = new ImageButton("ic-unsolved", "ic-unsolved1", this);
858          // new TextButton("Timer on")          // new TextButton("Timer on")
859    
860          BuildHList hlist1(this, Rect(10, Y3, BX, BY), 15);          BuildHList hlist1(this, Rect(10, Y3, BX, BY), 10);
861    
862          hlist1.add (m_lpbutton);          hlist1.add (m_lpbutton);
863          hlist1.add (unsolved);          hlist1.add (unsolved);
864          hlist1.add (newgame);          hlist1.add (m_difficulty);
865    //        hlist1.add (newgame);
866          hlist1.add (back);          hlist1.add (back);
867      }      }
868    

Legend:
Removed from v.1.64.2.2  
changed lines
  Added in v.1.64.2.3

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