PGE Engine
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
lvl_section.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_SECTION_H
20 #define LVL_SECTION_H
21 
23 #include <common_features/RTree/RTree.h>
24 #include <common_features/rectf.h>
25 
26 #include "lvl_backgrnd.h"
27 
28 
29 typedef QVector<PGE_Phys_Object* > R_itemList;
30 
31 class PGE_Phys_Object;
32 class PGE_LevelCamera;
33 
35 {
36  friend class PGE_Phys_Object;
37  friend class PGE_LevelCamera;
38 public:
39  LVL_Section();
40  LVL_Section(const LVL_Section& _sct);
41  ~LVL_Section();
42  void setData(LevelSection _d);
43  LevelSection data;
44  void registerElement(PGE_Phys_Object* item);
45  void unregisterElement(PGE_Phys_Object* item);
46  void queryItems(PGE_RectF zone, R_itemList* resultList);
47  void queryItems(double x, double y, R_itemList* resultList);
48 
49  void changeSectionBorders(long left, long top, long right, long bottom);
50  void changeLimitBorders(long left, long top, long right, long bottom);
51  void resetLimits();
52 
53  void initBG();
54  void setMusicRoot(QString _path);
55  int getBgId();
56 
57  void playMusic();
58  void resetMusic();
59  void setMusic(int musID);
60  void setMusic(QString musFile);
61 
62  void renderBG(float x, float y, float w, float h);
63 
64  void setBG(int bgID);
65  void resetBG();
66 
67  bool isAutoscroll;
68  float _autoscrollVelocityX;
69  float _autoscrollVelocityY;
70 
71  PGE_RectF sectionRect();
72  PGE_RectF sectionLimitBox();
73 
74  bool isWrapH();
75  bool isWrapV();
76  bool RightOnly();
77  bool ExitOffscreen();
78 
79  int getPhysicalEnvironment();
80 
81 private:
82  typedef double RPoint[2];
84  IndexTree tree;
85 
86  QString music_root;
87  int curMus;
88  QString curCustomMus;
89  int curBgID;
90  LVL_Background _background;
91 
92  bool isInit;
93 
95  PGE_RectF limitBox;
96 
98  PGE_RectF sectionBox;
99 };
100 
101 #endif // LVL_SECTION_H
Definition: lvl_camera.h:36
Level specific Section entry structure. Defines prererences of one section.
Definition: lvl_filedata.h:33
int h()
Height.
Definition: lvl_camera.cpp:88
Contains data structure definitions for a level file data.
Definition: lvl_section.h:34
int w()
Width.
Definition: lvl_camera.cpp:83
Definition: rectf.h:26
Definition: lvl_backgrnd.h:39
The PGE_Phys_Object class.
Definition: lvl_base_object.h:51