ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
menu.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef DGDS_MENU_H
23 #define DGDS_MENU_H
24 
25 #include "graphics/surface.h"
26 #include "dgds/request.h"
27 
28 namespace Dgds {
29 
30 class REQFileData;
31 
32 enum MenuId {
33  // Request data numbers, most are same in both RoTD and China VCRs
34  kMenuNone = 0,
35  kMenuMainBeamish = 3,
36  kMenuMain = 5,
37  kMenuControls = 7,
38  kMenuOptions = 29,
39  kMenuCalibrate = 30,
40  kMenuFiles = 21,
41  kMenuGameOver = 41,
42  kMenuRestart = 39,
43  kMenuCantSave = 36,
44  kMenuSaveNeedName = 43,
45  kMenuNotSavedDiskFull = 42,
46  kMenuReplaceSave = 38,
47  kMenuSaveDlg = 23,
48  kMenuChangeDir = 25,
49  kMenuAskCreateDir = 26,
50  kMenuInvalidDir = 37,
51  kMenuCalibrateJoystick = 28,
52  kMenuCalibrateMouse = 32,
53  kMenuReallyQuit = 35,
54  kMenuReplayArcade = 45,
55  kMenuSaveBeforeArcade = 46,
56  kMenuArcadeFrustrated = 47,
57  kMenuSkipPlayIntro = 50,
58  kMenuSkipArcade = 52,
59  kMenuWillyVCRHelp = 54,
60  kMenuWillyCredits = 56,
61 };
62 
63 class Menu {
64 private:
65  Graphics::Surface _screenBuffer;
66  MenuId _curMenu = kMenuMain;
67 
68 public:
69  Menu();
70  virtual ~Menu();
71 
72  void setScreenBuffer();
73  void drawMenu(MenuId menu = kMenuMain, bool clearScreen = true);
74  void onMouseLUp(const Common::Point &mouse);
75  void onMouseLDown(const Common::Point &mouse);
76  void onMouseMove(const Common::Point &mouse);
77  bool menuShown() const { return _curMenu != kMenuNone; }
78  void hideMenu();
79 
80  void setRequestData(const REQFileData &data);
81  void loadVCRHelp(const char *fname);
82  void prevChoice();
83  void nextChoice();
84  void activateChoice();
85  void onTick();
86 
87 private:
88  Gadget *getClickedMenuItem(const Common::Point &mouseClick);
89  void drawMenuText(Graphics::ManagedSurface &dst);
90  void drawCreditsText(Graphics::ManagedSurface &dst);
91  void toggleGadget(int16 gadgetId, bool enable);
92  void configureGadget(MenuId menu, Gadget *gadget);
93  bool updateOptionsGadget(Gadget *gadget);
94  bool handleClick(const Common::Point &mouse);
95  void handleClickOptionsMenu(const Common::Point &mouse);
96  void handleClickSkipPlayIntroMenu(const Common::Point &mouse);
97  void loadCredits();
98  void startVcrHelp();
99  void doVcrHelp(int16 button);
100  uint16 mapMenuNum(uint16 num) const;
101 
102  void putMouseOnSelectedItem();
103  Gadget *getSelectedItem();
104 
105  Common::HashMap<int, RequestData> _menuRequests;
106 
109 
110  SliderGadget *_dragGadget;
111  Common::Point _dragStartPt;
112  int _selectedItem;
113  int _numSelectable;
114  int _creditsOffset;
115  bool _vcrHelpMode;
116 };
117 
118 } // End of namespace Dgds
119 
120 #endif // DGDS_DGDS_H
Definition: managed_surface.h:51
Definition: surface.h:67
Definition: ads.h:28
Definition: request.h:62
Definition: menu.h:63
Definition: hashmap.h:85
Definition: rect.h:45
Definition: request.h:222
Definition: request.h:136