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