zenilib: zenilib/jni/external/zenilib/zeni_rest/Zeni/Configurator_Video.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Configurator_Video.h
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2 * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3 *
4 * zenilib is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * zenilib is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16 */
17
30 #if !defined(ANDROID) && !defined(CONFIGURATOR_VIDEO_H)
31 #define CONFIGURATOR_VIDEO_H
32
33 #include <Zeni/Chronometer.h>
34 #include <Zeni/Widget_Gamestate.h>
35 #include <Zeni/XML.h>
36
37 namespace Zeni {
38
39 class ZENI_REST_DLL Configurator_Video : public Widget_Gamestate {
40 Configurator_Video(const Configurator_Video &);
41 Configurator_Video & operator=(const Configurator_Video &);
42
43 public:
44 class ZENI_REST_DLL Check_State : public Zeni::Widget_Gamestate {
45 Check_State(const Check_State &);
46 Check_State operator=(const Check_State &);
47
48 enum Code {CODE_IGNORE, CODE_SAVE, CODE_REVERT};
49
50 class ZENI_REST_DLL Accept_Button : public Zeni::Text_Button {
51 Accept_Button(const Accept_Button &);
52 Accept_Button operator=(const Accept_Button &);
53
54 public:
55 Accept_Button(Check_State &check_video, const std::pair<Point2f, Point2f> &virtual_screen);
56
57 void on_accept();
58
59 private:
60 Check_State &m_check_video;
61 };
62
63 public:
64 Check_State();
65
66 private:
67 void on_pop();
68
69 void on_key(const SDL_KeyboardEvent &event);
70 #if SDL_VERSION_ATLEAST(2,0,0)
71 void on_window_event(const SDL_WindowEvent &event);
72 #else
73 void on_video_resize(const SDL_ResizeEvent &event);
74 #endif
75
76 void perform_logic();
77
78 Accept_Button m_accept_button;
79 int m_seconds_remaining;
80 Text_Box m_text;
81
82 Time m_start_time;
83
84 Code m_code;
85 };
86
87 private:
88 class ZENI_REST_DLL Check_Box_Element : public Check_Box {
89 Check_Box_Element(const Check_Box_Element &);
90 Check_Box_Element & operator=(const Check_Box_Element &);
91
92 public:
93 Check_Box_Element(const XML_Element &element,
94 const bool &checked,
95 const Point2f &upper_left,
96 const float &height);
97
98 void on_accept();
99
100 void render_impl() const;
101
102 private:
103 XML_Element m_element;
104 };
105
106 class ZENI_REST_DLL Slider_Element : public Slider_Int {
107 Slider_Element(const Slider_Element &);
108 Slider_Element & operator=(const Slider_Element &);
109
110 public:
111 Slider_Element(const XML_Element &element,
112 const int &value,
113 const std::pair<int, int> &range,
114 const Point2f &upper_left,
115 const Point2f &lower_right);
116
117 void on_accept();
118
119 void render_impl() const;
120
121 private:
122 XML_Element m_element;
123 Point2f m_text_coord;
124 };
125
126 class ZENI_REST_DLL Text_Element : public Text_Box {
127 Text_Element(const Text_Element &);
128 Text_Element & operator=(const Text_Element &);
129
130 public:
131 Text_Element(const XML_Element &element,
132 const String &text,
133 const Point2f &upper_left,
134 const Point2f &lower_right);
135
136 void on_change();
137
138 void render_impl() const;
139
140 private:
141 XML_Element m_element;
142 };
143
144 class ZENI_REST_DLL Selector_Element : public Selector {
145 Selector_Element(const Selector_Element &);
146 Selector_Element & operator=(const Selector_Element &);
147
148 public:
149 Selector_Element(const XML_Element &element,
150 const Point2f &upper_left,
151 const Point2f &lower_right,
152 const Point2f &expanded_upper_left,
153 const Point2f &expanded_lower_right);
154
155 void add_entry(const String &option, const String &save_as);
156
157 size_t num_entries() const;
158
159 void on_accept(const String &option);
160
161 private:
162 XML_Element m_element;
163 #ifdef _WINDOWS
164 #pragma warning( push )
165 #pragma warning( disable : 4251 )
166 #endif
167 std::map<String, String> m_save_as;
168 #ifdef _WINDOWS
169 #pragma warning( pop )
170 #endif
171 };
172
173 class ZENI_REST_DLL Resolution_Element : public Selector {
174 Resolution_Element(const Resolution_Element &);
175 Resolution_Element & operator=(const Resolution_Element &);
176
177 public:
178 Resolution_Element(const XML_Element &element,
179 const Point2f &upper_left,
180 const Point2f &lower_right,
181 const Point2f &expanded_upper_left,
182 const Point2f &expanded_lower_right);
183
184 void on_accept(const String &option);
185
186 private:
187 XML_Element m_element;
188 };
189
190 class ZENI_REST_DLL Custom_Resolution_Box : public Check_Box {
191 Custom_Resolution_Box(const Custom_Resolution_Box &);
192 Custom_Resolution_Box & operator=(const Custom_Resolution_Box &);
193
194 public:
195 Custom_Resolution_Box(Configurator_Video &configurator,
196 const bool &checked,
197 const Point2f &upper_left,
198 const float &height);
199
200 void apply();
201
202 void on_accept();
203
204 void render_impl() const;
205
206 private:
207 Configurator_Video &m_configurator;
208 };
209
210 class ZENI_REST_DLL Apply_Button : public Text_Button {
211 Apply_Button(const Apply_Button &);
212 Apply_Button & operator=(const Apply_Button &);
213
214 public:
215 Apply_Button(XML_Document &file,
216 const Point2f &upper_left,
217 const Point2f &lower_right);
218
219 void on_accept();
220
221 private:
222 XML_Document * m_file;
223 };
224
225 class ZENI_REST_DLL Cancel_Button : public Text_Button {
226 Cancel_Button(const Cancel_Button &);
227 Cancel_Button & operator=(const Cancel_Button &);
228
229 public:
230 Cancel_Button(const Point2f &upper_left,
231 const Point2f &lower_right);
232
233 void on_accept();
234 };
235
236 public:
237 Configurator_Video();
238 ~Configurator_Video();
239
240 private:
241 void on_push();
242
243 void on_key(const SDL_KeyboardEvent &event);
244
245 void render();
246
247 XML_Document m_file;
248 XML_Element m_zenilib;
249
250 public:
251 Slider_Element anisotropy;
252 Check_Box_Element bilinear_filtering;
253 Check_Box_Element mipmapping;
254
255 Selector_Element api;
256 Check_Box_Element full_screen;
257 Slider_Element multisampling;
258
259 Resolution_Element resolution;
260 Custom_Resolution_Box custom_resolution;
261 Text_Element custom_width;
262 Text_Element custom_height;
263
264 Check_Box_Element vertical_sync;
265
266 Apply_Button save;
267 Cancel_Button cancel;
268
269 private:
270 String m_prev_title;
271 };
272
273 }
274
275 #endif
Zeni::Configurator_Video::anisotropy
Slider_Element anisotropy
Definition: Configurator_Video.h:251
Zeni::Configurator_Video::bilinear_filtering
Check_Box_Element bilinear_filtering
Definition: Configurator_Video.h:252
Zeni::Check_Box
A Check Box.
Definition: Widget.h:501
Zeni::Widget_Gamestate
Gamestate with some helpers for dealing with Widgets.
Definition: Widget_Gamestate.h:38
Zeni::Configurator_Video::custom_resolution
Custom_Resolution_Box custom_resolution
Definition: Configurator_Video.h:260
Zeni::render
static void render(const Vertex_Buffer_Macrorenderer &macrorenderer, std::vector< Vertex_Buffer::Vertex_Buffer_Range * > &descriptors)
Definition: Vertex_Buffer.cpp:581
Zeni::Configurator_Video::full_screen
Check_Box_Element full_screen
Definition: Configurator_Video.h:256
file
FILE * file
Definition: visualinfo.c:88
height
EGLSurface EGLint EGLint EGLint EGLint height
Definition: eglext.h:293
Zeni::Configurator_Video::multisampling
Slider_Element multisampling
Definition: Configurator_Video.h:257
Zeni::Configurator_Video::Check_State
Definition: Configurator_Video.h:44
Zeni::Configurator_Video
Configure zenilib.xml.
Definition: Configurator_Video.h:39
Zeni::Configurator_Video::custom_height
Text_Element custom_height
Definition: Configurator_Video.h:262
Zeni::String
Definition: String.h:29
Zeni::Slider_Int
Definition: Widget.h:624
Zeni::Text_Box
A Text_Box.
Definition: Widget.h:816
range
GLenum GLint * range
Definition: glew.h:3391
option
GLuint GLenum option
Definition: glew.h:3180
SDL_KeyboardEvent
Keyboard button event structure (event.key.*)
Definition: SDL_events.h:176
XML.h
Zeni::Configurator_Video::vertical_sync
Check_Box_Element vertical_sync
Definition: Configurator_Video.h:264
Zeni::Text_Button
A Text Button Widget.
Definition: Widget.h:492
SDL_WindowEvent
Window state change event data (event.window.*)
Definition: SDL_events.h:160
Zeni::XML_Element
A node in an XML tree, possibly containing useful data.
Definition: XML.h:86
Chronometer.h
value
EGLSurface EGLint void ** value
Definition: eglext.h:301
Zeni::Configurator_Video::api
Selector_Element api
Definition: Configurator_Video.h:255
Zeni::Configurator_Video::cancel
Cancel_Button cancel
Definition: Configurator_Video.h:267
Widget_Gamestate.h
Zeni::Point2f
A 2D Point represented with floats.
Definition: Coordinate.h:98
Zeni::Configurator_Video::custom_width
Text_Element custom_width
Definition: Configurator_Video.h:261
Zeni::Configurator_Video::resolution
Resolution_Element resolution
Definition: Configurator_Video.h:259
Zeni::Configurator_Video::mipmapping
Check_Box_Element mipmapping
Definition: Configurator_Video.h:253
event
cl_event event
Definition: glew.h:3556
Zeni::Time
A Snapshot of the Timer.
Definition: Timer.h:63
Zeni::Configurator_Video::save
Apply_Button save
Definition: Configurator_Video.h:266