# configuring target
# -----------------------------------------------------------------------------
-ifndef TARGET # auto-detect compiling for SDL or SDL2
+ifndef TARGET # auto-detect compiling for SDL2
SDL_VERSION := $(shell sdl2-config --version 2> /dev/null)
ifdef SDL_VERSION
TARGET = sdl2
else
- SDL_VERSION := $(shell sdl-config --version 2> /dev/null)
- ifdef SDL_VERSION
- TARGET = sdl
- else
- $(error SDL/SDL2 library not found)
- endif
+ $(error SDL2 library not found)
endif
endif
# $(info Using SDL version $(SDL_VERSION) [TARGET == $(TARGET)])
ifeq ($(TARGET),sdl) # compiling for SDL target
-SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags)
-SDL_LIBS = -lSDL_image -lSDL_mixer -lSDL_net
-SYS_LDFLAGS = $(SDL_LIBS) $(shell sdl-config --libs)
+ $(error SDL library version 1.2 not supported anymore)
endif
ifeq ($(TARGET),sdl2) # compiling for SDL2 target
checked_free(window_title_string);
-#if defined(TARGET_SDL2)
-
#ifdef DEBUG
window_title_string = checked_malloc(strlen(getProgramInitString()) + 20 +
strlen(getSourceDateString()) + 2 + 1);
else
sprintf(window_title_string, "%s",
getProgramInitString());
-#endif
-
-#else
-
-#ifdef DEBUG
- window_title_string = checked_malloc(strlen(getProgramInitString()) + 1 +
- strlen(getSourceDateString()) + 2 + 1);
-
- sprintf(window_title_string, "%s [%s]",
- getProgramInitString(), getSourceDateString());
-#else
- window_title_string = checked_malloc(strlen(getProgramInitString()) + 1);
-
- sprintf(window_title_string, "%s",
- getProgramInitString());
-#endif
-
#endif
return window_title_string;
{
MotionEvent *motion;
-#if defined(TARGET_SDL2)
// skip repeated key press events if keyboard auto-repeat is disabled
if (event->type == EVENT_KEYPRESS &&
event->key.repeat &&
!keyrepeat_status)
return 0;
-#endif
if (event->type == EVENT_BUTTONPRESS ||
event->type == EVENT_BUTTONRELEASE)
HandleMotionEvent((MotionEvent *) &event);
break;
-#if defined(TARGET_SDL2)
case EVENT_WHEELMOTION:
HandleWheelEvent((WheelEvent *) &event);
break;
case SDL_APP_DIDENTERFOREGROUND:
HandlePauseResumeEvent((PauseResumeEvent *) &event);
break;
-#endif
case EVENT_KEYPRESS:
case EVENT_KEYRELEASE:
HandleClientMessageEvent((ClientMessageEvent *) event);
break;
-#if defined(TARGET_SDL)
-#if defined(TARGET_SDL2)
case SDL_CONTROLLERBUTTONDOWN:
case SDL_CONTROLLERBUTTONUP:
// for any game controller button event, disable overlay buttons
case SDL_CONTROLLERDEVICEADDED:
case SDL_CONTROLLERDEVICEREMOVED:
case SDL_CONTROLLERAXISMOTION:
-#endif
case SDL_JOYAXISMOTION:
case SDL_JOYBUTTONDOWN:
case SDL_JOYBUTTONUP:
case SDL_SYSWMEVENT:
HandleWindowManagerEvent(event);
break;
-#endif
default:
break;
void ClearAutoRepeatKeyEvents(void)
{
-#if defined(TARGET_SDL2)
while (PendingEvent())
{
Event next_event;
else
break;
}
-#endif
}
void ClearEventQueue(void)
ClearPlayerAction();
break;
-#if defined(TARGET_SDL2)
case SDL_CONTROLLERBUTTONUP:
HandleJoystickEvent(&event);
ClearPlayerAction();
break;
-#endif
default:
HandleOtherEvents(&event);
key_joystick_mapping = 0;
break;
-#if defined(TARGET_SDL2)
case SDL_CONTROLLERBUTTONUP:
HandleJoystickEvent(&event);
key_joystick_mapping = 0;
break;
-#endif
case EVENT_MAPNOTIFY:
window_unmapped = FALSE;
HandleButton(event->x, event->y, button_status, button_status);
}
-#if defined(TARGET_SDL2)
-
void HandleWheelEvent(WheelEvent *event)
{
int button_nr;
HandleFingerEvent_WipeGestures(event);
}
-#endif
-
static void HandleButtonOrFinger_WipeGestures_MM(int mx, int my, int button)
{
static int old_mx = 0, old_my = 0;
}
}
-#if defined(TARGET_SDL2)
-
static boolean checkTextInputKeyModState(void)
{
// when playing, only handle raw key events and ignore text input
}
}
-#endif
-
void HandleKeyEvent(KeyEvent *event)
{
int key_status = (event->type == EVENT_KEYPRESS ? KEY_PRESSED : KEY_RELEASED);
HandleKeyModState(keymod, key_status);
-#if defined(TARGET_SDL2)
// only handle raw key input without text modifier keys pressed
if (!checkTextInputKeyModState())
HandleKey(key, key_status);
-#else
- HandleKey(key, key_status);
-#endif
}
void HandleFocusEvent(FocusChangeEvent *event)
void HandleWindowManagerEvent(Event *event)
{
-#if defined(TARGET_SDL)
SDLHandleWindowManagerEvent(event);
-#endif
}
void HandleButton(int mx, int my, int button, int button_nr)
int joy = 0;
int i;
-#if defined(TARGET_SDL2)
// map special keys (media keys / remote control buttons) to default keys
if (key == KSYM_PlayPause)
key = KSYM_space;
else if (key == KSYM_Select)
key = KSYM_Return;
-#endif
HandleSpecialGameControllerKeys(key, key_status);
void HandleSpecialGameControllerButtons(Event *event)
{
-#if defined(TARGET_SDL2)
int key_status;
Key key;
}
HandleKey(key, key_status);
-#endif
}
void HandleSpecialGameControllerKeys(Key key, int key_status)
{
-#if defined(TARGET_SDL2)
#if defined(KSYM_Rewind) && defined(KSYM_FastForward)
int button = SDL_CONTROLLER_BUTTON_INVALID;
HandleJoystickEvent(&event);
}
#endif
-#endif
}
boolean DoKeysymAction(int keysym)
void HandleExposeEvent(ExposeEvent *);
void HandleButtonEvent(ButtonEvent *);
void HandleMotionEvent(MotionEvent *);
-#if defined(TARGET_SDL2)
void HandleWheelEvent(WheelEvent *);
void HandleWindowEvent(WindowEvent *);
void HandleFingerEvent(FingerEvent *);
void HandleTextEvent(TextEvent *);
void HandlePauseResumeEvent(PauseResumeEvent *);
-#endif
void HandleKeysDebug(Key);
void HandleKeyEvent(KeyEvent *);
void HandleFocusEvent(FocusChangeEvent *);
void CreateLevelSketchImages(void)
{
-#if defined(TARGET_SDL)
Bitmap *bitmap1;
Bitmap *bitmap2;
int i;
Error(ERR_INFO, "%d normal and small images created", NUM_FILE_ELEMENTS);
CloseAllAndExit(0);
-#endif
}
void CreateCustomElementImages(char *directory)
{
-#if defined(TARGET_SDL)
char *src_basename = "RocksCE-template.ilbm";
char *dst_basename = "RocksCE.bmp";
char *src_filename = getPath2(directory, src_basename);
FreeBitmap(bitmap);
CloseAllAndExit(0);
-#endif
}
FreeAllImages();
-#if defined(TARGET_SDL)
-#if defined(TARGET_SDL2)
// !!! TODO !!!
// set a flag to tell the network server thread to quit and wait for it
// using SDL_WaitThread()
-#else
- if (network_server) // terminate network server
- SDL_KillThread(server_thread);
-#endif
-#endif
+ //
+ // Code used with SDL 1.2:
+ // if (network_server) // terminate network server
+ // SDL_KillThread(server_thread);
CloseVideoDisplay();
ClosePlatformDependentStuff();
{ KSYM_Meta_R, "XK_Meta_R", "right meta" },
{ KSYM_Alt_L, "XK_Alt_L", "left alt" },
{ KSYM_Alt_R, "XK_Alt_R", "right alt" },
-#if !defined(TARGET_SDL2)
- { KSYM_Super_L, "XK_Super_L", "left super" }, // Win-L
- { KSYM_Super_R, "XK_Super_R", "right super" }, // Win-R
-#endif
{ KSYM_Mode_switch, "XK_Mode_switch", "mode switch" }, // Alt-R
{ KSYM_Multi_key, "XK_Multi_key", "multi key" }, // Ctrl-R
{ KSYM_Page_Up, "XK_Page_Up", "page up" },
{ KSYM_Page_Down, "XK_Page_Down", "page down" },
-#if defined(TARGET_SDL2)
{ KSYM_Select, "XK_Select", "select" },
{ KSYM_Menu, "XK_Menu", "menu" }, // menu key
{ KSYM_Back, "XK_Back", "back" }, // back key
#if defined(PLATFORM_ANDROID)
{ KSYM_Rewind, "XK_Rewind", "rewind" },
{ KSYM_FastForward, "XK_FastForward", "fast forward" },
-#endif
#endif
// ASCII 0x20 to 0x40 keys (except numbers)
{ KSYM_udiaeresis, "XK_udiaeresis", "u umlaut" },
{ KSYM_ssharp, "XK_ssharp", "sharp s" },
-#if defined(TARGET_SDL2)
// special (non-ASCII) keys (UTF-8, for reverse mapping only)
{ KSYM_degree, "XK_degree", "\xc2\xb0" },
{ KSYM_Adiaeresis, "XK_Adiaeresis", "\xc3\x84" },
// other keys (for reverse mapping only)
{ KSYM_space, "XK_space", " " },
-#endif
-#if defined(TARGET_SDL2)
// keypad keys are not in numerical order in SDL2
{ KSYM_KP_0, "XK_KP_0", "keypad 0" },
{ KSYM_KP_1, "XK_KP_1", "keypad 1" },
{ KSYM_KP_7, "XK_KP_7", "keypad 7" },
{ KSYM_KP_8, "XK_KP_8", "keypad 8" },
{ KSYM_KP_9, "XK_KP_9", "keypad 9" },
-#endif
// end-of-array identifier
{ 0, NULL, NULL }
sprintf(name_buffer, "%c", 'a' + (char)(key - KSYM_a));
else if (key >= KSYM_0 && key <= KSYM_9)
sprintf(name_buffer, "%c", '0' + (char)(key - KSYM_0));
-#if !defined(TARGET_SDL2)
- else if (key >= KSYM_KP_0 && key <= KSYM_KP_9)
- sprintf(name_buffer, "keypad %c", '0' + (char)(key - KSYM_KP_0));
-#endif
else if (key >= KSYM_FKEY_FIRST && key <= KSYM_FKEY_LAST)
sprintf(name_buffer, "F%d", (int)(key - KSYM_FKEY_FIRST + 1));
else if (key == KSYM_UNDEFINED)
sprintf(name_buffer, "XK_%c", 'a' + (char)(key - KSYM_a));
else if (key >= KSYM_0 && key <= KSYM_9)
sprintf(name_buffer, "XK_%c", '0' + (char)(key - KSYM_0));
-#if !defined(TARGET_SDL2)
- else if (key >= KSYM_KP_0 && key <= KSYM_KP_9)
- sprintf(name_buffer, "XK_KP_%c", '0' + (char)(key - KSYM_KP_0));
-#endif
else if (key >= KSYM_FKEY_FIRST && key <= KSYM_FKEY_LAST)
sprintf(name_buffer, "XK_F%d", (int)(key - KSYM_FKEY_FIRST + 1));
else if (key == KSYM_UNDEFINED)
else if (c >= '0' && c <= '9')
key = KSYM_0 + (Key)(c - '0');
}
-#if !defined(TARGET_SDL2)
- else if (strPrefix(name_ptr, "XK_KP_") && strlen(name_ptr) == 7)
- {
- char c = name_ptr[6];
-
- if (c >= '0' && c <= '9')
- key = KSYM_KP_0 + (Key)(c - '0');
- }
-#endif
else if (strPrefix(name_ptr, "XK_F") && strlen(name_ptr) <= 6)
{
char c1 = name_ptr[4];
// ============================================================================
// SDL internal variables
-#if defined(TARGET_SDL2)
static SDL_Window *sdl_window = NULL;
static SDL_Renderer *sdl_renderer = NULL;
static SDL_Texture *sdl_texture_stream = NULL;
static SDL_Texture *sdl_texture_target = NULL;
static boolean fullscreen_enabled = FALSE;
-#endif
-
static boolean limit_screen_updates = FALSE;
rect = NULL;
}
-#if defined(TARGET_SDL2)
SDL_Texture *sdl_texture = sdl_texture_stream;
// deactivate use of target texture if render targets are not supported
#if defined(USE_TOUCH_INPUT_OVERLAY)
// draw overlay graphics for touch device input, if needed
DrawTouchInputOverlay();
-#endif
-
#endif
// global synchronization point of the game to align video frame delay
if (with_frame_delay)
WaitUntilDelayReached(&video.frame_delay, video.frame_delay_value);
-#if defined(TARGET_SDL2)
- // show render target buffer on screen
+ // show render target buffer on screen
SDL_RenderPresent(sdl_renderer);
-#else // TARGET_SDL
- if (rect)
- SDL_UpdateRects(screen, 1, rect);
- else
- SDL_UpdateRect(screen, 0, 0, 0, 0);
-#endif
}
static void UpdateScreen_WithFrameDelay(SDL_Rect *rect)
SDL_SetColorKey(surface, SET_TRANSPARENT_PIXEL,
SDL_MapRGB(surface->format, 0x00, 0x00, 0x00));
-#if defined(TARGET_SDL2)
SDL_SetWindowIcon(sdl_window, surface);
-#else
- SDL_WM_SetIcon(surface, NULL);
-#endif
#endif
}
-#if defined(TARGET_SDL2)
-
static boolean equalSDLPixelFormat(SDL_PixelFormat *format1,
SDL_PixelFormat *format2)
{
return TRUE;
}
-#else
-
-static Pixel SDLGetColorKey(SDL_Surface *surface)
-{
- if ((surface->flags & SDL_SRCCOLORKEY) == 0)
- return -1;
-
- return surface->format->colorkey;
-}
-
-static boolean SDLHasColorKey(SDL_Surface *surface)
-{
- return (SDLGetColorKey(surface) != -1);
-}
-
-static boolean SDLHasAlpha(SDL_Surface *surface)
-{
- return ((surface->flags & SDL_SRCALPHA) != 0);
-}
-
-static void SDLSetAlpha(SDL_Surface *surface, boolean set, int alpha)
-{
- SDL_SetAlpha(surface, (set ? SDL_SRCALPHA : 0), alpha);
-}
-
-SDL_Surface *SDLGetNativeSurface(SDL_Surface *surface)
-{
- SDL_Surface *new_surface;
-
- if (surface == NULL)
- return NULL;
-
- if (!video.initialized)
- new_surface = SDL_ConvertSurface(surface, surface->format, SURFACE_FLAGS);
- else if (SDLHasAlpha(surface))
- new_surface = SDL_DisplayFormatAlpha(surface);
- else
- new_surface = SDL_DisplayFormat(surface);
-
- if (new_surface == NULL)
- Error(ERR_EXIT, "%s() failed: %s",
- (video.initialized ? "SDL_DisplayFormat" : "SDL_ConvertSurface"),
- SDL_GetError());
-
- return new_surface;
-}
-
-boolean SDLSetNativeSurface(SDL_Surface **surface)
-{
- SDL_Surface *new_surface;
-
- if (surface == NULL ||
- *surface == NULL ||
- !video.initialized)
- return FALSE;
-
- new_surface = SDLGetNativeSurface(*surface);
-
- SDL_FreeSurface(*surface);
-
- *surface = new_surface;
-
- return TRUE;
-}
-
-#endif
-
-#if defined(TARGET_SDL2)
static SDL_Texture *SDLCreateTextureFromSurface(SDL_Surface *surface)
{
if (program.headless)
return texture;
}
-#endif
void SDLCreateBitmapTextures(Bitmap *bitmap)
{
-#if defined(TARGET_SDL2)
if (bitmap == NULL)
return;
bitmap->texture = SDLCreateTextureFromSurface(bitmap->surface);
bitmap->texture_masked = SDLCreateTextureFromSurface(bitmap->surface_masked);
-#endif
}
void SDLFreeBitmapTextures(Bitmap *bitmap)
{
-#if defined(TARGET_SDL2)
if (bitmap == NULL)
return;
bitmap->texture = NULL;
bitmap->texture_masked = NULL;
-#endif
}
void SDLInitVideoDisplay(void)
{
-#if !defined(TARGET_SDL2)
- if (!strEqual(setup.system.sdl_videodriver, ARG_DEFAULT))
- SDL_putenv(getStringCat2("SDL_VIDEODRIVER=", setup.system.sdl_videodriver));
-
- SDL_putenv("SDL_VIDEO_CENTERED=1");
-#endif
-
// initialize SDL video
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
Error(ERR_EXIT, "SDL_InitSubSystem() failed: %s", SDL_GetError());
// set default SDL depth
-#if !defined(TARGET_SDL2)
- video.default_depth = SDL_GetVideoInfo()->vfmt->BitsPerPixel;
-#else
video.default_depth = 32; // (how to determine video depth in SDL2?)
-#endif
+ //
+ // Code used with SDL 1.2:
+ // video.default_depth = SDL_GetVideoInfo()->vfmt->BitsPerPixel;
}
static void SDLInitVideoBuffer_VideoBuffer(boolean fullscreen)
SDLSetScreenRenderingMode(setup.screen_rendering_mode);
-#if defined(TARGET_SDL2)
// SDL 2.0: support for (desktop) fullscreen mode available
video.fullscreen_available = TRUE;
-#else
- // SDL 1.2: no support for fullscreen mode in R'n'D anymore
- video.fullscreen_available = FALSE;
-#endif
// open SDL video output device (window or fullscreen mode)
if (!SDLSetVideoMode(fullscreen))
{
SDL_Surface *new_surface = NULL;
-#if defined(TARGET_SDL2)
int surface_flags_window = SURFACE_FLAGS | SDL_WINDOW_RESIZABLE;
int surface_flags_fullscreen = SURFACE_FLAGS | SDL_WINDOW_FULLSCREEN_DESKTOP;
-#else
- int surface_flags_window = SURFACE_FLAGS;
- int surface_flags_fullscreen = SURFACE_FLAGS; // (no fullscreen in SDL 1.2)
-#endif
-#if defined(TARGET_SDL2)
#if 1
int renderer_flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
#else
#endif
SDLSetScreenSizeAndOffsets(video.width, video.height);
-#endif
int width = video.width;
int height = video.height;
video.window_width = screen_width;
video.window_height = screen_height;
-#if defined(TARGET_SDL2)
-
// store if initial screen mode is fullscreen mode when changing screen size
video.fullscreen_initial = fullscreen;
Error(ERR_WARN, "SDL_CreateWindow() failed: %s", SDL_GetError());
}
-#else // TARGET_SDL
-
- if (gfx.final_screen_bitmap == NULL)
- gfx.final_screen_bitmap = CreateBitmapStruct();
-
- gfx.final_screen_bitmap->width = width;
- gfx.final_screen_bitmap->height = height;
-
- gfx.final_screen_bitmap->surface =
- SDL_SetVideoMode(width, height, video.depth, surface_flags);
-
- if (gfx.final_screen_bitmap->surface != NULL)
- {
- new_surface =
- SDL_CreateRGBSurface(surface_flags, width, height, video.depth, 0,0,0, 0);
-
- if (new_surface == NULL)
- Error(ERR_WARN, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
-
-#if 0
- new_surface = gfx.final_screen_bitmap->surface;
- gfx.final_screen_bitmap = NULL;
-#endif
-
- }
- else
- {
- Error(ERR_WARN, "SDL_SetVideoMode() failed: %s", SDL_GetError());
- }
-#endif
-
-#if defined(TARGET_SDL2)
// store fullscreen state ("video.fullscreen_enabled" may not reflect this!)
if (new_surface != NULL)
fullscreen_enabled = fullscreen;
-#endif
if (backbuffer == NULL)
backbuffer = CreateBitmapStruct();
}
}
-#if defined(TARGET_SDL2)
SDLRedrawWindow(); // map window
-#endif
#ifdef DEBUG
#if defined(PLATFORM_WIN32)
boolean wminfo_success = FALSE;
SDL_VERSION(&wminfo.version);
-#if defined(TARGET_SDL2)
+
if (sdl_window)
wminfo_success = SDL_GetWindowWMInfo(sdl_window, &wminfo);
-#else
- wminfo_success = (SDL_GetWMInfo(&wminfo) == 1);
-#endif
if (wminfo_success)
{
-#if defined(TARGET_SDL2)
hwnd = wminfo.info.win.window;
-#else
- hwnd = wminfo.window;
-#endif
DragAcceptFiles(hwnd, TRUE);
}
void SDLSetWindowTitle(void)
{
-#if defined(TARGET_SDL2)
if (sdl_window == NULL)
return;
SDL_SetWindowTitle(sdl_window, program.window_title);
-#else
- SDL_WM_SetCaption(program.window_title, program.window_title);
-#endif
}
-#if defined(TARGET_SDL2)
void SDLSetWindowScaling(int window_scaling_percent)
{
if (sdl_window == NULL)
SDLSetScreenSizeForRenderer(video.screen_width, video.screen_height);
}
-#endif
-
void SDLSetScreenRenderingMode(char *screen_rendering_mode)
{
-#if defined(TARGET_SDL2)
video.screen_rendering_mode =
(strEqual(screen_rendering_mode, STR_SPECIAL_RENDERING_BITMAP) ?
SPECIAL_RENDERING_BITMAP :
SPECIAL_RENDERING_TARGET:
strEqual(screen_rendering_mode, STR_SPECIAL_RENDERING_DOUBLE) ?
SPECIAL_RENDERING_DOUBLE : SPECIAL_RENDERING_OFF);
-#else
- video.screen_rendering_mode = SPECIAL_RENDERING_BITMAP;
-#endif
}
void SDLSetScreenVsyncMode(char *vsync_mode)
{
-#if defined(TARGET_SDL2)
int interval =
(strEqual(vsync_mode, STR_VSYNC_MODE_NORMAL) ? VSYNC_MODE_NORMAL :
strEqual(vsync_mode, STR_VSYNC_MODE_ADAPTIVE) ? VSYNC_MODE_ADAPTIVE :
// if adaptive vsync requested, but not supported, retry with normal vsync
if (result == -1 && interval == VSYNC_MODE_ADAPTIVE)
SDL_GL_SetSwapInterval(VSYNC_MODE_NORMAL);
-#endif
}
void SDLRedrawWindow(void)
bitmap->surface = NULL;
bitmap->surface_masked = NULL;
-#if defined(TARGET_SDL2)
if (bitmap->texture)
SDL_DestroyTexture(bitmap->texture);
if (bitmap->texture_masked)
bitmap->texture = NULL;
bitmap->texture_masked = NULL;
-#endif
}
void SDLCopyArea(Bitmap *src_bitmap, Bitmap *dst_bitmap,
int src_x, int src_y, int width, int height,
int dst_x, int dst_y, int mask_mode)
{
-#if defined(TARGET_SDL2)
SDL_Texture *texture;
SDL_Rect src_rect;
SDL_Rect dst_rect;
dst_rect.h = height;
SDL_RenderCopy(sdl_renderer, texture, &src_rect, &dst_rect);
-#endif
}
void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y, int width, int height,
if (program.headless)
return;
-#if !defined(TARGET_SDL2)
- if (!strEqual(setup.system.sdl_audiodriver, ARG_DEFAULT))
- SDL_putenv(getStringCat2("SDL_AUDIODRIVER=", setup.system.sdl_audiodriver));
-#endif
-
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
{
Error(ERR_WARN, "SDL_InitSubSystem() failed: %s", SDL_GetError());
SDL_SysWMEvent *syswmevent = (SDL_SysWMEvent *)event;
SDL_SysWMmsg *syswmmsg = (SDL_SysWMmsg *)(syswmevent->msg);
-#if defined(TARGET_SDL2)
if (syswmmsg->msg.win.msg == WM_DROPFILES)
-#else
- if (syswmmsg->msg == WM_DROPFILES)
-#endif
{
-#if defined(TARGET_SDL2)
HDROP hdrop = (HDROP)syswmmsg->msg.win.wParam;
-#else
- HDROP hdrop = (HDROP)syswmmsg->wParam;
-#endif
int i, num_files;
printf("::: SDL_SYSWMEVENT:\n");
printf("::: - '%s'\n", buffer);
}
-#if defined(TARGET_SDL2)
DragFinish((HDROP)syswmmsg->msg.win.wParam);
-#else
- DragFinish((HDROP)syswmmsg->wParam);
-#endif
}
#endif
#endif
// joystick functions
// ============================================================================
-#if defined(TARGET_SDL2)
static void *sdl_joystick[MAX_PLAYERS]; // game controller or joystick
-#else
-static SDL_Joystick *sdl_joystick[MAX_PLAYERS]; // only joysticks supported
-#endif
static int sdl_js_axis_raw[MAX_PLAYERS][2];
static int sdl_js_axis[MAX_PLAYERS][2];
static int sdl_js_button[MAX_PLAYERS][2];
if (nr < 0 || nr >= MAX_PLAYERS)
return FALSE;
-#if defined(TARGET_SDL2)
sdl_is_controller[nr] = SDL_IsGameController(nr);
-#else
- sdl_is_controller[nr] = FALSE;
-#endif
#if DEBUG_JOYSTICKS
Error(ERR_DEBUG, "opening joystick %d (%s)",
nr, (sdl_is_controller[nr] ? "game controller" : "joystick"));
#endif
-#if defined(TARGET_SDL2)
if (sdl_is_controller[nr])
sdl_joystick[nr] = SDL_GameControllerOpen(nr);
else
sdl_joystick[nr] = SDL_JoystickOpen(nr);
-#else
- sdl_joystick[nr] = SDL_JoystickOpen(nr);
-#endif
return (sdl_joystick[nr] != NULL);
}
Error(ERR_DEBUG, "closing joystick %d", nr);
#endif
-#if defined(TARGET_SDL2)
if (sdl_is_controller[nr])
SDL_GameControllerClose(sdl_joystick[nr]);
else
SDL_JoystickClose(sdl_joystick[nr]);
-#else
- SDL_JoystickClose(sdl_joystick[nr]);
-#endif
sdl_joystick[nr] = NULL;
}
if (nr < 0 || nr >= MAX_PLAYERS)
return FALSE;
-#if defined(TARGET_SDL2)
return (sdl_joystick[nr] != NULL ? TRUE : FALSE);
-#else
- return (SDL_JoystickOpened(nr) ? TRUE : FALSE);
-#endif
}
static void setJoystickAxis(int nr, int axis_id_raw, int axis_value)
{
-#if defined(TARGET_SDL2)
int axis_id = (axis_id_raw == SDL_CONTROLLER_AXIS_LEFTX ||
axis_id_raw == SDL_CONTROLLER_AXIS_RIGHTX ? 0 :
axis_id_raw == SDL_CONTROLLER_AXIS_LEFTY ||
axis_id_raw == SDL_CONTROLLER_AXIS_RIGHTY ? 1 : -1);
-#else
- int axis_id = axis_id_raw % 2;
-#endif
if (nr < 0 || nr >= MAX_PLAYERS)
return;
static void setJoystickButton(int nr, int button_id_raw, int button_state)
{
-#if defined(TARGET_SDL2)
int button_id = (button_id_raw == SDL_CONTROLLER_BUTTON_A ||
button_id_raw == SDL_CONTROLLER_BUTTON_X ||
button_id_raw == SDL_CONTROLLER_BUTTON_LEFTSHOULDER ||
button_id_raw == SDL_CONTROLLER_BUTTON_DPAD_UP ||
button_id_raw == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
sdl_js_axis_raw[nr][0] = sdl_js_axis_raw[nr][1] = -1;
-#else
- int button_id = button_id_raw % 2;
-#endif
if (nr < 0 || nr >= MAX_PLAYERS)
return;
{
switch(event->type)
{
-#if defined(TARGET_SDL2)
case SDL_CONTROLLERDEVICEADDED:
#if DEBUG_JOYSTICKS
Error(ERR_DEBUG, "SDL_CONTROLLERDEVICEADDED: device %d added",
event->cbutton.button,
FALSE);
break;
-#endif
case SDL_JOYAXISMOTION:
if (sdl_is_controller[event->jaxis.which])
{
static boolean sdl_joystick_subsystem_initialized = FALSE;
boolean print_warning = !sdl_joystick_subsystem_initialized;
-#if defined(TARGET_SDL2)
char *mappings_file_base = getPath2(options.conf_directory,
GAMECONTROLLER_BASENAME);
char *mappings_file_user = getPath2(getUserGameDataDir(),
GAMECONTROLLER_BASENAME);
int num_mappings;
-#endif
int i;
if (!sdl_joystick_subsystem_initialized)
{
sdl_joystick_subsystem_initialized = TRUE;
-#if defined(TARGET_SDL2)
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) < 0)
-#else
- if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0)
-#endif
{
Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
return;
}
-#if defined(TARGET_SDL2)
num_mappings = SDL_GameControllerAddMappingsFromFile(mappings_file_base);
// the included game controller base mappings should always be found
Error(ERR_INFO, "- joystick %d (%s): '%s'",
i, type, (name ? name : "(Unknown)"));
}
-#endif
#endif
}
// definitions needed for "system.c"
-#if defined(TARGET_SDL2)
#define SURFACE_FLAGS (0)
-#else
-#define SURFACE_FLAGS (SDL_SWSURFACE)
-#endif
-#if defined(TARGET_SDL2)
#define SET_TRANSPARENT_PIXEL (SDL_TRUE)
#define UNSET_TRANSPARENT_PIXEL (SDL_FALSE)
-#else
-#define SET_TRANSPARENT_PIXEL (SDL_SRCCOLORKEY)
-#define UNSET_TRANSPARENT_PIXEL (0)
-#endif
// system dependent definitions
-#if defined(TARGET_SDL2)
#define TARGET_STRING "SDL2"
-#else
-#define TARGET_STRING "SDL"
-#endif
#if defined(PLATFORM_ANDROID)
#define WINDOW_SCALING_STATUS WINDOW_SCALING_NOT_AVAILABLE
#define FULLSCREEN_STATUS FULLSCREEN_AVAILABLE
-#elif defined(TARGET_SDL2)
+#else
#define WINDOW_SCALING_STATUS WINDOW_SCALING_AVAILABLE
#define FULLSCREEN_STATUS FULLSCREEN_AVAILABLE
-#else // SDL 1.2
-#define WINDOW_SCALING_STATUS WINDOW_SCALING_NOT_AVAILABLE
-#define FULLSCREEN_STATUS FULLSCREEN_AVAILABLE
#endif
#define CURSOR_MAX_WIDTH 32
typedef Uint32 Pixel;
typedef SDL_Cursor *Cursor;
-#if defined(TARGET_SDL2)
typedef SDL_Keycode Key;
typedef SDL_Keymod KeyMod;
-#else
-typedef SDLKey Key;
-typedef unsigned int KeyMod;
-#endif
typedef SDL_Event Event;
typedef SDL_MouseButtonEvent ButtonEvent;
typedef SDL_MouseMotionEvent MotionEvent;
-#if defined(TARGET_SDL2)
typedef SDL_MouseWheelEvent WheelEvent;
typedef SDL_TouchFingerEvent FingerEvent;
typedef SDL_TextInputEvent TextEvent;
typedef SDL_Event PauseResumeEvent;
typedef SDL_WindowEvent WindowEvent;
-#endif
typedef SDL_KeyboardEvent KeyEvent;
typedef SDL_Event ExposeEvent;
typedef SDL_Event FocusChangeEvent;
int width, height;
SDL_Surface *surface;
SDL_Surface *surface_masked;
-#if defined(TARGET_SDL2)
SDL_Texture *texture;
SDL_Texture *texture_masked;
-#endif
};
struct MouseCursorInfo
#define EVENT_BUTTONPRESS SDL_MOUSEBUTTONDOWN
#define EVENT_BUTTONRELEASE SDL_MOUSEBUTTONUP
#define EVENT_MOTIONNOTIFY SDL_MOUSEMOTION
-#if defined(TARGET_SDL2)
#define EVENT_WHEELMOTION SDL_MOUSEWHEEL
#define EVENT_FINGERPRESS SDL_FINGERDOWN
#define EVENT_FINGERRELEASE SDL_FINGERUP
#define EVENT_FINGERMOTION SDL_FINGERMOTION
#define EVENT_TEXTINPUT SDL_TEXTINPUT
-#endif
#define EVENT_KEYPRESS SDL_KEYDOWN
#define EVENT_KEYRELEASE SDL_KEYUP
#define EVENT_EXPOSE SDL_USEREVENT + 0
#define KSYM_Control_L SDLK_LCTRL
#define KSYM_Control_R SDLK_RCTRL
-#if defined(TARGET_SDL2)
#define KSYM_Meta_L SDLK_LGUI
#define KSYM_Meta_R SDLK_RGUI
-#else
-#define KSYM_Meta_L SDLK_LMETA
-#define KSYM_Meta_R SDLK_RMETA
-#endif
#define KSYM_Alt_L SDLK_LALT
#define KSYM_Alt_R SDLK_RALT
-#if !defined(TARGET_SDL2)
-#define KSYM_Super_L SDLK_LSUPER
-#define KSYM_Super_R SDLK_RSUPER
-#endif
#define KSYM_Mode_switch SDLK_MODE
#define KSYM_Multi_key SDLK_RCTRL
#define KSYM_Page_Up SDLK_PAGEUP
#define KSYM_Page_Down SDLK_PAGEDOWN
-#if defined(TARGET_SDL2)
#define KSYM_Select SDLK_SELECT
#define KSYM_Menu SDLK_MENU
#define KSYM_Back SDLK_AC_BACK
#define KSYM_Rewind SDLK_AUDIOREWIND
#define KSYM_FastForward SDLK_AUDIOFASTFORWARD
#endif
-#endif
#define KSYM_space SDLK_SPACE
#define KSYM_exclam SDLK_EXCLAIM
#define KSYM_quotedbl SDLK_QUOTEDBL
#define KSYM_numbersign SDLK_HASH
#define KSYM_dollar SDLK_DOLLAR
-
-#if defined(TARGET_SDL2)
#define KSYM_percent SDLK_PERCENT
-#else
-#define KSYM_percent 37 // undefined in SDL
-#endif
-
#define KSYM_ampersand SDLK_AMPERSAND
#define KSYM_apostrophe SDLK_QUOTE
#define KSYM_parenleft SDLK_LEFTPAREN
#define KSYM_braceright KSYM_UNDEFINED // undefined
#define KSYM_asciitilde KSYM_UNDEFINED // undefined
-#if defined(TARGET_SDL2)
#define KSYM_degree 176
#define KSYM_Adiaeresis 196
#define KSYM_Odiaeresis 214
#define KSYM_odiaeresis 246
#define KSYM_udiaeresis 252
#define KSYM_ssharp 223
-#else
-#define KSYM_degree SDLK_WORLD_16
-#define KSYM_Adiaeresis SDLK_WORLD_36
-#define KSYM_Odiaeresis SDLK_WORLD_54
-#define KSYM_Udiaeresis SDLK_WORLD_60
-#define KSYM_adiaeresis SDLK_WORLD_68
-#define KSYM_odiaeresis SDLK_WORLD_86
-#define KSYM_udiaeresis SDLK_WORLD_92
-#define KSYM_ssharp SDLK_WORLD_63
-#endif
#ifndef SDLK_A
#define SDLK_A 65
#define KSYM_8 SDLK_8
#define KSYM_9 SDLK_9
-#if defined(TARGET_SDL2)
#define KSYM_KP_0 SDLK_KP_0
#define KSYM_KP_1 SDLK_KP_1
#define KSYM_KP_2 SDLK_KP_2
#define KSYM_KP_7 SDLK_KP_7
#define KSYM_KP_8 SDLK_KP_8
#define KSYM_KP_9 SDLK_KP_9
-#else
-#define KSYM_KP_0 SDLK_KP0
-#define KSYM_KP_1 SDLK_KP1
-#define KSYM_KP_2 SDLK_KP2
-#define KSYM_KP_3 SDLK_KP3
-#define KSYM_KP_4 SDLK_KP4
-#define KSYM_KP_5 SDLK_KP5
-#define KSYM_KP_6 SDLK_KP6
-#define KSYM_KP_7 SDLK_KP7
-#define KSYM_KP_8 SDLK_KP8
-#define KSYM_KP_9 SDLK_KP9
-#endif
#define KSYM_F1 SDLK_F1
#define KSYM_F2 SDLK_F2
#define KMOD_Shift_R KMOD_RSHIFT
#define KMOD_Control_L KMOD_LCTRL
#define KMOD_Control_R KMOD_RCTRL
-
-#if defined(TARGET_SDL2)
#define KMOD_Meta_L KMOD_LGUI
#define KMOD_Meta_R KMOD_RGUI
-#else
-#define KMOD_Meta_L KMOD_LMETA
-#define KMOD_Meta_R KMOD_RMETA
-#endif
-
#define KMOD_Alt_L KMOD_LALT
#define KMOD_Alt_R KMOD_RALT
KMOD_Meta | \
KMOD_Alt)
-#if defined(TARGET_SDL2)
#define KMOD_TextInput (KMOD_Shift | KMOD_Alt_R)
-#endif
// SDL function definitions
void SDLCreateBitmapTextures(Bitmap *);
void SDLFreeBitmapTextures(Bitmap *);
-#if defined(TARGET_SDL2)
SDL_Surface *SDL_DisplayFormat(SDL_Surface *);
void SDLSetWindowScaling(int);
void SDLSetWindowScalingQuality(char *);
void SDLSetScreenSizeAndOffsets(int, int);
void SDLSetScreenSizeForRenderer(int, int);
void SDLSetScreenProperties(void);
-#endif
void SDLSetScreenRenderingMode(char *);
void SDLSetScreenVsyncMode(char *);
int button_status = MB_NOT_PRESSED;
boolean motion_status = FALSE;
int wheel_steps = DEFAULT_WHEEL_STEPS;
-#if defined(TARGET_SDL2)
boolean keyrepeat_status = TRUE;
-#endif
int redraw_mask = REDRAW_NONE;
OpenLogFiles();
-#if defined(TARGET_SDL2)
- int sdl_init_flags = SDL_INIT_EVENTS | SDL_INIT_NOPARACHUTE;
-#else
- int sdl_init_flags = SDL_INIT_EVENTTHREAD | SDL_INIT_NOPARACHUTE;
-#endif
+ int sdl_init_flags = SDL_INIT_EVENTS | SDL_INIT_NOPARACHUTE;
if (SDL_Init(sdl_init_flags) < 0)
Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
{
ReCreateBitmap(&gfx.background_bitmap, win_xsize, win_ysize);
-#if defined(TARGET_SDL2)
ReCreateBitmap(&gfx.final_screen_bitmap, win_xsize, win_ysize);
-#endif
ReCreateBitmap(&gfx.fade_bitmap_backup, win_xsize, win_ysize);
ReCreateBitmap(&gfx.fade_bitmap_source, win_xsize, win_ysize);
return;
SDLInitVideoDisplay();
-#if defined(TARGET_SDL2)
SDLSetDisplaySize();
-#endif
}
void CloseVideoDisplay(void)
src_x += dst_x - dst_x_unclipped;
src_y += dst_y - dst_y_unclipped;
-#if defined(TARGET_SDL2)
// !!! 2013-12-11: An "old friend" is back. Same bug in SDL2 2.0.1 !!!
// !!! 2009-03-30: Fixed by using self-compiled, patched SDL.dll !!!
/* (This bug still exists in the actual (as of 2009-06-15) version 1.2.13,
return;
}
-#endif
sysCopyArea(src_bitmap, dst_bitmap,
src_x, src_y, width, height, dst_x, dst_y, BLIT_OPAQUE);
void KeyboardAutoRepeatOn(void)
{
-#if defined(TARGET_SDL2)
keyrepeat_status = TRUE;
-#else
- SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY / 2,
- SDL_DEFAULT_REPEAT_INTERVAL / 2);
- SDL_EnableUNICODE(1);
-#endif
}
void KeyboardAutoRepeatOff(void)
{
-#if defined(TARGET_SDL2)
keyrepeat_status = FALSE;
-#else
- SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
- SDL_EnableUNICODE(0);
-#endif
}
boolean SetVideoMode(boolean fullscreen)
void PeekEvent(Event *event)
{
-#if defined(TARGET_SDL2)
SDL_PeepEvents(event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
-#else
- SDL_PeepEvents(event, 1, SDL_PEEKEVENT, SDL_ALLEVENTS);
-#endif
}
void CheckQuitEvent(void)
Key GetEventKey(KeyEvent *event, boolean with_modifiers)
{
-#if defined(TARGET_SDL2)
// key up/down events in SDL2 do not return text characters anymore
return event->keysym.sym;
-#else
-
-#if ENABLE_UNUSED_CODE
- printf("unicode == '%d', sym == '%d', mod == '0x%04x'\n",
- (int)event->keysym.unicode,
- (int)event->keysym.sym,
- (int)SDL_GetModState());
-#endif
-
- if (with_modifiers &&
- event->keysym.unicode > 0x0000 &&
- event->keysym.unicode < 0x2000)
- return event->keysym.unicode;
- else
- return event->keysym.sym;
-
-#endif
}
KeyMod HandleKeyModState(Key key, int key_status)
void StartTextInput(int x, int y, int width, int height)
{
-#if defined(TARGET_SDL2)
#if defined(HAS_SCREEN_KEYBOARD)
SDL_StartTextInput();
video.shifted_up = TRUE;
}
#endif
-#endif
}
void StopTextInput(void)
{
-#if defined(TARGET_SDL2)
#if defined(HAS_SCREEN_KEYBOARD)
SDL_StopTextInput();
video.shifted_up = FALSE;
}
#endif
-#endif
}
boolean CheckCloseWindowEvent(ClientMessageEvent *event)
#define STR_SPECIAL_RENDERING_TARGET "target_texture_only"
#define STR_SPECIAL_RENDERING_DOUBLE "stream_and_target_texture"
-#if defined(TARGET_SDL2)
#define STR_SPECIAL_RENDERING_DEFAULT STR_SPECIAL_RENDERING_DOUBLE
-#else
-#define STR_SPECIAL_RENDERING_DEFAULT STR_SPECIAL_RENDERING_BITMAP
-#endif
#define SPECIAL_RENDERING_OFF 0
#define SPECIAL_RENDERING_BITMAP 1
#define SPECIAL_RENDERING_TARGET 2
#define SPECIAL_RENDERING_DOUBLE 3
-#if defined(TARGET_SDL2)
#define SPECIAL_RENDERING_DEFAULT SPECIAL_RENDERING_DOUBLE
-#else
-#define SPECIAL_RENDERING_DEFAULT SPECIAL_RENDERING_BITMAP
-#endif
// values for vertical screen retrace synchronization (vsync)
#define STR_VSYNC_MODE_OFF "off"
extern int button_status;
extern boolean motion_status;
extern int wheel_steps;
-#if defined(TARGET_SDL2)
extern boolean keyrepeat_status;
-#endif
extern int redraw_mask;
boolean game_status_last_screen = -1;
boolean level_editor_test_game = FALSE;
boolean network_playing = FALSE;
-
-#if defined(TARGET_SDL)
boolean network_server = FALSE;
SDL_Thread *server_thread;
-#endif
int key_joystick_mapping = 0;
extern boolean game_status_last_screen;
extern boolean level_editor_test_game;
extern boolean network_playing;
-
-#if defined(TARGET_SDL)
extern boolean network_server;
extern SDL_Thread *server_thread;
-#endif
extern int key_joystick_mapping;
static int p;
p = port;
-#if defined(TARGET_SDL2)
+
server_thread = SDL_CreateThread(NetworkServerThread,
"NetworkServerThread", &p);
-#else
- server_thread = SDL_CreateThread(NetworkServerThread, &p);
-#endif
network_server = TRUE;
}
SDL_version sdl_version_compiled;
const SDL_version *sdl_version_linked;
int driver_name_len = 10;
-#if defined(TARGET_SDL2)
SDL_version sdl_version_linked_ext;
const char *driver_name = NULL;
-#else
- char driver_name[driver_name_len];
-#endif
SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_VERSION);
ystart += ystep_head;
SDL_VERSION(&sdl_version_compiled);
-#if defined(TARGET_SDL2)
SDL_GetVersion(&sdl_version_linked_ext);
sdl_version_linked = &sdl_version_linked_ext;
-#else
- sdl_version_linked = SDL_Linked_Version();
-#endif
DrawTextF(xstart1, ystart, font_text, "SDL");
DrawTextF(xstart2, ystart, font_text, "%d.%d.%d",
DrawTextF(xstart3, ystart, font_head, "Used");
ystart += ystep_head;
-#if defined(TARGET_SDL2)
driver_name = getStringCopyNStatic(SDL_GetVideoDriver(0), driver_name_len);
-#else
- SDL_VideoDriverName(driver_name, driver_name_len);
-#endif
DrawTextF(xstart1, ystart, font_text, "SDL_VideoDriver");
DrawTextF(xstart2, ystart, font_text, "%s", setup.system.sdl_videodriver);
DrawTextF(xstart3, ystart, font_text, "%s", driver_name);
ystart += ystep_line;
-#if defined(TARGET_SDL2)
driver_name = getStringCopyNStatic(SDL_GetAudioDriver(0), driver_name_len);
-#else
- SDL_AudioDriverName(driver_name, driver_name_len);
-#endif
DrawTextF(xstart1, ystart, font_text, "SDL_AudioDriver");
DrawTextF(xstart2, ystart, font_text, "%s", setup.system.sdl_audiodriver);
if (check_game_speed)
ModifyGameSpeedIfNeeded();
-#if defined(TARGET_SDL2)
// window scaling may have changed at this point
ToggleFullscreenOrChangeWindowScalingIfNeeded();
// screen vsync mode may have changed at this point
SDLSetScreenVsyncMode(setup.vsync_mode);
-#endif
}
static void execSetupChooseWindowSize(void)
static struct TokenInfo setup_info_graphics[] =
{
-#if defined(TARGET_SDL2) && !defined(PLATFORM_ANDROID)
+#if !defined(PLATFORM_ANDROID)
{ TYPE_SWITCH, &setup.fullscreen, "Fullscreen:" },
{ TYPE_ENTER_LIST, execSetupChooseWindowSize, "Window Scaling:" },
{ TYPE_STRING, &window_size_text, "" },
static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick)
{
-#if defined(TARGET_SDL2)
static boolean bitmaps_initialized = FALSE;
boolean screen_initialized = FALSE;
static Bitmap *controller, *button, *axis_x, *axis_y;
while (NextValidEvent(&event));
return success;
-#else
- return TRUE;
-#endif
}
static int ConfigureJoystickMain(int player_nr)
// press 'Enter' to keep the existing key binding
if (key == KSYM_Return ||
-#if defined(TARGET_SDL2)
key == KSYM_Menu ||
-#endif
key == KSYM_space)
{
step_nr++;
}
- else if (key == KSYM_BackSpace
-#if defined(TARGET_SDL2)
- ||
- key == KSYM_Back
-#endif
- )
+ else if (key == KSYM_BackSpace ||
+ key == KSYM_Back)
{
if (step_nr == 0)
{
}
break;
-#if defined(TARGET_SDL2)
case SDL_WINDOWEVENT:
HandleWindowEvent((WindowEvent *) &event);
case SDL_APP_DIDENTERFOREGROUND:
HandlePauseResumeEvent((PauseResumeEvent *) &event);
break;
-#endif
default:
HandleOtherEvents(&event);
{
case EVENT_BUTTONRELEASE:
case EVENT_KEYPRESS:
-#if defined(TARGET_SDL2)
case SDL_CONTROLLERBUTTONDOWN:
-#endif
case SDL_JOYBUTTONDOWN:
still_wait = FALSE;
break;
break;
}
-#if defined(TARGET_SDL2)
case SDL_WINDOWEVENT:
HandleWindowEvent((WindowEvent *) &event);
break;
case SDL_APP_DIDENTERFOREGROUND:
HandlePauseResumeEvent((PauseResumeEvent *) &event);
break;
-#endif
case EVENT_KEYPRESS:
{
case KSYM_Return:
case KSYM_y:
-#if defined(TARGET_SDL2)
case KSYM_Y:
case KSYM_Select:
case KSYM_Menu:
#if defined(KSYM_Rewind)
case KSYM_Rewind: // for Amazon Fire TV remote
-#endif
#endif
result = 1;
break;
case KSYM_Escape:
case KSYM_n:
-#if defined(TARGET_SDL2)
case KSYM_N:
case KSYM_Back:
#if defined(KSYM_FastForward)
case KSYM_FastForward: // for Amazon Fire TV remote
-#endif
#endif
result = 0;
break;
ClearPlayerAction();
break;
-#if defined(TARGET_SDL2)
case SDL_CONTROLLERBUTTONDOWN:
switch (event.cbutton.button)
{
HandleJoystickEvent(&event);
ClearPlayerAction();
break;
-#endif
default:
HandleOtherEvents(&event);
if (!change_window_scaling_percent && !video.fullscreen_available)
return;
-#if defined(TARGET_SDL2)
if (change_window_scaling_percent)
{
SDLSetWindowScaling(setup.window_scaling_percent);
return;
}
-#endif
if (change_fullscreen ||
change_window_scaling_percent)