Qubet  1.0
The ultimate QGL addicting videogame!
 All Classes Functions Variables Pages
leveleditor.h
1 // Qubet - Copyright (C) 2011
2 // Enrico Bacis
3 // Daniele Ciriello
4 
5 // Qubet 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 // (at your option) 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 LEVELEDITOR_H
20 #define LEVELEDITOR_H
21 
22 #include "level.h"
23 #include "cubestringlist.h"
24 #include "actionlist.h"
31 class LevelEditor : public QObject
32 {
33  Q_OBJECT
34 
35 public:
36 
47  explicit LevelEditor(QMap<GLint,GLuint> &_iconsList, Alphabet *_alphabet, QObject *_parent, Level *_level = NULL, bool _audioEnabled = true, Skin *_asphaltSkin = NULL);
48 
52  ~LevelEditor();
53 
60  void draw(GLboolean simplifyForPicking = false);
61 
65  GLvoid playAudio();
66 
67 private:
68 
70  QMap<GLint,GLuint> iconsList;
71  GLboolean audioEnabled;
72  GLboolean isMoving;
74  GLint currentView;
75  GLuint currentLength;
76  GLuint currentWidth;
77  GLuint currentGravity;
81  GLfloat cameraAngle;
102  GLboolean visible;
103  GLint visibleTime;
104  QString currentName;
105  QString currentError;
109  QList<Vector3f> toolbarObstacleCentres;
110  GLint movingObject;
112  GLint xCell;
113  GLint yCell;
114  GLint zCell;
115  GLint lastMouseX;
116  GLint lastMouseY;
121  GLvoid lengthen();
122 
126  GLvoid shorten();
127 
131  GLvoid enlarge();
132 
136  GLvoid reduce();
137 
141  GLvoid gravityMinus();
142 
146  GLvoid gravityPlus();
147 
151  GLvoid buttonBackTriggered();
152 
156  GLvoid buttonNextTriggered();
157 
163  GLvoid letterTyped(int key);
164 
171  GLvoid checkMousePosition(GLint x, GLint y);
172 
176  GLvoid moveIn();
177 
181  GLvoid moveOut();
182 
186  GLvoid saveLevel();
187 
191  GLvoid quitEditor();
192 
193 private slots:
194 
201  void itemClicked(QMouseEvent *event, QList<GLuint> listNames);
202 
208  void mouseReleased(QMouseEvent *event);
209 
216  void mouseMoved(QMouseEvent *event, QList<GLuint> listNames);
217 
223  void wheelScrolled(QWheelEvent *event);
224 
230  void keyPressed(QKeyEvent *event);
231 
232 
233 signals:
234 
238  void levelEditorClosed();
239 
245  void addLevelToLevelsList(Level *_level);
246 
258  void setMouseMovementTracking(int mode);
259 
265  void enableAudio(bool enabled);
266 
272  void playAmbientMusic(QString filename);
273 
277  void stopAmbientMusic();
278 
284  void playEffect(QString effectName);
285 
291  void setSkybox(QString skyboxName);
292 
293 };
294 
295 #endif // LEVELEDITOR_H
void itemClicked(QMouseEvent *event, QList< GLuint > listNames)
Slot invoked when the user clicks on a item.
Definition: leveleditor.cpp:811
void setMouseMovementTracking(int mode)
This signal is emitted to set the Qubet's Mouse Move Tracking sensibility. The modes are: 0 - no sign...
Skin * asphaltSkin
Definition: leveleditor.h:84
GLvoid moveOut()
Move the view out.
Definition: leveleditor.cpp:786
Vector3f * levelOffset
Definition: leveleditor.h:82
GLint visibleTime
Definition: leveleditor.h:103
void levelEditorClosed()
signal emitted when the level editor is being closed.
This class is used to draw a vertical list of CubeString. Look at CubeString to have a better specifi...
Definition: cubestringlist.h:31
CubeString * next
Definition: leveleditor.h:96
GLint yCell
Definition: leveleditor.h:113
CubeString * lengthString
Definition: leveleditor.h:89
CubeString * cancel
Definition: leveleditor.h:98
Skin * volumeSkin
Definition: leveleditor.h:83
CubeString * gravityString
Definition: leveleditor.h:91
GLint xCell
Definition: leveleditor.h:112
GLuint currentLength
Definition: leveleditor.h:75
~LevelEditor()
This is the LevelEditor Destructor.
Definition: leveleditor.cpp:105
Vector3f lastCentre
Definition: leveleditor.h:106
CubeString * widthLabel
Definition: leveleditor.h:87
CubeString * create
Definition: leveleditor.h:92
GLvoid letterTyped(int key)
This function is invoked when a letter is typed.
Definition: leveleditor.cpp:695
GLvoid buttonBackTriggered()
This function is invoked when back button is pressed.
Definition: leveleditor.cpp:626
CubeString * save
Definition: leveleditor.h:97
GLvoid buttonNextTriggered()
This function is invoked when next button is pressed.
Definition: leveleditor.cpp:645
This class is used to keep track of actions to do. For example it can keep track of current view scro...
Definition: actionlist.h:50
GLint lastMouseY
Definition: leveleditor.h:116
GLvoid reduce()
This function reduce the level.
Definition: leveleditor.cpp:593
QString currentError
Definition: leveleditor.h:105
ActionList * currentActions
Definition: leveleditor.h:79
void playEffect(QString effectName)
Signal emitted to play an effect.
Vector3f deltaFromCentre
Definition: leveleditor.h:108
QMap< GLint, GLuint > iconsList
Definition: leveleditor.h:70
void mouseReleased(QMouseEvent *event)
Slot invoked when the user releases the mouse button.
Definition: leveleditor.cpp:920
CubeString * widthString
Definition: leveleditor.h:90
This class is used to draw, a string composed the horizontal justapposition of Different cubes on whi...
Definition: cubestring.h:37
It is the Skin Class.
Definition: skin.h:30
void draw(GLboolean simplifyForPicking=false)
Method to draw the levelEditor.
Definition: leveleditor.cpp:159
GLvoid quitEditor()
This function quit the level editor.
Definition: leveleditor.cpp:803
GLvoid gravityMinus()
This function decraese the gravity value.
Definition: leveleditor.cpp:604
GLuint currentGravity
Definition: leveleditor.h:77
GLvoid enlarge()
This function enlarge the level.
Definition: leveleditor.cpp:582
GLfloat angleRotVolumeCube
Definition: leveleditor.h:85
void stopAmbientMusic()
Signal emitted to stop the current ambient music.
bool positionValid
Definition: leveleditor.h:111
This the LevelEditor Class.
Definition: leveleditor.h:31
QString currentName
Definition: leveleditor.h:104
Vector3f currentDelta
Definition: leveleditor.h:107
GLint lastMouseX
Definition: leveleditor.h:115
GLboolean audioEnabled
Definition: leveleditor.h:71
Structure that rapresents a Vector of float in a 3-D space.
Definition: vector3f.h:31
CubeString * exit
Definition: leveleditor.h:100
void setSkybox(QString skyboxName)
Signal emitted to set the Skybox.
GLint movingObject
Definition: leveleditor.h:110
Alphabet * alphabet
Definition: leveleditor.h:78
QObject * parent
Definition: leveleditor.h:69
CubeString * gravityLabel
Definition: leveleditor.h:88
CubeStringList * formSetLevelName
Definition: leveleditor.h:101
LevelEditor(QMap< GLint, GLuint > &_iconsList, Alphabet *_alphabet, QObject *_parent, Level *_level=NULL, bool _audioEnabled=true, Skin *_asphaltSkin=NULL)
Create a LevelEditor.
Definition: leveleditor.cpp:24
void keyPressed(QKeyEvent *event)
Slot invoked when the user presses a key on the keyboard.
Definition: leveleditor.cpp:1012
void enableAudio(bool enabled)
Signal emitted to enable or disable the audio.
GLvoid gravityPlus()
This function increase the gravity value.
Definition: leveleditor.cpp:615
Level * level
Definition: leveleditor.h:73
void wheelScrolled(QWheelEvent *event)
Slot invoked when the user scrolls the wheel of the mouse button.
Definition: leveleditor.cpp:999
Vector3f * cameraOffset
Definition: leveleditor.h:80
This class rapresents a Level of Qubet, with its obstacle. It is able to draw itself simply using the...
Definition: level.h:33
void mouseMoved(QMouseEvent *event, QList< GLuint > listNames)
Slot invoked when the user moves the mouse.
Definition: leveleditor.cpp:943
GLvoid lengthen()
This function lengthen the level.
Definition: leveleditor.cpp:560
CubeString * clear
Definition: leveleditor.h:99
QList< Vector3f > toolbarObstacleCentres
Definition: leveleditor.h:109
GLvoid shorten()
This function shorten the level.
Definition: leveleditor.cpp:571
CubeString * menu
Definition: leveleditor.h:95
CubeString * back
Definition: leveleditor.h:94
void addLevelToLevelsList(Level *_level)
This function add the current level to the levelsList.
CubeString * lengthLabel
Definition: leveleditor.h:86
This class is used to keep a list of Letter (from this the name Alphabet) It provide access to Letter...
Definition: alphabet.h:33
GLvoid saveLevel()
Save the Level.
Definition: leveleditor.cpp:792
GLboolean isMoving
Definition: leveleditor.h:72
GLvoid checkMousePosition(GLint x, GLint y)
This function check the position of the mouse.
Definition: leveleditor.cpp:730
CubeString * labelSetLevelName
Definition: leveleditor.h:93
GLvoid moveIn()
Move the view in.
Definition: leveleditor.cpp:780
GLint zCell
Definition: leveleditor.h:114
GLboolean visible
Definition: leveleditor.h:102
GLvoid playAudio()
launch the signal playAmbientMusic.
GLuint currentWidth
Definition: leveleditor.h:76
void playAmbientMusic(QString filename)
Signal emitted to play the ambient music.
GLfloat cameraAngle
Definition: leveleditor.h:81
GLint currentView
Definition: leveleditor.h:74