25 #if defined(_DEBUG) && defined(_WINDOWS)
26 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
38 #if !SDL_VERSION_ATLEAST(2,0,0)
54 #if SDL_VERSION_ATLEAST(1,3,0)
56 on_mouse_wheel(event.
wheel);
74 #if SDL_VERSION_ATLEAST(1,3,0)
76 on_window_event(event.
window);
82 #if !SDL_VERSION_ATLEAST(2,0,0)
110 #if SDL_VERSION_ATLEAST(1,3,0)
130 #if SDL_VERSION_ATLEAST(2,0,0)
144 if(!(event.state & SDL_APPINPUTFOCUS))
147 const bool gain =
event.gain != 0;
169 #if !SDL_VERSION_ATLEAST(2,0,0)
176 #if !SDL_VERSION_ATLEAST(1,3,0)
189 if(mod_caps ^ mod_shift)
252 #if SDL_VERSION_ATLEAST(2,0,0)
264 case SDLK_KP0:
return '0';
265 case SDLK_KP1:
return '1';
266 case SDLK_KP2:
return '2';
267 case SDLK_KP3:
return '3';
268 case SDLK_KP4:
return '4';
269 case SDLK_KP5:
return '5';
270 case SDLK_KP6:
return '6';
271 case SDLK_KP7:
return '7';
272 case SDLK_KP8:
return '8';
273 case SDLK_KP9:
return '9';
294 #if SDL_VERSION_ATLEAST(1,3,0)
299 case SDLK_QUOTE:
return mod_shift ?
'"' :
'\'';
304 case SDLK_COMMA:
return mod_shift ?
'<' :
',';
305 case SDLK_MINUS:
return mod_shift ?
'_' :
'-';
307 case SDLK_SLASH:
return mod_shift ?
'?' :
'/';
308 case SDLK_0:
return mod_shift ?
')' :
'0';
309 case SDLK_1:
return mod_shift ?
'!' :
'1';
310 case SDLK_2:
return mod_shift ?
'@' :
'2';
311 case SDLK_3:
return mod_shift ?
'#' :
'3';
312 case SDLK_4:
return mod_shift ?
'$' :
'4';
313 case SDLK_5:
return mod_shift ?
'%' :
'5';
314 case SDLK_6:
return mod_shift ?
'^' :
'6';
315 case SDLK_7:
return mod_shift ?
'&' :
'7';
316 case SDLK_8:
return mod_shift ?
'*' :
'8';
317 case SDLK_9:
return mod_shift ?
'(' :
'9';
340 #define SC(name) if(text_version == #name) return name;
342 #if SDL_VERSION_ATLEAST(1,3,0)
345 #define SC10(a, b) SC(a)
349 #define SC10(a, b) SC(b)
438 #if SDL_VERSION_ATLEAST(2,0,0)
718 #define SC(name) case name: return #name;
720 #if SDL_VERSION_ATLEAST(1,3,0)
723 #define SC10(a, b) SC(a)
727 #define SC10(a, b) SC(b)
816 #if SDL_VERSION_ATLEAST(2,0,0)
1088 default:
return "SDLK_UNKNOWN";
1094 static Logo logo(
Point2f(1.5
f, 0.5
f), 1.0
f,
Color(1.0
f, 0.875
f, 0.875
f, 0.875
f),
Color(1.0
f, 0.125
f, 0.125
f, 0.175
f));
1115 m_state->decrement();
SDL_MouseMotionEvent motion
Mouse_State get_mouse_state() const
Find out if the mouse cursor is grabbed/hidden/relative.
virtual void on_controller_axis(const SDL_ControllerAxisEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Controllers & get_Controllers()
Get access to the singleton.
SDL_ControllerAxisEvent caxis
The "quit requested" event.
Controller device event structure (event.cdevice.*)
virtual void render()
Then render. Called by Game as part of the main gameloop.
virtual void on_video_expose(const SDL_ExposeEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
SDL_ControllerDeviceEvent cdevice
virtual void on_quit(const SDL_QuitEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
static void change_resolution(const Point2i &resolution)
static String to_text(const SDL_Keycode &sym)
Convert a sym to a text representation.
static SDL_Keycode to_sym(const String &text_version)
Convert a text representation to an actual sym.
bool get_key_state(const int &key) const
Get the state of a key.
virtual void on_pop()
Called when the Gamestate is popped off the stack in Game.
void enable(const bool &enable_)
Temporarily turn controller input on/off.
void set_mouse_state(const Mouse_State &mouse_state)
The SDL keysym structure, used in key events.
Game controller axis motion event structure (event.caxis.*)
virtual void on_system_wm_event(const SDL_SysWMEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
Sint32 SDL_Keycode
The SDL virtual key representation.
SDL_MouseWheelEvent wheel
Game & get_Game()
Get access to the singleton.
static char to_char(const SDL_Keysym &ks)
Returns a character key corresponding to the current combination of keys pressed or the null characte...
virtual void on_key(const SDL_KeyboardEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
virtual void on_controller_device(const SDL_ControllerDeviceEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
void push_Popup_Pause_State()
A user-defined event type (event.user.*)
Keyboard button event structure (event.key.*)
virtual void on_controller_button(const SDL_ControllerButtonEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
void set_2d()
Set the default 2D view filling the entire display area.
virtual void on_mouse_motion(const SDL_MouseMotionEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
virtual void on_event(const SDL_Event &event)
First check for events. Called by Game as part of the main gameloop.
virtual void on_uncover()
Called when a Gamestate is popped off Game, making this Gamestate on top.
static void save(const bool &backup=true)
Save options.
Mouse wheel event structure (event.wheel.*)
Window state change event data (event.window.*)
Window & get_Window()
Get access to the singleton.
Mouse motion event structure (event.motion.*)
SDL_ControllerButtonEvent cbutton
A video driver dependent system event (event.syswm.*) This event is disabled by default, you can enable it with SDL_EventState()
virtual void on_active(const SDL_ActiveEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
virtual void on_user_event(const SDL_UserEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
SDL_MouseButtonEvent button
virtual void on_push()
Called when the Gamestate is pushed onto the stack in Game.
Video & get_Video()
Get access to the singleton.
virtual void on_mouse_button(const SDL_MouseButtonEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
virtual void on_cover()
Called when a Gamestate is pushed on top of this Gamestate in Game.
virtual void on_video_resize(const SDL_ResizeEvent &event)
Override this input callback in your Gamestates. See SDL documentation for details.
A 2D Point represented with floats.
The Window Management Singleton.
void push_Popup_Menu_State()
A 2D Point represented with integers.