ScummVM API documentation
te_scrolling_layout.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 TETRAEDGE_TE_TE_SCROLLING_LAYOUT_H
23 #define TETRAEDGE_TE_TE_SCROLLING_LAYOUT_H
24 
25 #include "tetraedge/te/te_animation.h"
26 #include "tetraedge/te/te_curve_anim2.h"
27 #include "tetraedge/te/te_layout.h"
28 #include "tetraedge/te/te_timer.h"
29 #include "tetraedge/te/te_signal.h"
30 
31 namespace Tetraedge {
32 
33 class TeScrollingLayout : public TeLayout {
34 public:
36  virtual ~TeScrollingLayout();
37 
38  void setInertiaAnimationDuration(int duration) {
39  _inertiaAnimationDuration = duration;
40  }
41  void setInertiaAnimationCurve(const Common::Array<float> &curve) {
42  _inertiaAnimationCurve = curve;
43  }
44  void setAutoScrollDelay(uint val) {
45  _autoScrollDelay = val;
46  }
47  void setAutoScrollLoop(int loop) {
48  _autoScrollLoop = loop;
49  }
50  void setAutoScrollAnimation1Speed(float speed) {
51  _autoScrollAnimation1Speed = speed;
52  }
53  void setAutoScrollAnimation2Speed(float speed) {
54  _autoScrollAnimation2Speed = speed;
55  }
56  void setAutoScrollAnimation1Enabled(bool enabled) {
57  _autoScrollAnimation1Enabled = enabled;
58  }
59  void setAutoScrollAnimation2Enabled(bool enabled) {
60  _autoScrollAnimation2Enabled = enabled;
61  }
62  void setAutoScrollAnimation1Delay(int delay) {
63  _autoScrollAnimation1Delay = delay;
64  }
65  void setAutoScrollAnimation2Delay(int delay) {
66  _autoScrollAnimation2Delay = delay;
67  }
68  void setAutoScrollAnimation1Curve(const Common::Array<float> &curve) {
69  _autoScrollAnimation1Curve = curve;
70  }
71  void setAutoScrollAnimation2Curve(const Common::Array<float> &curve) {
72  _autoScrollAnimation2Curve = curve;
73  }
74  const TeVector3f32 &direction() const {
75  return _direction;
76  }
77  void setDirection(const TeVector3f32 &dir) {
78  _direction = dir;
79  }
80  void setMouseControl(bool val) {
81  _mouseControl = val;
82  }
83  void setEnclose(bool val) {
84  _enclose = val;
85  }
86  void setContentLayout(TeLayout *layout);
87  void setSpeed(const TeVector3f32 &speed);
88 
89  bool onAutoScrollDelayTimer();
90  bool onAutoScrollAnimation1DelayTimer();
91  bool onAutoScrollAnimation2DelayTimer();
92  bool onAutoScrollAnimation1Finished();
93  bool onAutoScrollAnimation2Finished();
94  bool onMouseMove(const Common::Point &pt);
95  bool onSlideButtonDown();
96  bool onMouseLeftUp(const Common::Point &pt);
97 
98  void playAutoScrollAnimation1();
99  void playAutoScrollAnimation2();
100 
101  void resetScrollPosition();
102  void playAutoScroll();
103  TeVector3f32 scrollPosition();
104  void setScrollPosition(const TeVector3f32 &newpos);
105 
106 private:
107  int _inertiaAnimationDuration;
108  Common::Array<float> _inertiaAnimationCurve;
110 
111  int _autoScrollLoop;
112  int _currentScrollLoopNo;
113 
114  uint _autoScrollDelay;
115  TeTimer _autoScrollDelayTimer;
116 
117  float _autoScrollAnimation1Speed;
118  float _autoScrollAnimation2Speed;
119  bool _autoScrollAnimation1Enabled;
120  bool _autoScrollAnimation2Enabled;
121  int _autoScrollAnimation1Delay;
122  int _autoScrollAnimation2Delay;
123  TeTimer _autoScrollAnimation1Timer;
124  TeTimer _autoScrollAnimation2Timer;
125  Common::Array<float> _autoScrollAnimation1Curve;
126  Common::Array<float> _autoScrollAnimation2Curve;
127  TeCurveAnim2<TeScrollingLayout, TeVector3f32> _autoScrollAnimation1;
128  TeCurveAnim2<TeScrollingLayout, TeVector3f32> _autoScrollAnimation2;
129 
130  TeVector3f32 _direction;
131  TeVector3f32 _speed;
132  TeTimer _scrollTimer;
133  bool _mouseControl;
134  bool _enclose;
135  TeLayout *_contentLayout;
136  TeVector3f32 _contentLayoutUserPos;
137 
138  TeVector2s32 _slideDownMousePos;
139  float _mouseMoveThreshold;
140 
141  TeVector3f32 _lastMouseDownPos;
142  bool _insideMouseThreshold;
143 
144  TeSignal0Param _posUpdatedSignal;
145 };
146 
147 } // end namespace Tetraedge
148 
149 #endif // TETRAEDGE_TE_TE_SCROLLING_LAYOUT_H
Definition: te_signal.h:40
Definition: detection.h:27
Definition: te_curve_anim2.h:36
Definition: te_timer.h:33
Definition: te_layout.h:35
Definition: rect.h:45
Definition: te_vector2s32.h:31
Definition: te_vector3f32.h:33
Definition: te_scrolling_layout.h:33