ScummVM API documentation
te_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_LAYOUT_H
23 #define TETRAEDGE_TE_TE_LAYOUT_H
24 
25 #include "tetraedge/te/te_3d_object2.h"
26 #include "tetraedge/te/te_i_layout.h"
27 #include "tetraedge/te/te_i_3d_object2.h"
28 #include "tetraedge/te/te_matrix4x4.h"
29 #include "tetraedge/te/te_quaternion.h"
30 #include "tetraedge/te/te_vector2s32.h"
31 #include "tetraedge/te/te_vector3f32.h"
32 
33 namespace Tetraedge {
34 
35 class TeLayout : public TeILayout, public Te3DObject2 {
36 public:
37  TeLayout();
38 
39  virtual ~TeLayout();
40 
41  void addChild(Te3DObject2 *child) override;
42  void addChildBefore(Te3DObject2 *newchild, const Te3DObject2 *ref) override;
43  const TeVector3f32 &anchor();
44  void disableAutoZ();
45  void enableAutoZ();
46  bool isAutoZEnabled();
47 
48  void draw() override;
49 
50  virtual bool isMouseIn(const TeVector2s32 &mouseloc);
51 
52  DrawMode mode();
53 
54  bool onChildSizeChanged();
55  bool onParentSizeChanged();
56  bool onParentWorldTransformationMatrixChanged();
57 
58  TeVector3f32 position() override;
59  CoordinatesType positionType() const;
60  float ratio() const;
61  RatioMode ratioMode() const;
62  void removeChild(Te3DObject2 *child) override;
63  float safeAreaRatio() const;
64  void setAnchor(const TeVector3f32 &anchor);
65  virtual void setEditionColor(TeColor col) {};
66  void setMode(DrawMode mode);
67  void setParent(Te3DObject2 *parent) override;
68  void setPosition(const TeVector3f32 &pos) override;
69  void setPositionType(CoordinatesType newtype);
70  void setRatio(float val);
71  void setRatioMode(RatioMode mode);
72  void setRotation(const TeQuaternion &rot) override;
73  void setSafeAreaRatio(float ratio);
74  void setScale(const TeVector3f32 &scale) override;
75  void setSize(const TeVector3f32 &size) override;
76  void setSizeType(CoordinatesType coordtype);
77  void setZPosition(float zpos) override;
78 
79  virtual TeVector3f32 size() override;
80  CoordinatesType sizeType() const;
81  TeVector3f32 transformMousePosition(const TeVector2s32 &mousepos);
82 
83  virtual void updateMesh() {}; // override available for TeSpriteLayout
84  void updatePosition();
85  virtual void updateSize();
86  void updateWorldMatrix();
87  void updateZ() override;
88  void updateZSize();
89 
90  TeVector3f32 userPosition() const;
91  TeVector3f32 userSize();
92  TeVector3f32 worldPosition() override;
93  TeMatrix4x4 worldTransformationMatrix() override;
94  bool worldVisible() override;
95  float xSize() override;
96  float ySize() override;
97  float zSize() override;
98 
99 protected:
100  bool _sizeChanged;
101 
102 private:
103  TeVector3f32 _anchor;
104  CoordinatesType _positionType;
105  TeVector3f32 _userPosition;
106  CoordinatesType _sizeType;
107  TeVector3f32 _userSize;
108  TeMatrix4x4 _worldMatrixCache;
109 
110  DrawMode _drawMode;
111  bool _autoz;
112  bool _positionChanged;
113  bool _worldMatrixChanged;
114  bool _needZSizeUpdate;
115  bool _needZUpdate;
116  bool _updatingZ;
117  bool _updatingZSize;
118  bool _updatingSize;
119  bool _updatingPosition;
120  bool _updatingWorldMatrix;
121  float _ratio;
122  RatioMode _ratioMode;
123  float _safeAreaRatio;
124 
125  TeICallback0ParamPtr _onChildSizeChangedCallback;
126  TeICallback0ParamPtr _onParentSizeChangedCallback;
127  TeICallback0ParamPtr _onParentWorldTransformationMatrixChangedCallback;
128  TeICallback0ParamPtr _onMainWindowChangedCallback;
129 };
130 
131 } // end namespace Tetraedge
132 
133 #endif // TETRAEDGE_TE_TE_LAYOUT_H
Definition: detection.h:27
Definition: te_quaternion.h:32
Definition: te_color.h:30
Definition: te_i_layout.h:29
Definition: te_matrix4x4.h:37
Definition: te_3d_object2.h:36
Definition: te_layout.h:35
Definition: te_vector2s32.h:31
Definition: te_vector3f32.h:33