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