Mercurial > sdl-ios-xcode
annotate src/SDL.c @ 3647:c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 13 Jan 2010 06:47:17 +0000 |
parents | 63d4517fc4ac |
children | bc50cd16bb07 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
36
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
24 /* Initialization code for SDL */ | |
25 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
26 #include "SDL.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
27 #include "SDL_fatal.h" |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
28 #include "SDL_assert.h" |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
29 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
30 #if !SDL_VIDEO_DISABLED |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
31 #include "video/SDL_leaks.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
32 #endif |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
33 |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
34 #if SDL_THREAD_PTH |
557
0ce5a68278fd
Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
543
diff
changeset
|
35 #include <pth.h> |
0ce5a68278fd
Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
543
diff
changeset
|
36 #endif |
0 | 37 |
38 /* Initialization/Cleanup routines */ | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
39 #if !SDL_JOYSTICK_DISABLED |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
40 extern int SDL_JoystickInit(void); |
0 | 41 extern void SDL_JoystickQuit(void); |
42 #endif | |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
43 #if !SDL_HAPTIC_DISABLED |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
44 extern int SDL_HapticInit(void); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
45 extern int SDL_HapticQuit(void); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
46 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
47 #if !SDL_TIMERS_DISABLED |
0 | 48 extern void SDL_StartTicks(void); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
49 extern int SDL_TimerInit(void); |
0 | 50 extern void SDL_TimerQuit(void); |
51 #endif | |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
52 #if defined(__WIN32__) |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
53 extern int SDL_HelperWindowCreate(void); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
54 extern int SDL_HelperWindowDestroy(void); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
55 #endif |
0 | 56 |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
57 extern int SDL_AssertionsInit(void); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
58 extern void SDL_AssertionsQuit(void); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
59 |
0 | 60 /* The initialized subsystems */ |
61 static Uint32 SDL_initialized = 0; | |
62 static Uint32 ticks_started = 0; | |
63 | |
64 #ifdef CHECK_LEAKS | |
65 int surfaces_allocated = 0; | |
66 #endif | |
67 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
68 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
69 SDL_InitSubSystem(Uint32 flags) |
0 | 70 { |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
71 #if !SDL_VIDEO_DISABLED |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
72 /* Initialize the video/event subsystem */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
73 if ((flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO)) { |
1909
8f1ab2f7c722
Look at environment variables in SDL_VideoInit() and SDL_AudioInit()
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
74 if (SDL_VideoInit(NULL, (flags & SDL_INIT_EVENTTHREAD)) < 0) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
75 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
76 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
77 SDL_initialized |= SDL_INIT_VIDEO; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
78 } |
0 | 79 #else |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
80 if (flags & SDL_INIT_VIDEO) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
81 SDL_SetError("SDL not built with video support"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
82 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
83 } |
0 | 84 #endif |
85 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
86 #if !SDL_AUDIO_DISABLED |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
87 /* Initialize the audio subsystem */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
88 if ((flags & SDL_INIT_AUDIO) && !(SDL_initialized & SDL_INIT_AUDIO)) { |
1909
8f1ab2f7c722
Look at environment variables in SDL_VideoInit() and SDL_AudioInit()
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
89 if (SDL_AudioInit(NULL) < 0) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
90 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
91 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
92 SDL_initialized |= SDL_INIT_AUDIO; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
93 } |
0 | 94 #else |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
95 if (flags & SDL_INIT_AUDIO) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
96 SDL_SetError("SDL not built with audio support"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
97 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
98 } |
0 | 99 #endif |
100 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
101 #if !SDL_TIMERS_DISABLED |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
102 /* Initialize the timer subsystem */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
103 if (!ticks_started) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
104 SDL_StartTicks(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
105 ticks_started = 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
106 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
107 if ((flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
108 if (SDL_TimerInit() < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
109 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
110 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
111 SDL_initialized |= SDL_INIT_TIMER; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
112 } |
0 | 113 #else |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
114 if (flags & SDL_INIT_TIMER) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
115 SDL_SetError("SDL not built with timer support"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
116 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
117 } |
0 | 118 #endif |
119 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
120 #if !SDL_JOYSTICK_DISABLED |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
121 /* Initialize the joystick subsystem */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
122 if ((flags & SDL_INIT_JOYSTICK) && !(SDL_initialized & SDL_INIT_JOYSTICK)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
123 if (SDL_JoystickInit() < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
124 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
125 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
126 SDL_initialized |= SDL_INIT_JOYSTICK; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
127 } |
0 | 128 #else |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
129 if (flags & SDL_INIT_JOYSTICK) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
130 SDL_SetError("SDL not built with joystick support"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
131 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
132 } |
0 | 133 #endif |
134 | |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
135 #if !SDL_HAPTIC_DISABLED |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
136 /* Initialize the haptic subsystem */ |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
137 if ((flags & SDL_INIT_HAPTIC) && !(SDL_initialized & SDL_INIT_HAPTIC)) { |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
138 if (SDL_HapticInit() < 0) { |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
139 return (-1); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
140 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
141 SDL_initialized |= SDL_INIT_HAPTIC; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
142 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
143 #else |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
144 if (flags & SDL_INIT_HAPTIC) { |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
145 SDL_SetError("SDL not built with haptic (force feedback) support"); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
146 return (-1); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
147 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
148 #endif |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
149 return (0); |
0 | 150 } |
151 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
152 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
153 SDL_Init(Uint32 flags) |
0 | 154 { |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
155 #if !SDL_THREADS_DISABLED && SDL_THREAD_PTH |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
156 if (!pth_init()) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
157 return -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
158 } |
397 | 159 #endif |
160 | |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
161 if (SDL_AssertionsInit() < 0) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
162 return -1; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
163 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
164 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
165 /* Clear the error message */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
166 SDL_ClearError(); |
0 | 167 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
168 #if defined(__WIN32__) |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
169 if (SDL_HelperWindowCreate() < 0) { |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
170 return -1; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
171 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
172 #endif |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
173 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
174 /* Initialize the desired subsystems */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
175 if (SDL_InitSubSystem(flags) < 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
176 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
177 } |
0 | 178 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
179 /* Everything is initialized */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
180 if (!(flags & SDL_INIT_NOPARACHUTE)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
181 SDL_InstallParachute(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
182 } |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
183 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
184 /* brief sanity checks for the sanity checks. :) */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
185 SDL_assert(1); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
186 SDL_assert_release(1); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
187 SDL_assert_paranoid(1); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
188 SDL_assert(0 || 1); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
189 SDL_assert_release(0 || 1); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
190 SDL_assert_paranoid(0 || 1); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
191 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
192 #if 0 /* enable this to test assertion failures. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
193 SDL_assert_release(1 == 2); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
194 SDL_assert_release(5 < 4); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
195 SDL_assert_release(0 && "This is a test"); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
196 #endif |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
197 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
198 return (0); |
0 | 199 } |
200 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
201 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
202 SDL_QuitSubSystem(Uint32 flags) |
0 | 203 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
204 /* Shut down requested initialized subsystems */ |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
205 #if !SDL_JOYSTICK_DISABLED |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
206 if ((flags & SDL_initialized & SDL_INIT_JOYSTICK)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
207 SDL_JoystickQuit(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
208 SDL_initialized &= ~SDL_INIT_JOYSTICK; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
209 } |
0 | 210 #endif |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
211 #if !SDL_HAPTIC_DISABLED |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
212 if ((flags & SDL_initialized & SDL_INIT_HAPTIC)) { |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
213 SDL_HapticQuit(); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
214 SDL_initialized &= ~SDL_INIT_HAPTIC; |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
215 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
216 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
217 #if !SDL_TIMERS_DISABLED |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
218 if ((flags & SDL_initialized & SDL_INIT_TIMER)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
219 SDL_TimerQuit(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
220 SDL_initialized &= ~SDL_INIT_TIMER; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
221 } |
0 | 222 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
223 #if !SDL_AUDIO_DISABLED |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
224 if ((flags & SDL_initialized & SDL_INIT_AUDIO)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
225 SDL_AudioQuit(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
226 SDL_initialized &= ~SDL_INIT_AUDIO; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
227 } |
0 | 228 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
229 #if !SDL_VIDEO_DISABLED |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
230 if ((flags & SDL_initialized & SDL_INIT_VIDEO)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
231 SDL_VideoQuit(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
232 SDL_initialized &= ~SDL_INIT_VIDEO; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
233 } |
0 | 234 #endif |
235 } | |
236 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
237 Uint32 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
238 SDL_WasInit(Uint32 flags) |
0 | 239 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
240 if (!flags) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
241 flags = SDL_INIT_EVERYTHING; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
242 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
243 return (SDL_initialized & flags); |
0 | 244 } |
245 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
246 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
247 SDL_Quit(void) |
0 | 248 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
249 /* Quit all subsystems */ |
1190 | 250 #ifdef DEBUG_BUILD |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
251 printf("[SDL_Quit] : Enter! Calling QuitSubSystem()\n"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
252 fflush(stdout); |
1190 | 253 #endif |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
254 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
255 #if defined(__WIN32__) |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
256 SDL_HelperWindowDestroy(); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1909
diff
changeset
|
257 #endif |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
258 SDL_QuitSubSystem(SDL_INIT_EVERYTHING); |
0 | 259 |
260 #ifdef CHECK_LEAKS | |
1190 | 261 #ifdef DEBUG_BUILD |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
262 printf("[SDL_Quit] : CHECK_LEAKS\n"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
263 fflush(stdout); |
1190 | 264 #endif |
265 | |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
266 /* !!! FIXME: make this an assertion. */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
267 /* Print the number of surfaces not freed */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
268 if (surfaces_allocated != 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
269 fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n", |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
270 surfaces_allocated); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
271 } |
0 | 272 #endif |
1190 | 273 #ifdef DEBUG_BUILD |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
274 printf("[SDL_Quit] : SDL_UninstallParachute()\n"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
275 fflush(stdout); |
1190 | 276 #endif |
0 | 277 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
278 /* Uninstall any parachute signal handlers */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
279 SDL_UninstallParachute(); |
397 | 280 |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
281 SDL_AssertionsQuit(); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
3319
diff
changeset
|
282 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
283 #if !SDL_THREADS_DISABLED && SDL_THREAD_PTH |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
284 pth_kill(); |
397 | 285 #endif |
1190 | 286 #ifdef DEBUG_BUILD |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
287 printf("[SDL_Quit] : Returning!\n"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
288 fflush(stdout); |
1190 | 289 #endif |
290 | |
0 | 291 } |
292 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
293 /* Get the library version number */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
294 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
295 SDL_GetVersion(SDL_version * ver) |
0 | 296 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
297 SDL_VERSION(ver); |
0 | 298 } |
299 | |
2982
b64c1d23039b
Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
300 /* Get the library source revision */ |
b64c1d23039b
Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
301 int |
2996 | 302 SDL_GetRevision(void) |
2982
b64c1d23039b
Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
303 { |
2983
388c5a2daeac
Fine tuned revision code, updated testver
Sam Lantinga <slouken@libsdl.org>
parents:
2982
diff
changeset
|
304 return SDL_REVISION; |
2982
b64c1d23039b
Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
305 } |
b64c1d23039b
Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
306 |
3319 | 307 /* Get the name of the platform */ |
308 const char * | |
309 SDL_GetPlatform() | |
310 { | |
311 #if __AIX__ | |
312 return "AIX"; | |
313 #elif __HAIKU__ | |
314 /* Haiku must appear here before BeOS, since it also defines __BEOS__ */ | |
315 return "Haiku"; | |
316 #elif __BEOS__ | |
317 return "BeOS"; | |
318 #elif __BSDI__ | |
319 return "BSDI"; | |
320 #elif __DREAMCAST__ | |
321 return "Dreamcast"; | |
322 #elif __FREEBSD__ | |
323 return "FreeBSD"; | |
324 #elif __HPUX__ | |
325 return "HP-UX"; | |
326 #elif __IRIX__ | |
327 return "Irix"; | |
328 #elif __LINUX__ | |
329 return "Linux"; | |
330 #elif __MINT__ | |
331 return "Atari MiNT"; | |
332 #elif __MACOS__ | |
333 return "MacOS Classic"; | |
334 #elif __MACOSX__ | |
335 return "Mac OS X"; | |
336 #elif __NETBSD__ | |
337 return "NetBSD"; | |
338 #elif __OPENBSD__ | |
339 return "OpenBSD"; | |
340 #elif __OS2__ | |
341 return "OS/2"; | |
342 #elif __OSF__ | |
343 return "OSF/1"; | |
344 #elif __QNXNTO__ | |
345 return "QNX Neutrino"; | |
346 #elif __RISCOS__ | |
347 return "RISC OS"; | |
348 #elif __SOLARIS__ | |
349 return "Solaris"; | |
350 #elif __WIN32__ | |
351 #ifdef _WIN32_WCE | |
352 return "Windows CE"; | |
353 #else | |
354 return "Windows"; | |
355 #endif | |
356 #elif __IPHONEOS__ | |
357 return "iPhone OS"; | |
358 #else | |
359 return "Unknown (see SDL_platform.h)"; | |
360 #endif | |
361 } | |
362 | |
3269
a67a961e2171
Removed outdated OS/2 support
Sam Lantinga <slouken@libsdl.org>
parents:
3243
diff
changeset
|
363 #if defined(__WIN32__) |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
364 |
1465
8dfa9a6d69a5
Updated WinCE support by Dmitry (with some tweaks)
Sam Lantinga <slouken@libsdl.org>
parents:
1433
diff
changeset
|
365 #if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL)) |
8dfa9a6d69a5
Updated WinCE support by Dmitry (with some tweaks)
Sam Lantinga <slouken@libsdl.org>
parents:
1433
diff
changeset
|
366 /* Need to include DllMain() on Watcom C for some reason.. */ |
1433
bb6839704ed6
SDL_windows.h is no longer necessary
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
367 #define WIN32_LEAN_AND_MEAN |
bb6839704ed6
SDL_windows.h is no longer necessary
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
368 #include <windows.h> |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
369 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
370 BOOL APIENTRY |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
371 _DllMainCRTStartup(HANDLE hModule, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
372 DWORD ul_reason_for_call, LPVOID lpReserved) |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
373 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
374 switch (ul_reason_for_call) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
375 case DLL_PROCESS_ATTACH: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
376 case DLL_THREAD_ATTACH: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
377 case DLL_THREAD_DETACH: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
378 case DLL_PROCESS_DETACH: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
379 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
380 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
381 return TRUE; |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
382 } |
1465
8dfa9a6d69a5
Updated WinCE support by Dmitry (with some tweaks)
Sam Lantinga <slouken@libsdl.org>
parents:
1433
diff
changeset
|
383 #endif /* building DLL with Watcom C */ |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
384 |
3269
a67a961e2171
Removed outdated OS/2 support
Sam Lantinga <slouken@libsdl.org>
parents:
3243
diff
changeset
|
385 #endif /* __WIN32__ */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
386 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1487
diff
changeset
|
387 /* vi: set ts=4 sw=4 expandtab: */ |