ScummVM API documentation
NumericalPanel.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 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of Penumbra Overture.
26  */
27 
28 #ifndef GAME_NUMERICAL_PANEL_H
29 #define GAME_NUMERICAL_PANEL_H
30 
31 #include "hpl1/engine/engine.h"
32 
33 #include "hpl1/penumbra-overture/GameTypes.h"
34 
35 using namespace hpl;
36 
37 class cInit;
38 
39 //---------------------------
40 class cNumericalPanel;
41 
43 public:
44  cNumericalButton(cInit *apInit, cNumericalPanel *apPanel, cVector2f avPos, cVector2f avSize, int alNum);
46 
47  void OnUpdate(float afTimeStep);
48 
49  void OnDraw();
50 
51  void OnMouseDown();
52  void OnMouseUp();
53  void OnMouseOver(bool abOver);
54 
55  const cRect2f &GetRect() { return mRect; }
56 
57 private:
58  cGfxObject *mpGfxUp;
59  cGfxObject *mpGfxDown;
60 
61  float mfAlpha;
62  bool mbOver;
63 
64  cInit *mpInit;
65  cGraphicsDrawer *mpDrawer;
66  cNumericalPanel *mpPanel;
67 
68  cVector3f mvPositon;
69  cRect2f mRect;
70 
71  int mlNum;
72 };
73 
76 
77 //---------------------------------------------
78 
79 class cNumericalPanel : public iUpdateable {
80  friend class cNumericalButton;
81 
82 public:
83  cNumericalPanel(cInit *apInit);
84  ~cNumericalPanel();
85 
86  void Reset();
87 
88  void OnDraw();
89 
90  void Update(float afTimeStep);
91 
92  void SetMousePos(const cVector2f &avPos);
93  void AddMousePos(const cVector2f &avRel);
94  cVector2f GetMousePos() { return mvMousePos; }
95 
96  void OnMouseDown(eMButton aButton);
97  void OnMouseUp(eMButton aButton);
98 
99  void SetActive(bool abX);
100  bool IsActive() { return mbActive; }
101 
102  void OnExit();
103 
104  void AddDigit(int alNum);
105 
106  void SetUp(const tString &asName, const tString &asCallback);
107 
108  void SetCode(tIntVec &avCode);
109 
110 private:
111  cInit *mpInit;
112  cGraphicsDrawer *mpDrawer;
113 
114  cGfxObject *mpGfxBackground;
115  cGfxObject *mpGfxPanel;
116 
117  bool mbMouseIsDown;
118 
119  bool mbActive;
120  float mfAlpha;
121 
122  cVector2f mvMousePos;
123 
124  eCrossHairState mLastCrossHairState;
125 
126  tNumericalButtonList mlstButtons;
127 
128  tString msName;
129  tString msCallback;
130 
131  tIntVec mvDigits;
132  tIntVec mvCode;
133 };
134 
135 //---------------------------------------------
136 
137 #endif // GAME_NUMERICAL_PANEL_H
Definition: AI.h:36
Definition: str.h:59
Definition: NumericalPanel.h:79
Definition: GraphicsDrawer.h:77
Definition: NumericalPanel.h:42
Definition: GfxObject.h:38
Definition: Updateable.h:35
Definition: list_intern.h:51
Definition: Init.h:70