ScummVM API documentation
timer.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 BAGEL_BOFLIB_TIMER_H
23 #define BAGEL_BOFLIB_TIMER_H
24 
25 #include "bagel/boflib/timer.h"
26 #include "bagel/boflib/llist.h"
27 #include "bagel/boflib/gfx/palette.h"
28 
29 namespace Bagel {
30 
31 struct WindowTimer {
32  uint32 _interval = 0;
33  uint32 _lastExpiryTime = 0;
34  uint32 _id = 0;
35  BofCallback _callback = nullptr;
36 
37  WindowTimer() { }
38  WindowTimer(uint32 interval, uint32 id, BofCallback callback);
39 };
40 
41 
42 class CBofTimer: public CBofObject, public CLList {
43 public:
44  CBofTimer();
45  CBofTimer(uint32 nID, uint32 nInterval, void *lUserInfo, BofCallback pCallBack);
46  ~CBofTimer();
47 
48  void start() {
49  _bActive = true;
50  }
51  void stop() {
52  _bActive = false;
53  }
54 
55  bool isActive() {
56  return _bActive;
57  }
58 
59  void setID(uint32 nID) {
60  _nID = nID;
61  }
62  uint32 getID() {
63  return _nID;
64  }
65 
66  void setInterval(uint32 nInterval) {
67  _nInterval = nInterval;
68  }
69  uint32 getInterval() {
70  return _nInterval;
71  }
72 
73  void setUserInfo(void *lUserInfo) {
74  _lUserInfo = lUserInfo;
75  }
76  void *getUserInfo() {
77  return _lUserInfo;
78  }
79 
80  void setCallBack(BofCallback pCallBack) {
81  _pCallBack = pCallBack;
82  }
83  BofCallback getCallBack() {
84  return _pCallBack;
85  }
86 
87  static void handleTimers();
88 
89  //
90  // members
91  //
92 
93 protected:
94 
95  static CBofTimer *_pTimerList;
96  static bool _bModified;
97 
98 public:
99 
100  uint32 _lLastTime;
101  uint32 _nID;
102  uint32 _nInterval;
103  BofCallback _pCallBack;
104  void *_lUserInfo;
105  bool _bActive;
106 };
107 
108 } // namespace Bagel
109 
110 #endif
Definition: object.h:28
Definition: bagel.h:31
Definition: timer.h:42
Definition: llist.h:31
Definition: timer.h:31