ScummVM API documentation
scroller.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 ZVISION_SCROLLER_H
23 #define ZVISION_SCROLLER_H
24 
25 #include "common/rect.h"
26 #include "zvision/zvision.h"
27 
28 namespace ZVision {
29 
39 public:
40  LinearScroller(const int16 activePos, const int16 idlePos, const int16 period = 500);
41  ~LinearScroller();
42  void reset();
43  bool update(uint32 deltatime);
44  void setActive(bool active);
45  bool isMoving();
46  int16 getPos();
47 
48  int16 _pos;
49  int16 _prevPos;
50 
51 private:
52  bool _active = false;
53  bool _moving = false;
54  const int16 _activePos;
55  const int16 _idlePos;
56  const int16 _deltaPos;
57  const int16 _period;
58 };
59 
67 class Scroller {
68 public:
69  Scroller(const Common::Point &activePos, const Common::Point &idlePos, const int16 period = 500);
70  ~Scroller();
71  void reset();
72  bool update(uint32 deltatime);
73  void setActive(bool active);
74  bool isMoving();
75 
76  Common::Point _pos;
77 
78 private:
79  LinearScroller _xScroller, _yScroller;
80 };
81 
82 } // End of namespace ZVision
83 
84 #endif
Definition: scroller.h:67
Definition: focus_list.h:27
void reset()
Set idle and immediately jump to idle position.
Definition: rect.h:144
Definition: scroller.h:38
bool update(uint32 deltatime)
Calculate updated position of scrolled graphics; return true if redraw is necessary.
void setActive(bool active)
Set active or idle & scroll at set speed from current position to that position.