zenilib: zenilib/jni/external/zenilib/zeni_rest/Zeni/Console_State.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
Console_State.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(CONSOLE_STATE_H)
31 #define CONSOLE_STATE_H
32
33 #include <Zeni/Gamestate.h>
34 #include <Zeni/Widget.h>
35
36 namespace Zeni {
37
38 class ZENI_REST_DLL Console_State;
39
40 struct ZENI_REST_DLL Console_Function {
41 virtual ~Console_Function() {}
42
43 virtual void operator()(Console_State &console,
44 const String &name,
45 const std::vector<String> &args);
46 };
47
48 class ZENI_REST_DLL Console_State : public Gamestate_Base {
49 Console_State(const Console_State &);
50 Console_State & operator=(const Console_State &);
51
52 friend class ZENI_REST_DLL Game;
53
54 private:
55 Console_State();
56 ~Console_State();
57
58 Gamestate & get_child();
59 void set_child(Gamestate child);
60 void clear_child();
61
62 public:
63 void write_to_log(const String &text);
64 void clear_log();
65
66 void give_function(const String &name, Console_Function * const &function);
67
68 private:
69 void fire_command(const String &text);
70
71 void on_event(const SDL_Event &event);
72
73 void on_key(const SDL_KeyboardEvent &event);
74 void on_mouse_button(const SDL_MouseButtonEvent &event);
75 void on_mouse_motion(const SDL_MouseMotionEvent &event);
76
77 void perform_logic();
78 void prerender();
79 void render();
80
81 #ifdef _WINDOWS
82 #pragma warning( push )
83 #pragma warning( disable : 4251 )
84 #endif
85 std::pair<Point2f, Point2f> m_virtual_screen;
86 #ifdef _WINDOWS
87 #pragma warning( pop )
88 #endif
89 Projector2D m_projector;
90
91 #ifdef _WINDOWS
92 #pragma warning( push )
93 #pragma warning( disable : 4251 )
94 #endif
95 Quadrilateral<Vertex2f_Color> m_bg;
96 #ifdef _WINDOWS
97 #pragma warning( pop )
98 #endif
99 Text_Box m_log;
100 Text_Box m_prompt;
101
102 #ifdef _WINDOWS
103 #pragma warning( push )
104 #pragma warning( disable : 4251 )
105 #endif
106 std::map<String, Console_Function *> m_functions;
107 #ifdef _WINDOWS
108 #pragma warning( pop )
109 #endif
110 String m_text;
111 bool m_log_dirty;
112
113 Gamestate * m_child;
114 bool m_handled_event;
115 };
116
117 }
118
119 #endif
Widget.h
Zeni::render
static void render(const Vertex_Buffer_Macrorenderer &macrorenderer, std::vector< Vertex_Buffer::Vertex_Buffer_Range * > &descriptors)
Definition: Vertex_Buffer.cpp:581
Zeni::Console_Function
Definition: Console_State.h:40
name
EGLImageKHR EGLint * name
Definition: eglext.h:284
Zeni::Quadrilateral
An Abstraction of a Quadrilateral.
Definition: Quadrilateral.h:37
Zeni::Game
The Gamestate Stack.
Definition: Game.h:71
Zeni::String
Definition: String.h:29
Zeni::Text_Box
A Text_Box.
Definition: Widget.h:816
SDL_KeyboardEvent
Keyboard button event structure (event.key.*)
Definition: SDL_events.h:176
Zeni::Gamestate
A smartpointer for a Gamestate_Base.
Definition: Gamestate.h:169
Zeni::Projector2D
The 2D Projector.
Definition: Projector.h:86
SDL_MouseMotionEvent
Mouse motion event structure (event.motion.*)
Definition: SDL_events.h:218
SDL_MouseButtonEvent
Mouse button event structure (event.button.*)
Definition: SDL_events.h:234
Zeni::Gamestate_Base
The base class for all gamestates.
Definition: Gamestate.h:82
Gamestate.h
SDL_Event
General event structure.
Definition: SDL_events.h:495
Zeni::Console_State
Provide a text console to process commands.
Definition: Console_State.h:48
Zeni::Console_Function::~Console_Function
virtual ~Console_Function()
Definition: Console_State.h:41
event
cl_event event
Definition: glew.h:3556