forked from pete-gordon/oricutron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem_sdl.h
154 lines (134 loc) · 4.7 KB
/
system_sdl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
** Oricutron
** Copyright (C) 2009-2014 Peter Gordon
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License
** as published by the Free Software Foundation, version 2
** of the License.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**
** SDL System specific stuff
*/
#ifndef ORICUTRON_SYSTEM_SDL_H
#define ORICUTRON_SYSTEM_SDL_H
#if SDL_MAJOR_VERSION == 1
# ifdef __SPECIFY_SDL_DIR__
# include <SDL/SDL.h>
# include <SDL/SDL_version.h>
# ifdef WANT_WMINFO
# include <SDL/SDL_syswm.h>
# endif
# else
# include <SDL.h>
# include <SDL_version.h>
# ifdef WANT_WMINFO
# include <SDL_syswm.h>
# endif
# endif
#else /* SDL_MAJOR_VERSION == 1 */
# ifdef __SPECIFY_SDL_DIR__
# include <SDL2/SDL.h>
# include <SDL2/SDL_version.h>
# ifdef WANT_WMINFO
# include <SDL2/SDL_syswm.h>
# endif
# else
# include <SDL.h>
# include <SDL_version.h>
# ifdef WANT_WMINFO
# include <SDL_syswm.h>
# endif
# endif
#endif
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define _LE32(X) (X)
#define _LE16(X) (X)
#define _BE32(X) SDL_Swap32(X)
#define _BE16(X) SDL_Swap16(X)
#define _MAKE_LE32(X)
#define _MAKE_LE16(X)
#define _MAKE_BE32(X) X = SDL_Swap32(X)
#define _MAKE_BE16(X) X = SDL_Swap16(X)
#else
#define _LE32(X) SDL_Swap32(X)
#define _LE16(X) SDL_Swap16(X)
#define _BE32(X) (X)
#define _BE16(X) (X)
#define _MAKE_LE32(X) X = SDL_Swap32(X)
#define _MAKE_LE16(X) X = SDL_Swap16(X)
#define _MAKE_BE32(X)
#define _MAKE_BE16(X)
#endif
/* SDL compatability definitions and macroses */
#if SDL_MAJOR_VERSION == 1
typedef Uint16 SDL_COMPAT_KEY; /* Used in 8912.c */
typedef SDL_keysym SDL_KEYSYM;
typedef SDL_VideoInfo SDL_COMPAT_VideoInfo;
#define SDL_COMPAT_HWSURFACE SDL_HWSURFACE
#define SDL_COMPAT_HWPALETTE SDL_HWPALETTE
#define SDL_COMPAT_FULLSCREEN SDL_FULLSCREEN
#ifdef __OPENGL_AVAILABLE__
#define SDL_COMPAT_OPENGL SDL_OPENGL
#endif
#define SDL_COMPAT_LOGPAL SDL_LOGPAL
#define SDL_COMPAT_PHYSPAL SDL_PHYSPAL
#define SDL_COMPAT_ACTIVEEVENT SDL_ACTIVEEVENT
#else
typedef Uint32 SDL_COMPAT_KEY; /* Used in 8912.c */
typedef SDL_Keysym SDL_KEYSYM;
typedef SDL_RendererInfo SDL_COMPAT_VideoInfo;
#define SDL_COMPAT_HWSURFACE 0 /* FIXME */
#define SDL_COMPAT_HWPALETTE 0 /* FIXME */
#define SDL_COMPAT_FULLSCREEN SDL_WINDOW_FULLSCREEN
#ifdef __OPENGL_AVAILABLE__
#define SDL_COMPAT_OPENGL SDL_WINDOW_OPENGL
#endif
#define SDL_COMPAT_LOGPAL 0 /* FIXME */
#define SDL_COMPAT_PHYSPAL 0 /* FIXME */
#define SDL_COMPAT_ACTIVEEVENT SDL_WINDOWEVENT
#define SDL_DEFAULT_REPEAT_DELAY 0 /* FIXME */
#define SDL_DEFAULT_REPEAT_INTERVAL 0 /* FIXMR */
#define SDLK_KP0 SDLK_KP_0
#define SDLK_KP1 SDLK_KP_1
#define SDLK_KP2 SDLK_KP_2
#define SDLK_KP3 SDLK_KP_3
#define SDLK_KP4 SDLK_KP_4
#define SDLK_KP5 SDLK_KP_5
#define SDLK_KP6 SDLK_KP_6
#define SDLK_KP7 SDLK_KP_7
#define SDLK_KP8 SDLK_KP_8
#define SDLK_KP9 SDLK_KP_9
#define SDLK_PRINT SDLK_PRINTSCREEN
#endif
/* SDL compatability protos */
#ifdef WANT_WMINFO
int SDL_COMPAT_GetWMInfo(SDL_SysWMinfo *info);
#endif
void SDL_COMPAT_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);
void SDL_COMPAT_WM_SetCaption(const char *title, const char *icon);
SDL_bool SDL_COMPAT_IsAppActive(SDL_Event* event);
SDL_bool SDL_COMPAT_IsAppFocused(SDL_Event* event);
int SDL_COMPAT_EnableKeyRepeat(int delay, int interval);
int SDL_COMPAT_EnableUNICODE(int enable);
SDL_COMPAT_KEY SDL_COMPAT_GetKeysymUnicode(SDL_KEYSYM keysym);
int SDL_COMPAT_Flip(SDL_Surface* screen);
int SDL_COMPAT_GetBitsPerPixel(void);
int SDL_COMPAT_WM_ToggleFullScreen(SDL_Surface *surface);
SDL_Surface* SDL_COMPAT_SetVideoMode(int width, int height, int bitsperpixel, Uint32 flags);
int SDL_COMPAT_SetPalette(SDL_Surface *surface, int flags, SDL_Color *colors, int firstcolor, int ncolors);
void SDL_COMPAT_SetEventFilter(SDL_EventFilter filter);
void SDL_COMPAT_Quit(void);
void SDL_COMPAT_TakeScreenshot(char *fname);
#ifdef __OPENGL_AVAILABLE__
void SDL_COMPAT_GL_SwapBuffers(void);
#endif
#endif /* ORICUTRON_SYSTEM_SDL_H */