PGE Engine
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
pge_msgbox.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 PGE_MSGBOX_H
20 #define PGE_MSGBOX_H
21 
22 #include "pge_boxbase.h"
23 #include "../scenes/scene.h"
24 
25 #include <graphics/gl_renderer.h>
26 #include <graphics/gl_color.h>
27 #include <common_features/rect.h>
28 #include <common_features/point.h>
29 #include <common_features/pointf.h>
30 #include <common_features/size.h>
31 #include <common_features/sizef.h>
32 
33 #include <controls/control_keys.h>
34 
35 #include <QColor>
36 #include <QString>
37 
38 class PGE_MsgBox : public PGE_BoxBase
39 {
40 public:
41  PGE_MsgBox();
42  PGE_MsgBox(Scene * _parentScene=NULL, QString msg="Message box is works!",
43  msgType _type=msg_info, PGE_Point boxCenterPos=PGE_Point(-1,-1), float _padding=-1, QString texture="");
44  PGE_MsgBox(const PGE_MsgBox &mb);
45  ~PGE_MsgBox();
46 
47  void setBoxSize(float _Width, float _Height, float _padding);
48  void update(float ticks);
49  void render();
50  void restart();
51  bool isRunning();
52  void exec();
53 
54  void processLoader(float ticks);
55  void processBox(float);
56  void processUnLoader(float ticks);
57 
58  static void info(QString msg);
59  //static void info(std::string msg);
60  static void warn(QString msg);
61  //static void warn(std::string msg);
62  static void error(QString msg);
63  //static void error(std::string msg);
64  static void fatal(QString msg);
65  //static void fatal(std::string msg);
66 
67 private:
68  void construct(QString msg="Message box is works!",
69  msgType _type=msg_info, PGE_Point pos=PGE_Point(-1,-1), float _padding=-1, QString texture="");
70  int _page;
71  bool running;
72  int fontID;
73  GlColor fontRgba;
74 
75  controller_keys keys;
76  bool _exit_key_lock; //Don't close message box if exiting key already holden (for example, 'Run' key)
77 
78  msgType type;
79  PGE_Rect _sizeRect;
80  QString message;
81  float width;
82  float height;
83  float padding;
84  QColor bg_color;
85  void updateControllers();
86 };
87 
88 #endif // PGE_MSGBOX_H
Control key map structure. Contains a "is pressed" states of all available control keys...
Definition: control_keys.h:25
Definition: rect.h:26
Definition: pge_msgbox.h:38
The PGE_BoxBase class.
Definition: pge_boxbase.h:16
Definition: scene.h:36
Definition: point.h:23
Definition: gl_color.h:7