Skip to content

Commit

Permalink
Move SDL 1.2 compatibility helpers into compat.h.
Browse files Browse the repository at this point in the history
  • Loading branch information
adelva1984 committed Jul 4, 2013
1 parent 0e672db commit 0125e1b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 22 deletions.
28 changes: 28 additions & 0 deletions src/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,34 @@ static inline void *crealloc(void *ptr, size_t size)

#endif /* CONFIG_CHECK_ALLOC */

#if defined(CONFIG_SDL) && !defined(SKIP_SDL)

#include <SDL.h>

#if !SDL_VERSION_ATLEAST(2,0,0)

typedef SDLKey SDL_Keycode;

#define SDLK_KP_0 SDLK_KP0
#define SDLK_KP_1 SDLK_KP1
#define SDLK_KP_2 SDLK_KP2
#define SDLK_KP_3 SDLK_KP3
#define SDLK_KP_4 SDLK_KP4
#define SDLK_KP_5 SDLK_KP5
#define SDLK_KP_6 SDLK_KP6
#define SDLK_KP_7 SDLK_KP7
#define SDLK_KP_8 SDLK_KP8
#define SDLK_KP_9 SDLK_KP9
#define SDLK_NUMLOCKCLEAR SDLK_NUMLOCK
#define SDLK_SCROLLLOCK SDLK_SCROLLOCK
#define SDLK_LGUI SDLK_LSUPER
#define SDLK_RGUI SDLK_RSUPER
#define SDLK_PAUSE SDLK_BREAK

#endif /* !SDL_VERSION_ATLEAST(2,0,0) */

#endif /* CONFIG_SDL && !SKIP_SDL */

__M_END_DECLS

#endif // __COMPAT_H
22 changes: 0 additions & 22 deletions src/event_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,6 @@ extern struct input_status input;

static bool numlock_status_initialized;

#if !SDL_VERSION_ATLEAST(2,0,0)

typedef SDLKey SDL_Keycode;

#define SDLK_KP_0 SDLK_KP0
#define SDLK_KP_1 SDLK_KP1
#define SDLK_KP_2 SDLK_KP2
#define SDLK_KP_3 SDLK_KP3
#define SDLK_KP_4 SDLK_KP4
#define SDLK_KP_5 SDLK_KP5
#define SDLK_KP_6 SDLK_KP6
#define SDLK_KP_7 SDLK_KP7
#define SDLK_KP_8 SDLK_KP8
#define SDLK_KP_9 SDLK_KP9
#define SDLK_NUMLOCKCLEAR SDLK_NUMLOCK
#define SDLK_SCROLLLOCK SDLK_SCROLLOCK
#define SDLK_LGUI SDLK_LSUPER
#define SDLK_RGUI SDLK_RSUPER
#define SDLK_PAUSE SDLK_BREAK

#endif /* SDL_VERSION_ATLEAST(2,0,0) */

static enum keycode convert_SDL_internal(SDL_Keycode key)
{
switch(key)
Expand Down
1 change: 1 addition & 0 deletions src/utils/checkres.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#endif

// From MZX itself
#define SKIP_SDL
#include "../fsafeopen.h"
#include "../const.h"
#include "../util.h"
Expand Down
1 change: 1 addition & 0 deletions src/utils/downver.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <strings.h>
#endif

#define SKIP_SDL
#include "world.h"
#include "util.h"

Expand Down
1 change: 1 addition & 0 deletions src/utils/png2smzx.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <string.h>
#include <errno.h>

#define SKIP_SDL
#include "pngops.h"
#include "smzxconv.h"

Expand Down

0 comments on commit 0125e1b

Please sign in to comment.