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 NANCY_UI_CLOCK_H
23 #define NANCY_UI_CLOCK_H
24 
25 #include "engines/nancy/renderobject.h"
26 #include "engines/nancy/enginedata.h"
27 #include "engines/nancy/time.h"
28 
29 #include "engines/nancy/ui/animatedbutton.h"
30 
31 namespace Nancy {
32 
33 struct NancyInput;
34 
35 namespace UI {
36 
37 class Clock : public RenderObject {
38 public:
39  Clock();
40  virtual ~Clock() = default;
41 
42  void init() override;
43  void registerGraphics() override;
44  void updateGraphics() override;
45  void handleInput(NancyInput &input);
46 
47  // Used to disable the UI clock when a scene can change the in-game time (e.g. SetPlayerClock)
48  void lockClock(bool val) { _locked = val; }
49 
50  void drawClockHands();
51 
52 protected:
53  class ClockAnim : public AnimatedButton {
54  public:
55  ClockAnim(uint zOrder, Clock *owner) : AnimatedButton(zOrder), _owner(owner), _closeTime(0), _timeToKeepOpen(0) {}
56  virtual ~ClockAnim() = default;
57 
58  void init() override;
59  void updateGraphics() override;
60  void onClick() override;
61  void onTrigger() override;
62 
63  private:
64  Clock *_owner;
65 
66  uint32 _closeTime;
67  uint32 _timeToKeepOpen;
68  };
69 
70  const CLOK *_clockData;
71  ClockAnim _animation;
72 
73  // Used for gargoyle eyes in TVD, inside of watch in nancy2 and up
74  RenderObject _staticImage;
75 
76  Time _playerTime;
77  bool _locked;
78 };
79 
80 // Separate class since it's not actually a clock, and is non-interactable. Instead, this shows which
81 // in-game day it currently is, and also displays a countdown during the endgame
82 class Nancy5Clock : public RenderObject {
83 public:
84  Nancy5Clock() : RenderObject(10) {}
85  virtual ~Nancy5Clock() = default;
86 
87  void init() override;
88  void updateGraphics() override;
89 
90 private:
91  int32 _currentDay = -1;
92  int32 _countdownProgress = -1;
93 
94  const CLOK *_clockData = nullptr;
95 };
96 
97 } // End of namespace UI
98 } // End of namespace Nancy
99 
100 #endif // NANCY_UI_CLOCK_H
Definition: animatedbutton.h:33
Definition: time.h:30
Definition: input.h:41
Definition: soundequalizerpuzzle.h:27
Definition: renderobject.h:36
Definition: clock.h:37
Definition: enginedata.h:372
Definition: clock.h:82
Definition: actionmanager.h:32
Definition: clock.h:53