ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
clock.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_CLOCK_H
23 #define DGDS_CLOCK_H
24 
25 #include "common/rect.h"
26 #include "common/error.h"
27 #include "common/serializer.h"
28 
29 namespace Graphics {
30 class ManagedSurface;
31 }
32 
33 namespace Dgds {
34 
35 class Global;
36 
37 /* The game clock - drawn to the screen in Rise of the Dragon */
38 class Clock {
39 public:
40  Clock();
41  void addGameTime(int mins);
42 
43  Common::String getTimeStr() const;
44  void draw(Graphics::ManagedSurface &surf);
45  void toggleVisibleUser() { _visibleUser = !_visibleUser; }
46  void setVisibleScript(bool val) { _visibleScript = val; }
47 
48  void update(bool gameRunning);
49 
50  int16 getMins() const { return _mins; }
51 
52  Global *getMinsGlobal(uint16 num);
53  Global *getHoursGlobal(uint16 num);
54  Global *getDaysGlobal(uint16 num);
55  Global *getDays2Global(uint16 num);
56  Global *getGameMinsAddedGlobal(uint16 num);
57  Global *getGameTicksUpGlobal(uint16 num);
58  Global *getGameTicksDownGlobal(uint16 num);
59 
60  const Common::Rect &getPos() const { return _drawPos; }
61 
62  Common::Error syncState(Common::Serializer &s);
63 
64  Common::String dump() const;
65 
66  void resetMinsAdded() { _gameMinsAdded = 0; }
67 
68 private:
69  uint32 _lastPlayTime;
70  uint32 _millis;
71 
72  int16 _gameMinsAdded;
73  int16 _gameTicksUp;
74  int16 _gameTicksDown;
75 
76  int16 _days;
77  int16 _days2;
78  int16 _hours;
79  int16 _mins;
80 
81  Common::Rect _drawPos;
82 
83  // Clock is shown if both are true;
84  bool _visibleScript;
85  bool _visibleUser;
86 };
87 
88 } // end namespace Dgds
89 
90 #endif // DGDS_CLOCK_H
Definition: managed_surface.h:51
Definition: str.h:59
Definition: error.h:84
Definition: ads.h:28
Definition: rect.h:144
Definition: serializer.h:79
Definition: clock.h:38
Definition: formatinfo.h:28
Definition: globals.h:44