2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2010 Sam Lantinga
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
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
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 // 7/31/2010 Wei Mingzhi
23 // Removed everything unrated to Mac OS X Joystick support
25 #include "SDL_config.h"
27 /* Initialization code for SDL */
30 #include "haptic/SDL_haptic_c.h"
31 #include "joystick/SDL_joystick_c.h"
33 /* The initialized subsystems */
34 static Uint32 SDL_initialized = 0;
37 SDL_InitSubSystem(Uint32 flags)
39 /* Initialize the joystick subsystem */
40 if ((flags & SDL_INIT_JOYSTICK) && !(SDL_initialized & SDL_INIT_JOYSTICK)) {
41 if (SDL_JoystickInit() < 0) {
44 SDL_initialized |= SDL_INIT_JOYSTICK;
47 /* Initialize the haptic subsystem */
48 if ((flags & SDL_INIT_HAPTIC) && !(SDL_initialized & SDL_INIT_HAPTIC)) {
49 if (SDL_HapticInit() < 0) {
52 SDL_initialized |= SDL_INIT_HAPTIC;
59 SDL_Init(Uint32 flags)
61 /* Clear the error message */
64 /* Initialize the desired subsystems */
65 if (SDL_InitSubSystem(flags) < 0) {
73 SDL_QuitSubSystem(Uint32 flags)
75 /* Shut down requested initialized subsystems */
76 if ((flags & SDL_initialized & SDL_INIT_JOYSTICK)) {
78 SDL_initialized &= ~SDL_INIT_JOYSTICK;
81 if ((flags & SDL_initialized & SDL_INIT_HAPTIC)) {
83 SDL_initialized &= ~SDL_INIT_HAPTIC;
88 SDL_WasInit(Uint32 flags)
91 flags = SDL_INIT_EVERYTHING;
93 return (SDL_initialized & flags);
99 /* Quit all subsystems */
100 SDL_QuitSubSystem(SDL_INIT_EVERYTHING);