PGE Engine
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
pge_textinputbox.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_TextInputBox_H
20 #define PGE_TextInputBox_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 
39 {
40 public:
42  PGE_TextInputBox(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="");
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 tickTime);
56  void processUnLoader(float ticks);
57 
58  void setInputText(QString text);
59  QString inputText();
60 
61  static void info(QString msg);
62  //static void info(std::string msg);
63  static void warn(QString msg);
64  //static void warn(std::string msg);
65  static void error(QString msg);
66  //static void error(std::string msg);
67  static void fatal(QString msg);
68  //static void fatal(std::string msg);
69 
70 private:
71  void construct(QString msg="Message box is works!",
72  msgType _type=msg_info, PGE_Point pos=PGE_Point(-1,-1), float _padding=-1, QString texture="");
73  int _page;
74  bool running;
75  int fontID;
76  GlColor fontRgba;
77 
78  QString _inputText_src;
79  QString _inputText;
80  QString _inputText_printable;
81  Sint32 cursor;
82  Sint32 selection_len;
83  int _text_input_h_offset;
84 
85  bool blink_shown;
86  float blink_timeout;
87 
88  controller_keys keys;
89 
90  msgType type;
91  PGE_Rect _sizeRect;
92  QString message;
93  float width;
94  float height;
95  float padding;
96  QColor bg_color;
97  void updateControllers();
98 };
99 
100 #endif // PGE_TextInputBox_H
Control key map structure. Contains a "is pressed" states of all available control keys...
Definition: control_keys.h:25
Definition: rect.h:26
The PGE_BoxBase class.
Definition: pge_boxbase.h:16
Definition: scene.h:36
Definition: point.h:23
Definition: pge_textinputbox.h:38
Definition: gl_color.h:7