Beispiel #1
0
/* 
 * Hook for setting window state variables on window resize and maximize
 * events. Since there is no fullscreen window event, that setter is called 
 * from the CVideo function instead.
 */
void prefs_event_handler::handle_event(const SDL_Event& event)
{
#if SDL_VERSION_ATLEAST(2, 0, 0)
	// Saftey check to make sure this is a window event
	if (event.type != SDL_WINDOWEVENT) return;

	switch(event.window.event) {
	case SDL_WINDOWEVENT_RESIZED:
		_set_resolution(std::make_pair(event.window.data1,event.window.data2));

		break;

	case SDL_WINDOWEVENT_MAXIMIZED:
		_set_maximized(true);

		break;

	case SDL_WINDOWEVENT_RESTORED:
		_set_maximized(false);

		break;
	}
#else
	UNUSED(event);
#endif
}
Beispiel #2
0
/*
 * Hook for setting window state variables on window resize and maximize
 * events. Since there is no fullscreen window event, that setter is called
 * from the CVideo function instead.
 */
void prefs_event_handler::handle_window_event(const SDL_Event& event)
{

	// Saftey check to make sure this is a window event
	if (event.type != SDL_WINDOWEVENT) return;

	switch(event.window.event) {
	case SDL_WINDOWEVENT_RESIZED:
		_set_resolution(std::make_pair(event.window.data1,event.window.data2));

		break;

	case SDL_WINDOWEVENT_MAXIMIZED:
		_set_maximized(true);

		break;

	case SDL_WINDOWEVENT_RESTORED:
		_set_maximized(fullscreen() || false);

		break;
	}
}