PGE Engine
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
lvl_camera.h
1 /*
2  * Platformer Game Engine by Wohlstand, a free platform for game making
3  * Copyright (c) 2015 Vitaly Novichkov <admin@wohlnet.ru>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef LVL_CAMERA_H
20 #define LVL_CAMERA_H
21 
22 #include "lvl_base_object.h"
23 #include <graphics/graphics.h>
24 #include <common_features/fader.h>
25 #include <common_features/rectf.h>
26 
27 #include <QList>
29 
30 class PGE_Phys_Object;
31 typedef QVector<PGE_Phys_Object *> PGE_RenderList;
32 
33 class LVL_Background;
34 class LVL_Section;
35 
37 {
38  friend class LVL_Background;
39  friend class LVL_Section;
40 public:
41  static const float _smbxTickTime;
43  PGE_LevelCamera(const PGE_LevelCamera &cam);
44  ~PGE_LevelCamera();
45  int w();
46  int h();
47  qreal posX();
48  qreal posY();
49 
50  void init(float x, float y, float w, float h);
51 
52  void setPos(float x, float y);
53  void setCenterPos(float x, float y);
54  void setSize(int w, int h);
55  void setOffset(int x, int y);
56  void update(float ticks);
57  void drawBackground();
58  void drawForeground();
59 
60  void changeSection(LVL_Section *sct, bool isInit=false);
61  void changeSectionBorders(long left, long top, long right, long bottom);
62  void resetLimits();
63 
64  PGE_RenderList &renderObjects();
65 
66  LevelSection* section;
67  LVL_Section * cur_section;
68 
69  PGE_RectF posRect;
70 
71  float offset_x;
72  float offset_y;
73 
74  /**************Fader**************/
75  PGE_Fader fader;
76  /**************Fader**************/
77 
78  /**************Autoscrool**************/
79  void resetAutoscroll();
80  void processAutoscroll(float tickTime);
81  bool isAutoscroll;
82  float _autoscrollVelocityX_max;
83  float _autoscrollVelocityY_max;
84  float _autoscrollVelocityX;
85  float _autoscrollVelocityY;
86  PGE_RectF limitBox;
87  /**************Autoscrool**************/
88 private:
89  void _applyLimits();
90  void sortElements();
91  PGE_RenderList objects_to_render;
92 };
93 
94 #endif // LVL_CAMERA_H
Definition: lvl_camera.h:36
Definition: fader.h:22
Level specific Section entry structure. Defines prererences of one section.
Definition: lvl_filedata.h:33
qreal posX()
Position X.
Definition: lvl_camera.cpp:93
int h()
Height.
Definition: lvl_camera.cpp:88
Definition: lvl_section.h:34
int w()
Width.
Definition: lvl_camera.cpp:83
Definition: rectf.h:26
PGE File Library.
Definition: lvl_backgrnd.h:39
qreal posY()
Position Y.
Definition: lvl_camera.cpp:98
The PGE_Phys_Object class.
Definition: lvl_base_object.h:51