├── .gitignore ├── .gitmodules ├── README.md ├── agent_smith.nimble ├── examples ├── ex01_env_api.nim └── ex02_00_pong_cem.nim └── third_party ├── ale_build.nim ├── ale_wrap.nim ├── sdl └── include │ ├── SDL.h │ ├── SDL_active.h │ ├── SDL_audio.h │ ├── SDL_byteorder.h │ ├── SDL_cdrom.h │ ├── SDL_config.h │ ├── SDL_config.h.default │ ├── SDL_config.h.in │ ├── SDL_config_dreamcast.h │ ├── SDL_config_macos.h │ ├── SDL_config_macosx.h │ ├── SDL_config_minimal.h │ ├── SDL_config_nds.h │ ├── SDL_config_os2.h │ ├── SDL_config_symbian.h │ ├── SDL_config_win32.h │ ├── SDL_copying.h │ ├── SDL_cpuinfo.h │ ├── SDL_endian.h │ ├── SDL_error.h │ ├── SDL_events.h │ ├── SDL_getenv.h │ ├── SDL_joystick.h │ ├── SDL_keyboard.h │ ├── SDL_keysym.h │ ├── SDL_loadso.h │ ├── SDL_main.h │ ├── SDL_mouse.h │ ├── SDL_mutex.h │ ├── SDL_name.h │ ├── SDL_opengl.h │ ├── SDL_platform.h │ ├── SDL_quit.h │ ├── SDL_rwops.h │ ├── SDL_stdinc.h │ ├── SDL_syswm.h │ ├── SDL_thread.h │ ├── SDL_timer.h │ ├── SDL_types.h │ ├── SDL_version.h │ ├── SDL_video.h │ ├── begin_code.h │ ├── close_code.h │ └── doxyfile └── std_cpp.nim /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third_party/arcade_learning_environment"] 2 | path = third_party/arcade_learning_environment 3 | url = https://github.com/mgbellemare/Arcade-Learning-Environment 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Agent Smith 2 | 3 | A reinforcement learning environment for Nim 4 | 5 | ## Installation 6 | 7 | This requires SDL 1.2 8 | 9 | ### Mac 10 | 11 | ```shell 12 | brew install sdl 13 | ``` 14 | 15 | ### License 16 | 17 | This work is licensed under the [GNU General Public License v2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) 18 | 19 | This work statically builds: 20 | - the [Stella Atari emulator](https://stella-emu.github.io/) licensed under GPL2 21 | - the [Arcade Learning Environment](https://github.com/mgbellemare/Arcade-Learning-Environment) licensed under GPL2 22 | 23 | This work dynamically links against: 24 | - [SDL 1.2](https://www.libsdl.org/download-1.2.php) licensed under LGPL 2.1 25 | -------------------------------------------------------------------------------- /agent_smith.nimble: -------------------------------------------------------------------------------- 1 | # Agent Smith 2 | # Copyright (c) 2018-Present, Mamy André-Ratsimbazafy 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | 14 | packageName = "agent_smith" 15 | version = "0.0.1" 16 | author = "Mamy André-Ratsimbazafy" 17 | description = "Reinforcement learning on Atari" 18 | license = "Apache License 2.0" 19 | 20 | ### Dependencies 21 | requires "nim >= 0.19" 22 | 23 | ### Config 24 | when defined(windows): 25 | const libName = "ale.dll" 26 | elif defined(macosx): 27 | const libName = "libale.dylib" 28 | else: 29 | const libName = "libale.so" 30 | 31 | const sharedLib = "./third_party/ale_build.nim" 32 | 33 | ### Build 34 | task build_ale, "Build the dependency Arcade Learning Environment shared library": 35 | if not dirExists "build": 36 | mkDir "build" 37 | switch("out", "./build/" & libName) 38 | switch("define", "release") 39 | switch("app", "lib") 40 | switch("noMain") 41 | setCommand "cpp", sharedLib 42 | -------------------------------------------------------------------------------- /examples/ex01_env_api.nim: -------------------------------------------------------------------------------- 1 | # Agent Smith 2 | # Copyright (c) 2018-Present, Mamy André-Ratsimbazafy 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License version 2 6 | # as published by the Free Software Foundation. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | 13 | import 14 | os, random, strformat, 15 | ../third_party/[ale_wrap, std_cpp] 16 | 17 | # Compatible ROMs can be found at https://github.com/openai/atari-py/tree/master/atari_py/atari_roms 18 | proc main() = 19 | if paramCount() != 1: 20 | raise newException(ValueError, "Only 1 parameter is accepted, the path to an Atari ROM") 21 | 22 | let rom = paramStr(1) 23 | 24 | let ale = newALEInterface(display_screen = true) 25 | # Note: launching that from VSCode terminal doesn't display anything 26 | ale.setBool("sound", true) 27 | 28 | ale.setInt("random_seed", 123) # Reproducibility 29 | ale.setFloat("repeat_action_probability", 25) 30 | 31 | ale.loadROM(rom) 32 | let legal_actions = ale.getLegalActionSet() 33 | 34 | # Play 10 episodes 35 | for episode in 0 ..< 10: 36 | var totalReward = 0 37 | while not ale.game_over(): 38 | let a = legal_actions[rand(legal_actions.len)] 39 | let reward = ale.act(a) 40 | totalReward += reward 41 | echo &"Episode {episode} ended with score {totalReward}" 42 | ale.reset_game() 43 | 44 | quit QuitSuccess 45 | 46 | main() 47 | -------------------------------------------------------------------------------- /examples/ex02_00_pong_cem.nim: -------------------------------------------------------------------------------- 1 | # Agent Smith 2 | # Copyright (c) 2018-Present, Mamy André-Ratsimbazafy 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License version 2 6 | # as published by the Free Software Foundation. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | 13 | # Pong agent using Cross-Entropy Method 14 | # https://en.wikipedia.org/wiki/Cross-entropy_method 15 | # and 16 | # Learning Tetris Using the Noisy Cross-Entropy Method 17 | # 2006, Szita et al 18 | 19 | # The CEM formula is 20 | # 21 | # ActionWeights = Observations * Weight + bias 22 | # 23 | # Observations is of shape [Environment] 24 | # Weight is of shape [Environment, PotentialActions] 25 | # bias is of shape [PotentialActions] 26 | # 27 | # The result is a [PotentialActions] vector. 28 | # 29 | # Similar to NLP text generation softmax it 30 | # and sample it as a probability distribution 31 | # and choose the next action from it. 32 | 33 | import 34 | strformat, random, os, 35 | ../third_party/[ale_wrap, std_cpp], 36 | arraymancer # Need Arraymancer from December 2018 37 | 38 | randomize(0xDEADBEEF) # Set random seed for reproducibility 39 | 40 | # To speed up convergence, we allow only 3 actions 41 | # Note that this is introducing prior knowledge that the agent 42 | # doesn't have to discover. Ideally we shouldn't to have a general 43 | # algorithm 44 | type 45 | PongAction = enum 46 | DoNothing 47 | MoveUp 48 | MoveDown 49 | 50 | func toAction(pa: PongAction): Action {.inline.} = 51 | case pa 52 | of DoNothing: PLAYER_A_NOOP 53 | of MoveUp: PLAYER_A_UP 54 | of MoveDown: PLAYER_A_DOWN 55 | 56 | func screenToTensor(ale: ALEInterface): Tensor[float32] = 57 | ## The screen is of type byte/uint8 and shape 210x160x3 58 | ## (The x3 for RGB is handled via an internal color palette) 59 | ## We need to convert that to a flat [Environment] float32 vector 60 | ## Also for computational efficiency we should reduce the size. 61 | 62 | let screen = ale.getScreen() 63 | let height = screen.height 64 | let width = screen.width 65 | let size = height * width * 3 66 | 67 | # Directly write into the tensor buffer, with OpenAI color palette. 68 | var tmp = newTensorUninit[uint8](height, width, 3) 69 | ale.getScreenRGB_OpenAI(tmp.get_offset_ptr, size) 70 | 71 | # Set background to 0 and everything else to 1 72 | # This is probably faster to do this before downsampling 73 | # as memory accesses are contiguous this way. 74 | for val in tmp.mitems: 75 | if val in {144, 109}: val = 0 # 2 kinds of background 76 | else: val = 1 77 | 78 | # Now downsample the screen by skipping 1 every 2 pixel 79 | # and only keep a single color channel 80 | tmp = tmp[_.._|2, _.._|2, 0] 81 | 82 | # Convert to float32 and flatten 83 | result = tmp.astype(float32).reshape(tmp.size) 84 | 85 | type 86 | CEMParams = ref object 87 | mean: Tensor[float32] 88 | std: Tensor[float32] 89 | batchSize: int 90 | n_epochs: int 91 | # Ratio of the population kept at the end of the epoch 92 | eliteRatio: float32 93 | # Noise to prevent the agent from converging to fast 94 | noise: float32 95 | noiseDecay: float32 96 | 97 | # proc cem(ale: ALEInterface, params: CEMParams): float32 = 98 | # ## Return the mean of the final sampling ditribution 99 | 100 | # let n_elites = int(iniState.batchSize.float32 * iniState.eliteRatio) 101 | # var mean = iniState.mean 102 | # var std = ones 103 | 104 | proc main() = 105 | const rom = "build/roms/pong.bin" 106 | 107 | let ale = newALEInterface(display_screen = true) 108 | # Don't display anything for training 109 | ale.setBool("sound", false) # Sound of Pong is super annoying 110 | ale.setInt("random_seed", 123) # Reproducibility 111 | 112 | ale.loadROM(rom) 113 | let legal_actions = ale.getLegalActionSet() 114 | 115 | for episode in 0 ..< 5: 116 | echo &"Starting episode {episode}" 117 | let t = ale.screenToTensor() 118 | echo t[0 ..< 1000] 119 | var totalReward = 0 120 | while not ale.game_over(): 121 | let a = rand([MoveDown, MoveUp, DoNothing]).toAction 122 | let reward = ale.act(a) 123 | totalReward += reward 124 | echo &"Episode {episode} ended with score {totalReward}" 125 | ale.reset_game() 126 | 127 | ale.loadROM(rom) 128 | 129 | quit QuitSuccess 130 | 131 | main() 132 | -------------------------------------------------------------------------------- /third_party/ale_build.nim: -------------------------------------------------------------------------------- 1 | # Agent Smith 2 | # Copyright (c) 2018-Present, Mamy André-Ratsimbazafy 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License version 2 6 | # as published by the Free Software Foundation. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | 13 | # ############################################################ 14 | # 15 | # Build system 16 | # 17 | # ############################################################ 18 | 19 | # This file replaces CMake to build the Arcade Learning Environment DLL 20 | # We use a separate DLL because building the library is really slow (a minute or so) 21 | # Also CMake is much slower than Nim even for compiling + linking 22 | # and a mess to deal with. 23 | 24 | import strutils, ospaths 25 | from os import DirSep, walkFiles 26 | 27 | const cppSrcPath = currentSourcePath.rsplit(DirSep, 1)[0] & 28 | "/arcade_learning_environment/src/" 29 | 30 | # ############################################################ 31 | # 32 | # External links 33 | # 34 | # ############################################################ 35 | 36 | # {.warning: "Execution of a potentially unsafe command \"sdl-config\" to configure SDL".} 37 | # {.passC: "`sdl-config --cflags`".} # SDL 1.2 38 | # {.passL: "`sdl-config --libs`".} # SDL 1.2 39 | 40 | {.passC: "-I\"third_party/sdl/include\"".} 41 | {.passL: "-lSDL".} # {.passL: "-lSDLMain".} 42 | {.passL: "-lz".} # Zlib 43 | 44 | # when defined(osx): 45 | # {.passL: "-Wl,-framework,Cocoa".} 46 | 47 | # ############################################################ 48 | # 49 | # Compilation 50 | # 51 | # ############################################################ 52 | 53 | {.passC: "-D__USE_SDL -DSOUND_SUPPORT -std=c++11 -D__STDC_CONSTANT_MACROS".} 54 | 55 | {.passC: "-I\"" & cppSrcPath & "\"".} 56 | {.passC: "-I\"" & cppSrcPath & "common\"".} 57 | {.passC: "-I\"" & cppSrcPath & "controllers\"".} 58 | {.passC: "-I\"" & cppSrcPath & "emucore\"".} 59 | {.passC: "-I\"" & cppSrcPath & "emucore/m6502/src\"".} 60 | {.passC: "-I\"" & cppSrcPath & "emucore/m6502/src/bspf/src\"".} 61 | {.passC: "-I\"" & cppSrcPath & "environment\"".} 62 | {.passC: "-I\"" & cppSrcPath & "games\"".} 63 | {.passC: "-I\"" & cppSrcPath & "games/supported\"".} 64 | 65 | # Need to use relative paths - https://github.com/nim-lang/Nim/issues/9370 66 | const rel_path = "./arcade_learning_environment/src/" 67 | {.compile: (rel_path & "common/*.cpp", "ale_common_$#.o") .} 68 | {.compile: (rel_path & "common/*.cxx", "ale_common_$#.o") .} # But why? 69 | {.compile: (rel_path & "controllers/*.cpp", "ale_controller_$#.o") .} 70 | {.compile: (rel_path & "emucore/*.cxx", "ale_emucore_$#.o") .} 71 | {.compile: (rel_path & "emucore/m6502/src/*.cxx", "ale_emucore_m6502_$#.o") .} 72 | {.compile: (rel_path & "environment/*.cpp", "ale_environment_$#.o") .} 73 | {.compile: (rel_path & "games/*.cpp", "ale_games_$#.o") .} 74 | {.compile: (rel_path & "games/supported/*.cpp", "ale_games_supported_$#.o") .} 75 | # {.compile: rel_path & "external/TinyMT/tinymt32.c" .} # seems unused 76 | {.compile: rel_path & "ale_interface.cpp" .} 77 | 78 | {.passC: "-I\"" & cppSrcPath & "os_dependent\"".} 79 | when defined(windows): 80 | {.compile: (rel_path & "os_dependent/*Win32.cxx", "ale_os_$#Win32.o") .} 81 | else: 82 | {.compile: (rel_path & "os_dependent/*UNIX.cxx", "ale_os_$#UNIX.o") .} 83 | {.compile: (rel_path & "os_dependent/FSNodePOSIX.cxx", "ale_os_FSNodePOSIX.o") .} 84 | -------------------------------------------------------------------------------- /third_party/ale_wrap.nim: -------------------------------------------------------------------------------- 1 | # Agent Smith 2 | # Copyright (c) 2018-Present, Mamy André-Ratsimbazafy 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License version 2 6 | # as published by the Free Software Foundation. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | 13 | import 14 | strutils, ospaths, 15 | ./std_cpp 16 | from os import DirSep, walkFiles 17 | 18 | # ############################################################ 19 | # 20 | # Linking against the shared lib 21 | # 22 | # ############################################################ 23 | 24 | const buildPath = currentSourcePath.rsplit(DirSep, 1)[0] & 25 | "/../build/" 26 | 27 | # We assume that the dynamic library ends up in the same directory 28 | # as the Nim executable 29 | when defined(windows): 30 | const libName = "ale.dll" 31 | elif defined(macosx): 32 | const libName = "libale.dylib" 33 | else: 34 | const libName* = "libale.so" 35 | 36 | {.link: buildPath & libName.} 37 | # Make sure to build the DLL directly in ./build/libale.ext" 38 | # It contains a path and while compilation will work 39 | # runtime search will fail 40 | 41 | # ############################################################ 42 | # 43 | # Includes 44 | # 45 | # ############################################################ 46 | 47 | const cppSrcPath = currentSourcePath.rsplit(DirSep, 1)[0] & 48 | "/arcade_learning_environment/src/" 49 | 50 | {.passC: "-I\"" & cppSrcPath & "\"".} 51 | {.passC: "-I\"" & cppSrcPath & "common\"".} 52 | {.passC: "-I\"" & cppSrcPath & "controllers\"".} 53 | {.passC: "-I\"" & cppSrcPath & "emucore\"".} 54 | {.passC: "-I\"" & cppSrcPath & "emucore/m6502/src\"".} 55 | {.passC: "-I\"" & cppSrcPath & "emucore/m6502/src/bspf/src\"".} 56 | {.passC: "-I\"" & cppSrcPath & "environment\"".} 57 | {.passC: "-I\"" & cppSrcPath & "games\"".} 58 | {.passC: "-I\"" & cppSrcPath & "games/supported\"".} 59 | 60 | # ############################################################ 61 | # 62 | # ALE types 63 | # 64 | # ############################################################ 65 | 66 | type 67 | Action*{.importc, size: sizeof(int32), 68 | header: cppSrcPath & "common/Constants.h".} = enum 69 | PLAYER_A_NOOP = 0, PLAYER_A_FIRE = 1, PLAYER_A_UP = 2, PLAYER_A_RIGHT = 3, 70 | PLAYER_A_LEFT = 4, PLAYER_A_DOWN = 5, PLAYER_A_UPRIGHT = 6, PLAYER_A_UPLEFT = 7, 71 | PLAYER_A_DOWNRIGHT = 8, PLAYER_A_DOWNLEFT = 9, PLAYER_A_UPFIRE = 10, 72 | PLAYER_A_RIGHTFIRE = 11, PLAYER_A_LEFTFIRE = 12, PLAYER_A_DOWNFIRE = 13, 73 | PLAYER_A_UPRIGHTFIRE = 14, PLAYER_A_UPLEFTFIRE = 15, PLAYER_A_DOWNRIGHTFIRE = 16, 74 | PLAYER_A_DOWNLEFTFIRE = 17, PLAYER_B_NOOP = 18, PLAYER_B_FIRE = 19, PLAYER_B_UP = 20, 75 | PLAYER_B_RIGHT = 21, PLAYER_B_LEFT = 22, PLAYER_B_DOWN = 23, PLAYER_B_UPRIGHT = 24, 76 | PLAYER_B_UPLEFT = 25, PLAYER_B_DOWNRIGHT = 26, PLAYER_B_DOWNLEFT = 27, 77 | PLAYER_B_UPFIRE = 28, PLAYER_B_RIGHTFIRE = 29, PLAYER_B_LEFTFIRE = 30, 78 | PLAYER_B_DOWNFIRE = 31, PLAYER_B_UPRIGHTFIRE = 32, PLAYER_B_UPLEFTFIRE = 33, 79 | PLAYER_B_DOWNRIGHTFIRE = 34, PLAYER_B_DOWNLEFTFIRE = 35, RESET = 40, 80 | UNDEFINED = 41, RANDOM = 42, SAVE_STATE = 43, LOAD_STATE = 44, SYSTEM_RESET = 45, 81 | LAST_ACTION_INDEX = 50 82 | 83 | GameMode*{.importc:"game_mode_t", 84 | header: cppSrcPath & "common/Constants.h".} = uint32 85 | Difficulty*{.importc:"difficulty_t", 86 | header: cppSrcPath & "common/Constants.h".} = uint32 87 | Reward*{.importc:"reward_t", 88 | header: cppSrcPath & "common/Constants.h".} = int32 89 | ActionVect*{.importcpp, 90 | header: cppSrcPath & "common/Constants.h".} = CppVector[Action] 91 | ModeVect*{.importcpp, 92 | header: cppSrcPath & "common/Constants.h".} = CppVector[GameMode] 93 | DifficultyVect*{.importcpp, 94 | header: cppSrcPath & "common/Constants.h".} = CppVector[Difficulty] 95 | 96 | ALEInterface* {.importcpp:"ALEInterface", 97 | header: cppSrcPath & "ale_interface.hpp", 98 | byref.} = object 99 | theOSystem*{.importcpp.}: CppUniquePtr[OSystem] 100 | theSettings*{.importcpp.}: CppUniquePtr[Settings] 101 | romSettings*{.importcpp.}: CppUniquePtr[RomSettings] 102 | environment*{.importcpp.}: CppUniquePtr[StellaEnvironment] 103 | max_num_frames*: int32 ## Maximum number of frames for each episode 104 | 105 | OSystem {.importcpp, 106 | header: cppSrcPath & "emucore/OSystem.hxx", 107 | byref.} = object 108 | 109 | Settings {.importcpp, 110 | header: cppSrcPath & "emucore/Settings.hxx", 111 | byref.} = object 112 | 113 | RomSettings {.importcpp, 114 | header: cppSrcPath & "emucore/games/RomSettings.hxx", 115 | byref.} = object 116 | 117 | StellaEnvironment {.importcpp, 118 | header: cppSrcPath & "environment/stella_environment.hpp", 119 | byref.} = object 120 | 121 | ALEScreen* {.importcpp, 122 | header: cppSrcPath & "environment/stella_environment.hpp", 123 | byref.} = object 124 | 125 | Pixel*{.importcpp: "pixel_t", 126 | header: cppSrcPath & "environment/ale_screen.hpp".} = byte 127 | 128 | ALERam* {.importcpp, 129 | header: cppSrcPath & "environment/ale_ram.hpp", 130 | byref.} = object 131 | 132 | ALEState* {.importcpp, 133 | header: cppSrcPath & "environment/ale_state.hpp", 134 | byref.} = object 135 | 136 | ScreenExporter*{.importcpp, 137 | header: cppSrcPath & "common/ScreenExporter.hpp", 138 | byref.} = object 139 | 140 | # ############################################################ 141 | # 142 | # Procedures and methods 143 | # 144 | # ############################################################ 145 | 146 | {.push callConv: cdecl.} 147 | 148 | # ############################## 149 | # src/environment/ale_ram.hpp 150 | 151 | {.pragma: ale_ram, importcpp, header: cppSrcPath & "environment/ale_ram.hpp".} 152 | func get*(this: ALERam; x: uint32): byte {.ale_ram.} 153 | proc mut*(this: ALERam; x: uint32): ptr byte {.importcpp:"byte", header: cppSrcPath & "environment/ale_ram.hpp".} 154 | func array*(this: ALERam): ptr byte {.ale_ram.} 155 | func size*(this: ALERam): int {.ale_ram.} 156 | func equals*(this: ALERam; rhs: ALERam): bool {.ale_ram.} 157 | 158 | # ############################## 159 | # src/environment/ale_screen.hpp 160 | 161 | {.pragma: ale_screen, importcpp, header: cppSrcPath & "environment/ale_screen.hpp".} 162 | func get*(this: ALEScreen; r: int32; c: int32): Pixel {.ale_screen.} 163 | func mut*(this: ALEScreen; r: int32; c: int32): ptr Pixel {.importcpp:"pixel", header: cppSrcPath & "environment/ale_screen.hpp".} 164 | func getRow*(this: ALEScreen; r: int32): ptr Pixel {.ale_screen.} 165 | ## Row-major ordering, increase ptr by 1 for next column 166 | func getArray*(this: ALEScreen): ptr Pixel {.ale_screen.} 167 | func height*(this: ALEScreen): int {.ale_screen.} 168 | func width*(this: ALEScreen): int {.ale_screen.} 169 | func arraySize*(this: ALEScreen): int {.ale_screen.} 170 | func equals*(this: ALEScreen; rhs: ALEScreen): bool {.ale_screen.} 171 | 172 | # ############################## 173 | # src/common/ScreenExporter.hpp 174 | 175 | {.pragma: screen_exporter, cdecl, importcpp, header: cppSrcPath & "common/ScreenExporter.hpp".} 176 | proc save*(this: ScreenExporter; screen: ALEScreen; filename: CppString) {.screen_exporter.} 177 | proc saveNext*(this: ScreenExporter; screen: ALEScreen) {.screen_exporter.} 178 | 179 | # ############################## 180 | # src/ale_interface.hpp 181 | 182 | {.pragma: h_ale_interface, header: cppSrcPath & "ale_interface.hpp".} 183 | proc newALEInterface*(): ALEInterface {.h_ale_interface, importcpp:"new ALEInterface()", constructor.} 184 | # proc destroyALEInterface*(this: ALEInterface) 185 | proc newALEInterface*(display_screen: bool): ALEInterface {.h_ale_interface, importcpp:"new ALEInterface(#)", constructor.} 186 | # proc getString*(this: ALEInterface; key: CppString): CppString 187 | # proc getInt*(this: ALEInterface; key: CppString): int32 188 | # proc getBool*(this: ALEInterface; key: CppString): bool 189 | # proc getFloat*(this: ALEInterface; key: CppString): float32 190 | # proc setString*(this: ALEInterface; key: CppString; value: CppString) 191 | proc setInt*(this: ALEInterface; key: cstring; value: int32) {.h_ale_interface, importcpp:"#.setInt(@)".} 192 | proc setBool*(this: ALEInterface; key: cstring; value: bool) {.h_ale_interface, importcpp:"#.setBool(@)".} 193 | proc setFloat*(this: ALEInterface; key: cstring; value: float32) {.h_ale_interface, importcpp:"#.setFloat(@)".} 194 | proc loadROM*(this: ALEInterface; rom_file: cstring) {.h_ale_interface, importcpp:"#.loadROM(#)".} 195 | proc act*(this: ALEInterface; action: Action): Reward {.h_ale_interface, importcpp:"#.act(#)".} 196 | proc game_over*(this: ALEInterface): bool {.h_ale_interface, importcpp:"#.game_over()".} 197 | proc reset_game*(this: ALEInterface) {.h_ale_interface, importcpp:"#.reset_game()".} 198 | # proc getAvailableModes*(this: ALEInterface): ModeVect 199 | # proc setMode*(this: ALEInterface; m: GameMode) 200 | # proc getAvailableDifficulties*(this: ALEInterface): DifficultyVect 201 | # proc setDifficulty*(this: ALEInterface; m: Difficulty) 202 | proc getLegalActionSet*(this: ALEInterface): ActionVect {.h_ale_interface, importcpp:"#.getLegalActionSet()".} 203 | # proc getMinimalActionSet*(this: ALEInterface): ActionVect 204 | # proc getFrameNumber*(this: ALEInterface): int32 205 | # proc lives*(this: ALEInterface): int32 206 | # proc getEpisodeFrameNumber*(this: ALEInterface): int32 207 | proc getScreen*(this: ALEInterface): ALEScreen {.h_ale_interface, importcpp:"#.getScreen()".} 208 | # proc getScreenGrayscale*( 209 | # this: ALEInterface; 210 | # grayscale_output_buffer: CppVector[byte]) 211 | proc getScreenRGB*( 212 | this: ALEInterface; 213 | output_rgb_buffer: var CppVector[byte]) {.h_ale_interface, importcpp:"#.getScreenRGB(#)".} 214 | # proc getRAM*(this: ALEInterface): ALERam 215 | # proc saveState*(this: ALEInterface) 216 | # proc loadState*(this: ALEInterface) 217 | # proc cloneState*(this: ALEInterface): ALEState 218 | # proc restoreState*(this: ALEInterface; state: ALEState) 219 | # proc cloneSystemState*(this: ALEInterface): ALEState 220 | # proc restoreSystemState*(this: ALEInterface; state: ALEState) 221 | # proc saveScreenPNG*(this: ALEInterface; filename: CppString) 222 | # proc createScreenExporter*(this: ALEInterface; path: CppString): ptr ScreenExporter 223 | # proc welcomeMessage*(): CppString 224 | proc disableBufferedIO*() {.h_ale_interface, importcpp:"ALEInterface::disableBufferedIO()".} 225 | # proc createOSystem*(theOSystem: CppUniquePtr[OSystem]; 226 | # theSettings: CppUniquePtr[Settings]) 227 | # proc loadSettings*(romfile: string; theOSystem: CppUniquePtr[OSystem]) 228 | 229 | {.pop.} 230 | 231 | # ############################################################ 232 | # 233 | # End Wrapper 234 | # 235 | # ############################################################ 236 | 237 | # OpenAI alternative palette for image conversion 238 | 239 | const OpenAI_Palette: array[256, uint32] = [ 240 | 0x000000'u32, 0, 0x4a4a4a, 0, 0x6f6f6f, 0, 0x8e8e8e, 0, 241 | 0xaaaaaa, 0, 0xc0c0c0, 0, 0xd6d6d6, 0, 0xececec, 0, 242 | 0x484800, 0, 0x69690f, 0, 0x86861d, 0, 0xa2a22a, 0, 243 | 0xbbbb35, 0, 0xd2d240, 0, 0xe8e84a, 0, 0xfcfc54, 0, 244 | 0x7c2c00, 0, 0x904811, 0, 0xa26221, 0, 0xb47a30, 0, 245 | 0xc3903d, 0, 0xd2a44a, 0, 0xdfb755, 0, 0xecc860, 0, 246 | 0x901c00, 0, 0xa33915, 0, 0xb55328, 0, 0xc66c3a, 0, 247 | 0xd5824a, 0, 0xe39759, 0, 0xf0aa67, 0, 0xfcbc74, 0, 248 | 0x940000, 0, 0xa71a1a, 0, 0xb83232, 0, 0xc84848, 0, 249 | 0xd65c5c, 0, 0xe46f6f, 0, 0xf08080, 0, 0xfc9090, 0, 250 | 0x840064, 0, 0x97197a, 0, 0xa8308f, 0, 0xb846a2, 0, 251 | 0xc659b3, 0, 0xd46cc3, 0, 0xe07cd2, 0, 0xec8ce0, 0, 252 | 0x500084, 0, 0x68199a, 0, 0x7d30ad, 0, 0x9246c0, 0, 253 | 0xa459d0, 0, 0xb56ce0, 0, 0xc57cee, 0, 0xd48cfc, 0, 254 | 0x140090, 0, 0x331aa3, 0, 0x4e32b5, 0, 0x6848c6, 0, 255 | 0x7f5cd5, 0, 0x956fe3, 0, 0xa980f0, 0, 0xbc90fc, 0, 256 | 0x000094, 0, 0x181aa7, 0, 0x2d32b8, 0, 0x4248c8, 0, 257 | 0x545cd6, 0, 0x656fe4, 0, 0x7580f0, 0, 0x8490fc, 0, 258 | 0x001c88, 0, 0x183b9d, 0, 0x2d57b0, 0, 0x4272c2, 0, 259 | 0x548ad2, 0, 0x65a0e1, 0, 0x75b5ef, 0, 0x84c8fc, 0, 260 | 0x003064, 0, 0x185080, 0, 0x2d6d98, 0, 0x4288b0, 0, 261 | 0x54a0c5, 0, 0x65b7d9, 0, 0x75cceb, 0, 0x84e0fc, 0, 262 | 0x004030, 0, 0x18624e, 0, 0x2d8169, 0, 0x429e82, 0, 263 | 0x54b899, 0, 0x65d1ae, 0, 0x75e7c2, 0, 0x84fcd4, 0, 264 | 0x004400, 0, 0x1a661a, 0, 0x328432, 0, 0x48a048, 0, 265 | 0x5cba5c, 0, 0x6fd26f, 0, 0x80e880, 0, 0x90fc90, 0, 266 | 0x143c00, 0, 0x355f18, 0, 0x527e2d, 0, 0x6e9c42, 0, 267 | 0x87b754, 0, 0x9ed065, 0, 0xb4e775, 0, 0xc8fc84, 0, 268 | 0x303800, 0, 0x505916, 0, 0x6d762b, 0, 0x88923e, 0, 269 | 0xa0ab4f, 0, 0xb7c25f, 0, 0xccd86e, 0, 0xe0ec7c, 0, 270 | 0x482c00, 0, 0x694d14, 0, 0x866a26, 0, 0xa28638, 0, 271 | 0xbb9f47, 0, 0xd2b656, 0, 0xe8cc63, 0, 0xfce070, 0 272 | ] 273 | 274 | proc getScreenRGB_OpenAI*( 275 | ale: ALEInterface; 276 | output_rgb_buffer: ptr byte, len: int) = 277 | # The output buffer must be allocated of the proper size 278 | 279 | let w = ale.getScreen.width 280 | let h = ale.getScreen.height 281 | let screen_size = w * h 282 | doAssert len == screen_size * 3 283 | 284 | when not defined(vcc): 285 | {.pragma: restrict, codegenDecl: "$# __restrict__ $#".} 286 | else: 287 | {.pragma: restrict, codegenDecl: "$# __restrict $#".} 288 | 289 | let screen{.restrict.} = cast[ptr UncheckedArray[byte]](ale.getScreen.getArray) 290 | let output{.restrict.} = cast[ptr UncheckedArray[byte]](output_rgb_buffer) 291 | 292 | var j = 0 293 | for i in 0 ..< screen_size: 294 | let zrgb = OpenAI_Palette[screen[i]] 295 | output[j] = byte(zrgb shr 16) 296 | j += 1 297 | output[j] = byte(zrgb shr 8) 298 | j += 1 299 | output[j] = byte zrgb 300 | j += 1 301 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL.h 24 | * Main include header for the SDL library 25 | */ 26 | 27 | #ifndef _SDL_H 28 | #define _SDL_H 29 | 30 | #include "SDL_main.h" 31 | #include "SDL_stdinc.h" 32 | #include "SDL_audio.h" 33 | #include "SDL_cdrom.h" 34 | #include "SDL_cpuinfo.h" 35 | #include "SDL_endian.h" 36 | #include "SDL_error.h" 37 | #include "SDL_events.h" 38 | #include "SDL_loadso.h" 39 | #include "SDL_mutex.h" 40 | #include "SDL_rwops.h" 41 | #include "SDL_thread.h" 42 | #include "SDL_timer.h" 43 | #include "SDL_video.h" 44 | #include "SDL_version.h" 45 | 46 | #include "begin_code.h" 47 | /* Set up for C function definitions, even when using C++ */ 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** @file SDL.h 53 | * @note As of version 0.5, SDL is loaded dynamically into the application 54 | */ 55 | 56 | /** @name SDL_INIT Flags 57 | * These are the flags which may be passed to SDL_Init() -- you should 58 | * specify the subsystems which you will be using in your application. 59 | */ 60 | /*@{*/ 61 | #define SDL_INIT_TIMER 0x00000001 62 | #define SDL_INIT_AUDIO 0x00000010 63 | #define SDL_INIT_VIDEO 0x00000020 64 | #define SDL_INIT_CDROM 0x00000100 65 | #define SDL_INIT_JOYSTICK 0x00000200 66 | #define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */ 67 | #define SDL_INIT_EVENTTHREAD 0x01000000 /**< Not supported on all OS's */ 68 | #define SDL_INIT_EVERYTHING 0x0000FFFF 69 | /*@}*/ 70 | 71 | /** This function loads the SDL dynamically linked library and initializes 72 | * the subsystems specified by 'flags' (and those satisfying dependencies) 73 | * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup 74 | * signal handlers for some commonly ignored fatal signals (like SIGSEGV) 75 | */ 76 | extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); 77 | 78 | /** This function initializes specific SDL subsystems */ 79 | extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); 80 | 81 | /** This function cleans up specific SDL subsystems */ 82 | extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); 83 | 84 | /** This function returns mask of the specified subsystems which have 85 | * been initialized. 86 | * If 'flags' is 0, it returns a mask of all initialized subsystems. 87 | */ 88 | extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); 89 | 90 | /** This function cleans up all initialized subsystems and unloads the 91 | * dynamically linked library. You should call it upon all exit conditions. 92 | */ 93 | extern DECLSPEC void SDLCALL SDL_Quit(void); 94 | 95 | /* Ends C function definitions when using C++ */ 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | #include "close_code.h" 100 | 101 | #endif /* _SDL_H */ 102 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_active.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_active.h 25 | * Include file for SDL application focus event handling 26 | */ 27 | 28 | #ifndef _SDL_active_h 29 | #define _SDL_active_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @name The available application states */ 41 | /*@{*/ 42 | #define SDL_APPMOUSEFOCUS 0x01 /**< The app has mouse coverage */ 43 | #define SDL_APPINPUTFOCUS 0x02 /**< The app has input focus */ 44 | #define SDL_APPACTIVE 0x04 /**< The application is active */ 45 | /*@}*/ 46 | 47 | /* Function prototypes */ 48 | /** 49 | * This function returns the current state of the application, which is a 50 | * bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and 51 | * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to 52 | * see your application, otherwise it has been iconified or disabled. 53 | */ 54 | extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void); 55 | 56 | 57 | /* Ends C function definitions when using C++ */ 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | #include "close_code.h" 62 | 63 | #endif /* _SDL_active_h */ 64 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_audio.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_audio.h 25 | * Access to the raw audio mixing buffer for the SDL library 26 | */ 27 | 28 | #ifndef _SDL_audio_h 29 | #define _SDL_audio_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_endian.h" 34 | #include "SDL_mutex.h" 35 | #include "SDL_thread.h" 36 | #include "SDL_rwops.h" 37 | 38 | #include "begin_code.h" 39 | /* Set up for C function definitions, even when using C++ */ 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /** 45 | * When filling in the desired audio spec structure, 46 | * - 'desired->freq' should be the desired audio frequency in samples-per-second. 47 | * - 'desired->format' should be the desired audio format. 48 | * - 'desired->samples' is the desired size of the audio buffer, in samples. 49 | * This number should be a power of two, and may be adjusted by the audio 50 | * driver to a value more suitable for the hardware. Good values seem to 51 | * range between 512 and 8096 inclusive, depending on the application and 52 | * CPU speed. Smaller values yield faster response time, but can lead 53 | * to underflow if the application is doing heavy processing and cannot 54 | * fill the audio buffer in time. A stereo sample consists of both right 55 | * and left channels in LR ordering. 56 | * Note that the number of samples is directly related to time by the 57 | * following formula: ms = (samples*1000)/freq 58 | * - 'desired->size' is the size in bytes of the audio buffer, and is 59 | * calculated by SDL_OpenAudio(). 60 | * - 'desired->silence' is the value used to set the buffer to silence, 61 | * and is calculated by SDL_OpenAudio(). 62 | * - 'desired->callback' should be set to a function that will be called 63 | * when the audio device is ready for more data. It is passed a pointer 64 | * to the audio buffer, and the length in bytes of the audio buffer. 65 | * This function usually runs in a separate thread, and so you should 66 | * protect data structures that it accesses by calling SDL_LockAudio() 67 | * and SDL_UnlockAudio() in your code. 68 | * - 'desired->userdata' is passed as the first parameter to your callback 69 | * function. 70 | * 71 | * @note The calculated values in this structure are calculated by SDL_OpenAudio() 72 | * 73 | */ 74 | typedef struct SDL_AudioSpec { 75 | int freq; /**< DSP frequency -- samples per second */ 76 | Uint16 format; /**< Audio data format */ 77 | Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ 78 | Uint8 silence; /**< Audio buffer silence value (calculated) */ 79 | Uint16 samples; /**< Audio buffer size in samples (power of 2) */ 80 | Uint16 padding; /**< Necessary for some compile environments */ 81 | Uint32 size; /**< Audio buffer size in bytes (calculated) */ 82 | /** 83 | * This function is called when the audio device needs more data. 84 | * 85 | * @param[out] stream A pointer to the audio data buffer 86 | * @param[in] len The length of the audio buffer in bytes. 87 | * 88 | * Once the callback returns, the buffer will no longer be valid. 89 | * Stereo samples are stored in a LRLRLR ordering. 90 | */ 91 | void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len); 92 | void *userdata; 93 | } SDL_AudioSpec; 94 | 95 | /** 96 | * @name Audio format flags 97 | * defaults to LSB byte order 98 | */ 99 | /*@{*/ 100 | #define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ 101 | #define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ 102 | #define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ 103 | #define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ 104 | #define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */ 105 | #define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ 106 | #define AUDIO_U16 AUDIO_U16LSB 107 | #define AUDIO_S16 AUDIO_S16LSB 108 | 109 | /** 110 | * @name Native audio byte ordering 111 | */ 112 | /*@{*/ 113 | #if SDL_BYTEORDER == SDL_LIL_ENDIAN 114 | #define AUDIO_U16SYS AUDIO_U16LSB 115 | #define AUDIO_S16SYS AUDIO_S16LSB 116 | #else 117 | #define AUDIO_U16SYS AUDIO_U16MSB 118 | #define AUDIO_S16SYS AUDIO_S16MSB 119 | #endif 120 | /*@}*/ 121 | 122 | /*@}*/ 123 | 124 | 125 | /** A structure to hold a set of audio conversion filters and buffers */ 126 | typedef struct SDL_AudioCVT { 127 | int needed; /**< Set to 1 if conversion possible */ 128 | Uint16 src_format; /**< Source audio format */ 129 | Uint16 dst_format; /**< Target audio format */ 130 | double rate_incr; /**< Rate conversion increment */ 131 | Uint8 *buf; /**< Buffer to hold entire audio data */ 132 | int len; /**< Length of original audio buffer */ 133 | int len_cvt; /**< Length of converted audio buffer */ 134 | int len_mult; /**< buffer must be len*len_mult big */ 135 | double len_ratio; /**< Given len, final size is len*len_ratio */ 136 | void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format); 137 | int filter_index; /**< Current audio conversion function */ 138 | } SDL_AudioCVT; 139 | 140 | 141 | /* Function prototypes */ 142 | 143 | /** 144 | * @name Audio Init and Quit 145 | * These functions are used internally, and should not be used unless you 146 | * have a specific need to specify the audio driver you want to use. 147 | * You should normally use SDL_Init() or SDL_InitSubSystem(). 148 | */ 149 | /*@{*/ 150 | extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); 151 | extern DECLSPEC void SDLCALL SDL_AudioQuit(void); 152 | /*@}*/ 153 | 154 | /** 155 | * This function fills the given character buffer with the name of the 156 | * current audio driver, and returns a pointer to it if the audio driver has 157 | * been initialized. It returns NULL if no driver has been initialized. 158 | */ 159 | extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen); 160 | 161 | /** 162 | * This function opens the audio device with the desired parameters, and 163 | * returns 0 if successful, placing the actual hardware parameters in the 164 | * structure pointed to by 'obtained'. If 'obtained' is NULL, the audio 165 | * data passed to the callback function will be guaranteed to be in the 166 | * requested format, and will be automatically converted to the hardware 167 | * audio format if necessary. This function returns -1 if it failed 168 | * to open the audio device, or couldn't set up the audio thread. 169 | * 170 | * The audio device starts out playing silence when it's opened, and should 171 | * be enabled for playing by calling SDL_PauseAudio(0) when you are ready 172 | * for your audio callback function to be called. Since the audio driver 173 | * may modify the requested size of the audio buffer, you should allocate 174 | * any local mixing buffers after you open the audio device. 175 | * 176 | * @sa SDL_AudioSpec 177 | */ 178 | extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained); 179 | 180 | typedef enum { 181 | SDL_AUDIO_STOPPED = 0, 182 | SDL_AUDIO_PLAYING, 183 | SDL_AUDIO_PAUSED 184 | } SDL_audiostatus; 185 | 186 | /** Get the current audio state */ 187 | extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void); 188 | 189 | /** 190 | * This function pauses and unpauses the audio callback processing. 191 | * It should be called with a parameter of 0 after opening the audio 192 | * device to start playing sound. This is so you can safely initialize 193 | * data for your callback function after opening the audio device. 194 | * Silence will be written to the audio device during the pause. 195 | */ 196 | extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); 197 | 198 | /** 199 | * This function loads a WAVE from the data source, automatically freeing 200 | * that source if 'freesrc' is non-zero. For example, to load a WAVE file, 201 | * you could do: 202 | * @code SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); @endcode 203 | * 204 | * If this function succeeds, it returns the given SDL_AudioSpec, 205 | * filled with the audio data format of the wave data, and sets 206 | * 'audio_buf' to a malloc()'d buffer containing the audio data, 207 | * and sets 'audio_len' to the length of that audio buffer, in bytes. 208 | * You need to free the audio buffer with SDL_FreeWAV() when you are 209 | * done with it. 210 | * 211 | * This function returns NULL and sets the SDL error message if the 212 | * wave file cannot be opened, uses an unknown data format, or is 213 | * corrupt. Currently raw and MS-ADPCM WAVE files are supported. 214 | */ 215 | extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); 216 | 217 | /** Compatibility convenience function -- loads a WAV from a file */ 218 | #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ 219 | SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) 220 | 221 | /** 222 | * This function frees data previously allocated with SDL_LoadWAV_RW() 223 | */ 224 | extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf); 225 | 226 | /** 227 | * This function takes a source format and rate and a destination format 228 | * and rate, and initializes the 'cvt' structure with information needed 229 | * by SDL_ConvertAudio() to convert a buffer of audio data from one format 230 | * to the other. 231 | * 232 | * @return This function returns 0, or -1 if there was an error. 233 | */ 234 | extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt, 235 | Uint16 src_format, Uint8 src_channels, int src_rate, 236 | Uint16 dst_format, Uint8 dst_channels, int dst_rate); 237 | 238 | /** 239 | * Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(), 240 | * created an audio buffer cvt->buf, and filled it with cvt->len bytes of 241 | * audio data in the source format, this function will convert it in-place 242 | * to the desired format. 243 | * The data conversion may expand the size of the audio data, so the buffer 244 | * cvt->buf should be allocated after the cvt structure is initialized by 245 | * SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long. 246 | */ 247 | extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt); 248 | 249 | 250 | #define SDL_MIX_MAXVOLUME 128 251 | /** 252 | * This takes two audio buffers of the playing audio format and mixes 253 | * them, performing addition, volume adjustment, and overflow clipping. 254 | * The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME 255 | * for full audio volume. Note this does not change hardware volume. 256 | * This is provided for convenience -- you can mix your own audio data. 257 | */ 258 | extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume); 259 | 260 | /** 261 | * @name Audio Locks 262 | * The lock manipulated by these functions protects the callback function. 263 | * During a LockAudio/UnlockAudio pair, you can be guaranteed that the 264 | * callback function is not running. Do not call these from the callback 265 | * function or you will cause deadlock. 266 | */ 267 | /*@{*/ 268 | extern DECLSPEC void SDLCALL SDL_LockAudio(void); 269 | extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); 270 | /*@}*/ 271 | 272 | /** 273 | * This function shuts down audio processing and closes the audio device. 274 | */ 275 | extern DECLSPEC void SDLCALL SDL_CloseAudio(void); 276 | 277 | 278 | /* Ends C function definitions when using C++ */ 279 | #ifdef __cplusplus 280 | } 281 | #endif 282 | #include "close_code.h" 283 | 284 | #endif /* _SDL_audio_h */ 285 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_byteorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_byteorder.h 25 | * @deprecated Use SDL_endian.h instead 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_endian.h" 30 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_cdrom.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_cdrom.h 25 | * This is the CD-audio control API for Simple DirectMedia Layer 26 | */ 27 | 28 | #ifndef _SDL_cdrom_h 29 | #define _SDL_cdrom_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * @file SDL_cdrom.h 42 | * In order to use these functions, SDL_Init() must have been called 43 | * with the SDL_INIT_CDROM flag. This causes SDL to scan the system 44 | * for CD-ROM drives, and load appropriate drivers. 45 | */ 46 | 47 | /** The maximum number of CD-ROM tracks on a disk */ 48 | #define SDL_MAX_TRACKS 99 49 | 50 | /** @name Track Types 51 | * The types of CD-ROM track possible 52 | */ 53 | /*@{*/ 54 | #define SDL_AUDIO_TRACK 0x00 55 | #define SDL_DATA_TRACK 0x04 56 | /*@}*/ 57 | 58 | /** The possible states which a CD-ROM drive can be in. */ 59 | typedef enum { 60 | CD_TRAYEMPTY, 61 | CD_STOPPED, 62 | CD_PLAYING, 63 | CD_PAUSED, 64 | CD_ERROR = -1 65 | } CDstatus; 66 | 67 | /** Given a status, returns true if there's a disk in the drive */ 68 | #define CD_INDRIVE(status) ((int)(status) > 0) 69 | 70 | typedef struct SDL_CDtrack { 71 | Uint8 id; /**< Track number */ 72 | Uint8 type; /**< Data or audio track */ 73 | Uint16 unused; 74 | Uint32 length; /**< Length, in frames, of this track */ 75 | Uint32 offset; /**< Offset, in frames, from start of disk */ 76 | } SDL_CDtrack; 77 | 78 | /** This structure is only current as of the last call to SDL_CDStatus() */ 79 | typedef struct SDL_CD { 80 | int id; /**< Private drive identifier */ 81 | CDstatus status; /**< Current drive status */ 82 | 83 | /** The rest of this structure is only valid if there's a CD in drive */ 84 | /*@{*/ 85 | int numtracks; /**< Number of tracks on disk */ 86 | int cur_track; /**< Current track position */ 87 | int cur_frame; /**< Current frame offset within current track */ 88 | SDL_CDtrack track[SDL_MAX_TRACKS+1]; 89 | /*@}*/ 90 | } SDL_CD; 91 | 92 | /** @name Frames / MSF Conversion Functions 93 | * Conversion functions from frames to Minute/Second/Frames and vice versa 94 | */ 95 | /*@{*/ 96 | #define CD_FPS 75 97 | #define FRAMES_TO_MSF(f, M,S,F) { \ 98 | int value = f; \ 99 | *(F) = value%CD_FPS; \ 100 | value /= CD_FPS; \ 101 | *(S) = value%60; \ 102 | value /= 60; \ 103 | *(M) = value; \ 104 | } 105 | #define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F)) 106 | /*@}*/ 107 | 108 | /* CD-audio API functions: */ 109 | 110 | /** 111 | * Returns the number of CD-ROM drives on the system, or -1 if 112 | * SDL_Init() has not been called with the SDL_INIT_CDROM flag. 113 | */ 114 | extern DECLSPEC int SDLCALL SDL_CDNumDrives(void); 115 | 116 | /** 117 | * Returns a human-readable, system-dependent identifier for the CD-ROM. 118 | * Example: 119 | * - "/dev/cdrom" 120 | * - "E:" 121 | * - "/dev/disk/ide/1/master" 122 | */ 123 | extern DECLSPEC const char * SDLCALL SDL_CDName(int drive); 124 | 125 | /** 126 | * Opens a CD-ROM drive for access. It returns a drive handle on success, 127 | * or NULL if the drive was invalid or busy. This newly opened CD-ROM 128 | * becomes the default CD used when other CD functions are passed a NULL 129 | * CD-ROM handle. 130 | * Drives are numbered starting with 0. Drive 0 is the system default CD-ROM. 131 | */ 132 | extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive); 133 | 134 | /** 135 | * This function returns the current status of the given drive. 136 | * If the drive has a CD in it, the table of contents of the CD and current 137 | * play position of the CD will be stored in the SDL_CD structure. 138 | */ 139 | extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom); 140 | 141 | /** 142 | * Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' 143 | * tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play 144 | * until the end of the CD. This function will skip data tracks. 145 | * This function should only be called after calling SDL_CDStatus() to 146 | * get track information about the CD. 147 | * For example: 148 | * @code 149 | * // Play entire CD: 150 | * if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) 151 | * SDL_CDPlayTracks(cdrom, 0, 0, 0, 0); 152 | * // Play last track: 153 | * if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) { 154 | * SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0); 155 | * } 156 | * // Play first and second track and 10 seconds of third track: 157 | * if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) 158 | * SDL_CDPlayTracks(cdrom, 0, 0, 2, 10); 159 | * @endcode 160 | * 161 | * @return This function returns 0, or -1 if there was an error. 162 | */ 163 | extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom, 164 | int start_track, int start_frame, int ntracks, int nframes); 165 | 166 | /** 167 | * Play the given CD starting at 'start' frame for 'length' frames. 168 | * @return It returns 0, or -1 if there was an error. 169 | */ 170 | extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length); 171 | 172 | /** Pause play 173 | * @return returns 0, or -1 on error 174 | */ 175 | extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom); 176 | 177 | /** Resume play 178 | * @return returns 0, or -1 on error 179 | */ 180 | extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom); 181 | 182 | /** Stop play 183 | * @return returns 0, or -1 on error 184 | */ 185 | extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom); 186 | 187 | /** Eject CD-ROM 188 | * @return returns 0, or -1 on error 189 | */ 190 | extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom); 191 | 192 | /** Closes the handle for the CD-ROM drive */ 193 | extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom); 194 | 195 | 196 | /* Ends C function definitions when using C++ */ 197 | #ifdef __cplusplus 198 | } 199 | #endif 200 | #include "close_code.h" 201 | 202 | #endif /* _SDL_video_h */ 203 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_h 24 | #define _SDL_config_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* Add any platform that doesn't build using the configure system */ 29 | #if defined(__DREAMCAST__) 30 | #include "SDL_config_dreamcast.h" 31 | #elif defined(__MACOS__) 32 | #include "SDL_config_macos.h" 33 | #elif defined(__MACOSX__) 34 | #include "SDL_config_macosx.h" 35 | #elif defined(__SYMBIAN32__) 36 | #include "SDL_config_symbian.h" /* must be before win32! */ 37 | #elif defined(__WIN32__) 38 | #include "SDL_config_win32.h" 39 | #elif defined(__OS2__) 40 | #include "SDL_config_os2.h" 41 | #else 42 | #include "SDL_config_minimal.h" 43 | #endif /* platform config */ 44 | 45 | #endif /* _SDL_config_h */ 46 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_config.h.default: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_h 24 | #define _SDL_config_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* Add any platform that doesn't build using the configure system */ 29 | #if defined(__DREAMCAST__) 30 | #include "SDL_config_dreamcast.h" 31 | #elif defined(__MACOS__) 32 | #include "SDL_config_macos.h" 33 | #elif defined(__MACOSX__) 34 | #include "SDL_config_macosx.h" 35 | #elif defined(__SYMBIAN32__) 36 | #include "SDL_config_symbian.h" /* must be before win32! */ 37 | #elif defined(__WIN32__) 38 | #include "SDL_config_win32.h" 39 | #elif defined(__OS2__) 40 | #include "SDL_config_os2.h" 41 | #else 42 | #include "SDL_config_minimal.h" 43 | #endif /* platform config */ 44 | 45 | #endif /* _SDL_config_h */ 46 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_config.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_h 24 | #define _SDL_config_h 25 | 26 | /* This is a set of defines to configure the SDL features */ 27 | 28 | /* General platform specific identifiers */ 29 | #include "SDL_platform.h" 30 | 31 | /* Make sure that this isn't included by Visual C++ */ 32 | #ifdef _MSC_VER 33 | #error You should copy include/SDL_config.h.default to include/SDL_config.h 34 | #endif 35 | 36 | /* C language features */ 37 | #undef const 38 | #undef inline 39 | #undef volatile 40 | 41 | /* C datatypes */ 42 | #undef size_t 43 | #undef int8_t 44 | #undef uint8_t 45 | #undef int16_t 46 | #undef uint16_t 47 | #undef int32_t 48 | #undef uint32_t 49 | #undef int64_t 50 | #undef uint64_t 51 | #undef uintptr_t 52 | #undef SDL_HAS_64BIT_TYPE 53 | 54 | /* Endianness */ 55 | #undef SDL_BYTEORDER 56 | 57 | /* Comment this if you want to build without any C library requirements */ 58 | #undef HAVE_LIBC 59 | #if HAVE_LIBC 60 | 61 | /* Useful headers */ 62 | #undef HAVE_ALLOCA_H 63 | #undef HAVE_SYS_TYPES_H 64 | #undef HAVE_STDIO_H 65 | #undef STDC_HEADERS 66 | #undef HAVE_STDLIB_H 67 | #undef HAVE_STDARG_H 68 | #undef HAVE_MALLOC_H 69 | #undef HAVE_MEMORY_H 70 | #undef HAVE_STRING_H 71 | #undef HAVE_STRINGS_H 72 | #undef HAVE_INTTYPES_H 73 | #undef HAVE_STDINT_H 74 | #undef HAVE_CTYPE_H 75 | #undef HAVE_MATH_H 76 | #undef HAVE_ICONV_H 77 | #undef HAVE_SIGNAL_H 78 | #undef HAVE_ALTIVEC_H 79 | 80 | /* C library functions */ 81 | #undef HAVE_MALLOC 82 | #undef HAVE_CALLOC 83 | #undef HAVE_REALLOC 84 | #undef HAVE_FREE 85 | #undef HAVE_ALLOCA 86 | #ifndef _WIN32 /* Don't use C runtime versions of these on Windows */ 87 | #undef HAVE_GETENV 88 | #undef HAVE_PUTENV 89 | #undef HAVE_UNSETENV 90 | #endif 91 | #undef HAVE_QSORT 92 | #undef HAVE_ABS 93 | #undef HAVE_BCOPY 94 | #undef HAVE_MEMSET 95 | #undef HAVE_MEMCPY 96 | #undef HAVE_MEMMOVE 97 | #undef HAVE_MEMCMP 98 | #undef HAVE_STRLEN 99 | #undef HAVE_STRLCPY 100 | #undef HAVE_STRLCAT 101 | #undef HAVE_STRDUP 102 | #undef HAVE__STRREV 103 | #undef HAVE__STRUPR 104 | #undef HAVE__STRLWR 105 | #undef HAVE_INDEX 106 | #undef HAVE_RINDEX 107 | #undef HAVE_STRCHR 108 | #undef HAVE_STRRCHR 109 | #undef HAVE_STRSTR 110 | #undef HAVE_ITOA 111 | #undef HAVE__LTOA 112 | #undef HAVE__UITOA 113 | #undef HAVE__ULTOA 114 | #undef HAVE_STRTOL 115 | #undef HAVE_STRTOUL 116 | #undef HAVE__I64TOA 117 | #undef HAVE__UI64TOA 118 | #undef HAVE_STRTOLL 119 | #undef HAVE_STRTOULL 120 | #undef HAVE_STRTOD 121 | #undef HAVE_ATOI 122 | #undef HAVE_ATOF 123 | #undef HAVE_STRCMP 124 | #undef HAVE_STRNCMP 125 | #undef HAVE__STRICMP 126 | #undef HAVE_STRCASECMP 127 | #undef HAVE__STRNICMP 128 | #undef HAVE_STRNCASECMP 129 | #undef HAVE_SSCANF 130 | #undef HAVE_SNPRINTF 131 | #undef HAVE_VSNPRINTF 132 | #undef HAVE_ICONV 133 | #undef HAVE_SIGACTION 134 | #undef HAVE_SA_SIGACTION 135 | #undef HAVE_SETJMP 136 | #undef HAVE_NANOSLEEP 137 | #undef HAVE_CLOCK_GETTIME 138 | #undef HAVE_GETPAGESIZE 139 | #undef HAVE_MPROTECT 140 | #undef HAVE_SEM_TIMEDWAIT 141 | 142 | #else 143 | /* We may need some replacement for stdarg.h here */ 144 | #include 145 | #endif /* HAVE_LIBC */ 146 | 147 | /* Allow disabling of core subsystems */ 148 | #undef SDL_AUDIO_DISABLED 149 | #undef SDL_CDROM_DISABLED 150 | #undef SDL_CPUINFO_DISABLED 151 | #undef SDL_EVENTS_DISABLED 152 | #undef SDL_FILE_DISABLED 153 | #undef SDL_JOYSTICK_DISABLED 154 | #undef SDL_LOADSO_DISABLED 155 | #undef SDL_THREADS_DISABLED 156 | #undef SDL_TIMERS_DISABLED 157 | #undef SDL_VIDEO_DISABLED 158 | 159 | /* Enable various audio drivers */ 160 | #undef SDL_AUDIO_DRIVER_ALSA 161 | #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC 162 | #undef SDL_AUDIO_DRIVER_ARTS 163 | #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC 164 | #undef SDL_AUDIO_DRIVER_BAUDIO 165 | #undef SDL_AUDIO_DRIVER_BSD 166 | #undef SDL_AUDIO_DRIVER_COREAUDIO 167 | #undef SDL_AUDIO_DRIVER_DART 168 | #undef SDL_AUDIO_DRIVER_DC 169 | #undef SDL_AUDIO_DRIVER_DISK 170 | #undef SDL_AUDIO_DRIVER_DUMMY 171 | #undef SDL_AUDIO_DRIVER_DMEDIA 172 | #undef SDL_AUDIO_DRIVER_DSOUND 173 | #undef SDL_AUDIO_DRIVER_PULSE 174 | #undef SDL_AUDIO_DRIVER_PULSE_DYNAMIC 175 | #undef SDL_AUDIO_DRIVER_ESD 176 | #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC 177 | #undef SDL_AUDIO_DRIVER_MINT 178 | #undef SDL_AUDIO_DRIVER_MMEAUDIO 179 | #undef SDL_AUDIO_DRIVER_NAS 180 | #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC 181 | #undef SDL_AUDIO_DRIVER_OSS 182 | #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 183 | #undef SDL_AUDIO_DRIVER_PAUD 184 | #undef SDL_AUDIO_DRIVER_QNXNTO 185 | #undef SDL_AUDIO_DRIVER_SNDMGR 186 | #undef SDL_AUDIO_DRIVER_SUNAUDIO 187 | #undef SDL_AUDIO_DRIVER_WAVEOUT 188 | 189 | /* Enable various cdrom drivers */ 190 | #undef SDL_CDROM_AIX 191 | #undef SDL_CDROM_BEOS 192 | #undef SDL_CDROM_BSDI 193 | #undef SDL_CDROM_DC 194 | #undef SDL_CDROM_DUMMY 195 | #undef SDL_CDROM_FREEBSD 196 | #undef SDL_CDROM_LINUX 197 | #undef SDL_CDROM_MACOS 198 | #undef SDL_CDROM_MACOSX 199 | #undef SDL_CDROM_MINT 200 | #undef SDL_CDROM_OPENBSD 201 | #undef SDL_CDROM_OS2 202 | #undef SDL_CDROM_OSF 203 | #undef SDL_CDROM_QNX 204 | #undef SDL_CDROM_WIN32 205 | 206 | /* Enable various input drivers */ 207 | #undef SDL_INPUT_LINUXEV 208 | #undef SDL_INPUT_TSLIB 209 | #undef SDL_JOYSTICK_BEOS 210 | #undef SDL_JOYSTICK_DC 211 | #undef SDL_JOYSTICK_DUMMY 212 | #undef SDL_JOYSTICK_IOKIT 213 | #undef SDL_JOYSTICK_LINUX 214 | #undef SDL_JOYSTICK_MACOS 215 | #undef SDL_JOYSTICK_MINT 216 | #undef SDL_JOYSTICK_OS2 217 | #undef SDL_JOYSTICK_RISCOS 218 | #undef SDL_JOYSTICK_WINMM 219 | #undef SDL_JOYSTICK_USBHID 220 | #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H 221 | 222 | /* Enable various shared object loading systems */ 223 | #undef SDL_LOADSO_BEOS 224 | #undef SDL_LOADSO_DLCOMPAT 225 | #undef SDL_LOADSO_DLOPEN 226 | #undef SDL_LOADSO_DUMMY 227 | #undef SDL_LOADSO_LDG 228 | #undef SDL_LOADSO_MACOS 229 | #undef SDL_LOADSO_OS2 230 | #undef SDL_LOADSO_WIN32 231 | 232 | /* Enable various threading systems */ 233 | #undef SDL_THREAD_BEOS 234 | #undef SDL_THREAD_DC 235 | #undef SDL_THREAD_OS2 236 | #undef SDL_THREAD_PTH 237 | #undef SDL_THREAD_PTHREAD 238 | #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 239 | #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 240 | #undef SDL_THREAD_SPROC 241 | #undef SDL_THREAD_WIN32 242 | 243 | /* Enable various timer systems */ 244 | #undef SDL_TIMER_BEOS 245 | #undef SDL_TIMER_DC 246 | #undef SDL_TIMER_DUMMY 247 | #undef SDL_TIMER_MACOS 248 | #undef SDL_TIMER_MINT 249 | #undef SDL_TIMER_OS2 250 | #undef SDL_TIMER_RISCOS 251 | #undef SDL_TIMER_UNIX 252 | #undef SDL_TIMER_WIN32 253 | #undef SDL_TIMER_WINCE 254 | 255 | /* Enable various video drivers */ 256 | #undef SDL_VIDEO_DRIVER_AALIB 257 | #undef SDL_VIDEO_DRIVER_BWINDOW 258 | #undef SDL_VIDEO_DRIVER_CACA 259 | #undef SDL_VIDEO_DRIVER_DC 260 | #undef SDL_VIDEO_DRIVER_DDRAW 261 | #undef SDL_VIDEO_DRIVER_DGA 262 | #undef SDL_VIDEO_DRIVER_DIRECTFB 263 | #undef SDL_VIDEO_DRIVER_DRAWSPROCKET 264 | #undef SDL_VIDEO_DRIVER_DUMMY 265 | #undef SDL_VIDEO_DRIVER_FBCON 266 | #undef SDL_VIDEO_DRIVER_GAPI 267 | #undef SDL_VIDEO_DRIVER_GEM 268 | #undef SDL_VIDEO_DRIVER_GGI 269 | #undef SDL_VIDEO_DRIVER_IPOD 270 | #undef SDL_VIDEO_DRIVER_NANOX 271 | #undef SDL_VIDEO_DRIVER_OS2FS 272 | #undef SDL_VIDEO_DRIVER_PHOTON 273 | #undef SDL_VIDEO_DRIVER_PICOGUI 274 | #undef SDL_VIDEO_DRIVER_PS2GS 275 | #undef SDL_VIDEO_DRIVER_PS3 276 | #undef SDL_VIDEO_DRIVER_QTOPIA 277 | #undef SDL_VIDEO_DRIVER_QUARTZ 278 | #undef SDL_VIDEO_DRIVER_RISCOS 279 | #undef SDL_VIDEO_DRIVER_SVGALIB 280 | #undef SDL_VIDEO_DRIVER_TOOLBOX 281 | #undef SDL_VIDEO_DRIVER_VGL 282 | #undef SDL_VIDEO_DRIVER_WINDIB 283 | #undef SDL_VIDEO_DRIVER_WSCONS 284 | #undef SDL_VIDEO_DRIVER_X11 285 | #undef SDL_VIDEO_DRIVER_X11_DGAMOUSE 286 | #undef SDL_VIDEO_DRIVER_X11_DYNAMIC 287 | #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT 288 | #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR 289 | #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER 290 | #undef SDL_VIDEO_DRIVER_X11_VIDMODE 291 | #undef SDL_VIDEO_DRIVER_X11_XINERAMA 292 | #undef SDL_VIDEO_DRIVER_X11_XME 293 | #undef SDL_VIDEO_DRIVER_X11_XRANDR 294 | #undef SDL_VIDEO_DRIVER_X11_XV 295 | #undef SDL_VIDEO_DRIVER_XBIOS 296 | 297 | /* Enable OpenGL support */ 298 | #undef SDL_VIDEO_OPENGL 299 | #undef SDL_VIDEO_OPENGL_GLX 300 | #undef SDL_VIDEO_OPENGL_WGL 301 | #undef SDL_VIDEO_OPENGL_OSMESA 302 | #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC 303 | 304 | /* Disable screensaver */ 305 | #undef SDL_VIDEO_DISABLE_SCREENSAVER 306 | 307 | /* Enable assembly routines */ 308 | #undef SDL_ASSEMBLY_ROUTINES 309 | #undef SDL_HERMES_BLITTERS 310 | #undef SDL_ALTIVEC_BLITTERS 311 | 312 | #endif /* _SDL_config_h */ 313 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_config_dreamcast.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_dreamcast_h 24 | #define _SDL_config_dreamcast_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | typedef signed char int8_t; 31 | typedef unsigned char uint8_t; 32 | typedef signed short int16_t; 33 | typedef unsigned short uint16_t; 34 | typedef signed int int32_t; 35 | typedef unsigned int uint32_t; 36 | typedef signed long long int64_t; 37 | typedef unsigned long long uint64_t; 38 | typedef unsigned long uintptr_t; 39 | #define SDL_HAS_64BIT_TYPE 1 40 | 41 | /* Useful headers */ 42 | #define HAVE_SYS_TYPES_H 1 43 | #define HAVE_STDIO_H 1 44 | #define STDC_HEADERS 1 45 | #define HAVE_STRING_H 1 46 | #define HAVE_CTYPE_H 1 47 | 48 | /* C library functions */ 49 | #define HAVE_MALLOC 1 50 | #define HAVE_CALLOC 1 51 | #define HAVE_REALLOC 1 52 | #define HAVE_FREE 1 53 | #define HAVE_ALLOCA 1 54 | #define HAVE_GETENV 1 55 | #define HAVE_PUTENV 1 56 | #define HAVE_QSORT 1 57 | #define HAVE_ABS 1 58 | #define HAVE_BCOPY 1 59 | #define HAVE_MEMSET 1 60 | #define HAVE_MEMCPY 1 61 | #define HAVE_MEMMOVE 1 62 | #define HAVE_MEMCMP 1 63 | #define HAVE_STRLEN 1 64 | #define HAVE_STRDUP 1 65 | #define HAVE_INDEX 1 66 | #define HAVE_RINDEX 1 67 | #define HAVE_STRCHR 1 68 | #define HAVE_STRRCHR 1 69 | #define HAVE_STRSTR 1 70 | #define HAVE_STRTOL 1 71 | #define HAVE_STRTOD 1 72 | #define HAVE_ATOI 1 73 | #define HAVE_ATOF 1 74 | #define HAVE_STRCMP 1 75 | #define HAVE_STRNCMP 1 76 | #define HAVE_STRICMP 1 77 | #define HAVE_STRCASECMP 1 78 | #define HAVE_SSCANF 1 79 | #define HAVE_SNPRINTF 1 80 | #define HAVE_VSNPRINTF 1 81 | 82 | /* Enable various audio drivers */ 83 | #define SDL_AUDIO_DRIVER_DC 1 84 | #define SDL_AUDIO_DRIVER_DISK 1 85 | #define SDL_AUDIO_DRIVER_DUMMY 1 86 | 87 | /* Enable various cdrom drivers */ 88 | #define SDL_CDROM_DC 1 89 | 90 | /* Enable various input drivers */ 91 | #define SDL_JOYSTICK_DC 1 92 | 93 | /* Enable various shared object loading systems */ 94 | #define SDL_LOADSO_DUMMY 1 95 | 96 | /* Enable various threading systems */ 97 | #define SDL_THREAD_DC 1 98 | 99 | /* Enable various timer systems */ 100 | #define SDL_TIMER_DC 1 101 | 102 | /* Enable various video drivers */ 103 | #define SDL_VIDEO_DRIVER_DC 1 104 | #define SDL_VIDEO_DRIVER_DUMMY 1 105 | 106 | #endif /* _SDL_config_dreamcast_h */ 107 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_config_macos.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_macos_h 24 | #define _SDL_config_macos_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | #include 31 | 32 | typedef SInt8 int8_t; 33 | typedef UInt8 uint8_t; 34 | typedef SInt16 int16_t; 35 | typedef UInt16 uint16_t; 36 | typedef SInt32 int32_t; 37 | typedef UInt32 uint32_t; 38 | typedef SInt64 int64_t; 39 | typedef UInt64 uint64_t; 40 | typedef unsigned long uintptr_t; 41 | 42 | #define SDL_HAS_64BIT_TYPE 1 43 | 44 | /* Useful headers */ 45 | #define HAVE_STDIO_H 1 46 | #define STDC_HEADERS 1 47 | #define HAVE_STRING_H 1 48 | #define HAVE_CTYPE_H 1 49 | #define HAVE_MATH_H 1 50 | #define HAVE_SIGNAL_H 1 51 | 52 | /* C library functions */ 53 | #define HAVE_MALLOC 1 54 | #define HAVE_CALLOC 1 55 | #define HAVE_REALLOC 1 56 | #define HAVE_FREE 1 57 | #define HAVE_ALLOCA 1 58 | #define HAVE_ABS 1 59 | #define HAVE_MEMSET 1 60 | #define HAVE_MEMCPY 1 61 | #define HAVE_MEMMOVE 1 62 | #define HAVE_MEMCMP 1 63 | #define HAVE_STRLEN 1 64 | #define HAVE_STRCHR 1 65 | #define HAVE_STRRCHR 1 66 | #define HAVE_STRSTR 1 67 | #define HAVE_ITOA 1 68 | #define HAVE_STRTOL 1 69 | #define HAVE_STRTOD 1 70 | #define HAVE_ATOI 1 71 | #define HAVE_ATOF 1 72 | #define HAVE_STRCMP 1 73 | #define HAVE_STRNCMP 1 74 | #define HAVE_SSCANF 1 75 | 76 | /* Enable various audio drivers */ 77 | #define SDL_AUDIO_DRIVER_SNDMGR 1 78 | #define SDL_AUDIO_DRIVER_DISK 1 79 | #define SDL_AUDIO_DRIVER_DUMMY 1 80 | 81 | /* Enable various cdrom drivers */ 82 | #if TARGET_API_MAC_CARBON 83 | #define SDL_CDROM_DUMMY 1 84 | #else 85 | #define SDL_CDROM_MACOS 1 86 | #endif 87 | 88 | /* Enable various input drivers */ 89 | #if TARGET_API_MAC_CARBON 90 | #define SDL_JOYSTICK_DUMMY 1 91 | #else 92 | #define SDL_JOYSTICK_MACOS 1 93 | #endif 94 | 95 | /* Enable various shared object loading systems */ 96 | #define SDL_LOADSO_MACOS 1 97 | 98 | /* Enable various threading systems */ 99 | #define SDL_THREADS_DISABLED 1 100 | 101 | /* Enable various timer systems */ 102 | #define SDL_TIMER_MACOS 1 103 | 104 | /* Enable various video drivers */ 105 | #define SDL_VIDEO_DRIVER_DUMMY 1 106 | #define SDL_VIDEO_DRIVER_DRAWSPROCKET 1 107 | #define SDL_VIDEO_DRIVER_TOOLBOX 1 108 | 109 | /* Enable OpenGL support */ 110 | #define SDL_VIDEO_OPENGL 1 111 | 112 | #endif /* _SDL_config_macos_h */ 113 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_config_macosx.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_macosx_h 24 | #define _SDL_config_macosx_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ 29 | #include 30 | 31 | /* This is a set of defines to configure the SDL features */ 32 | 33 | #define SDL_HAS_64BIT_TYPE 1 34 | 35 | /* Useful headers */ 36 | /* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */ 37 | #if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) ) 38 | #define HAVE_ALLOCA_H 1 39 | #endif 40 | #define HAVE_SYS_TYPES_H 1 41 | #define HAVE_STDIO_H 1 42 | #define STDC_HEADERS 1 43 | #define HAVE_STRING_H 1 44 | #define HAVE_INTTYPES_H 1 45 | #define HAVE_STDINT_H 1 46 | #define HAVE_CTYPE_H 1 47 | #define HAVE_MATH_H 1 48 | #define HAVE_SIGNAL_H 1 49 | 50 | /* C library functions */ 51 | #define HAVE_MALLOC 1 52 | #define HAVE_CALLOC 1 53 | #define HAVE_REALLOC 1 54 | #define HAVE_FREE 1 55 | #define HAVE_ALLOCA 1 56 | #define HAVE_GETENV 1 57 | #define HAVE_PUTENV 1 58 | #define HAVE_UNSETENV 1 59 | #define HAVE_QSORT 1 60 | #define HAVE_ABS 1 61 | #define HAVE_BCOPY 1 62 | #define HAVE_MEMSET 1 63 | #define HAVE_MEMCPY 1 64 | #define HAVE_MEMMOVE 1 65 | #define HAVE_MEMCMP 1 66 | #define HAVE_STRLEN 1 67 | #define HAVE_STRLCPY 1 68 | #define HAVE_STRLCAT 1 69 | #define HAVE_STRDUP 1 70 | #define HAVE_STRCHR 1 71 | #define HAVE_STRRCHR 1 72 | #define HAVE_STRSTR 1 73 | #define HAVE_STRTOL 1 74 | #define HAVE_STRTOUL 1 75 | #define HAVE_STRTOLL 1 76 | #define HAVE_STRTOULL 1 77 | #define HAVE_STRTOD 1 78 | #define HAVE_ATOI 1 79 | #define HAVE_ATOF 1 80 | #define HAVE_STRCMP 1 81 | #define HAVE_STRNCMP 1 82 | #define HAVE_STRCASECMP 1 83 | #define HAVE_STRNCASECMP 1 84 | #define HAVE_SSCANF 1 85 | #define HAVE_SNPRINTF 1 86 | #define HAVE_VSNPRINTF 1 87 | #define HAVE_SIGACTION 1 88 | #define HAVE_SETJMP 1 89 | #define HAVE_NANOSLEEP 1 90 | 91 | /* Enable various audio drivers */ 92 | #define SDL_AUDIO_DRIVER_COREAUDIO 1 93 | #define SDL_AUDIO_DRIVER_DISK 1 94 | #define SDL_AUDIO_DRIVER_DUMMY 1 95 | 96 | /* Enable various cdrom drivers */ 97 | #define SDL_CDROM_MACOSX 1 98 | 99 | /* Enable various input drivers */ 100 | #define SDL_JOYSTICK_IOKIT 1 101 | 102 | /* Enable various shared object loading systems */ 103 | #ifdef __ppc__ 104 | /* For Mac OS X 10.2 compatibility */ 105 | #define SDL_LOADSO_DLCOMPAT 1 106 | #else 107 | #define SDL_LOADSO_DLOPEN 1 108 | #endif 109 | 110 | /* Enable various threading systems */ 111 | #define SDL_THREAD_PTHREAD 1 112 | #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 113 | 114 | /* Enable various timer systems */ 115 | #define SDL_TIMER_UNIX 1 116 | 117 | /* Enable various video drivers */ 118 | #define SDL_VIDEO_DRIVER_DUMMY 1 119 | #if ((defined TARGET_API_MAC_CARBON) && (TARGET_API_MAC_CARBON)) 120 | #define SDL_VIDEO_DRIVER_TOOLBOX 1 121 | #else 122 | #define SDL_VIDEO_DRIVER_QUARTZ 1 123 | #endif 124 | #define SDL_VIDEO_DRIVER_DGA 1 125 | #define SDL_VIDEO_DRIVER_X11 1 126 | #define SDL_VIDEO_DRIVER_X11_DGAMOUSE 1 127 | #define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" 128 | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" 129 | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" 130 | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER "/usr/X11R6/lib/libXrender.1.dylib" 131 | #define SDL_VIDEO_DRIVER_X11_VIDMODE 1 132 | #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 133 | #define SDL_VIDEO_DRIVER_X11_XME 1 134 | #define SDL_VIDEO_DRIVER_X11_XRANDR 1 135 | #define SDL_VIDEO_DRIVER_X11_XV 1 136 | 137 | /* Enable OpenGL support */ 138 | #define SDL_VIDEO_OPENGL 1 139 | #define SDL_VIDEO_OPENGL_GLX 1 140 | 141 | /* Disable screensaver */ 142 | #define SDL_VIDEO_DISABLE_SCREENSAVER 1 143 | 144 | /* Enable assembly routines */ 145 | #define SDL_ASSEMBLY_ROUTINES 1 146 | #ifdef __ppc__ 147 | #define SDL_ALTIVEC_BLITTERS 1 148 | #endif 149 | 150 | #endif /* _SDL_config_macosx_h */ 151 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_config_minimal.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_minimal_h 24 | #define _SDL_config_minimal_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is the minimal configuration that can be used to build SDL */ 29 | 30 | #include 31 | 32 | typedef signed char int8_t; 33 | typedef unsigned char uint8_t; 34 | typedef signed short int16_t; 35 | typedef unsigned short uint16_t; 36 | typedef signed int int32_t; 37 | typedef unsigned int uint32_t; 38 | typedef unsigned int size_t; 39 | typedef unsigned long uintptr_t; 40 | 41 | /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ 42 | #define SDL_AUDIO_DRIVER_DUMMY 1 43 | 44 | /* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */ 45 | #define SDL_CDROM_DISABLED 1 46 | 47 | /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ 48 | #define SDL_JOYSTICK_DISABLED 1 49 | 50 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 51 | #define SDL_LOADSO_DISABLED 1 52 | 53 | /* Enable the stub thread support (src/thread/generic/\*.c) */ 54 | #define SDL_THREADS_DISABLED 1 55 | 56 | /* Enable the stub timer support (src/timer/dummy/\*.c) */ 57 | #define SDL_TIMERS_DISABLED 1 58 | 59 | /* Enable the dummy video driver (src/video/dummy/\*.c) */ 60 | #define SDL_VIDEO_DRIVER_DUMMY 1 61 | 62 | #endif /* _SDL_config_minimal_h */ 63 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_config_nds.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_nds_h 24 | #define _SDL_config_nds_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | /* General platform specific identifiers */ 31 | #include "SDL_platform.h" 32 | 33 | /* C datatypes */ 34 | #define SDL_HAS_64BIT_TYPE 1 35 | 36 | /* Endianness */ 37 | #define SDL_BYTEORDER 1234 38 | 39 | /* Useful headers */ 40 | #define HAVE_ALLOCA_H 1 41 | #define HAVE_SYS_TYPES_H 1 42 | #define HAVE_STDIO_H 1 43 | #define STDC_HEADERS 1 44 | #define HAVE_STDLIB_H 1 45 | #define HAVE_STDARG_H 1 46 | #define HAVE_MALLOC_H 1 47 | #define HAVE_STRING_H 1 48 | #define HAVE_INTTYPES_H 1 49 | #define HAVE_STDINT_H 1 50 | #define HAVE_CTYPE_H 1 51 | #define HAVE_MATH_H 1 52 | #define HAVE_ICONV_H 1 53 | #define HAVE_SIGNAL_H 1 54 | 55 | /* C library functions */ 56 | #define HAVE_MALLOC 1 57 | #define HAVE_CALLOC 1 58 | #define HAVE_REALLOC 1 59 | #define HAVE_FREE 1 60 | #define HAVE_ALLOCA 1 61 | #define HAVE_GETENV 1 62 | #define HAVE_PUTENV 1 63 | #define HAVE_UNSETENV 1 64 | #define HAVE_QSORT 1 65 | #define HAVE_ABS 1 66 | #define HAVE_BCOPY 1 67 | #define HAVE_MEMSET 1 68 | #define HAVE_MEMCPY 1 69 | #define HAVE_MEMMOVE 1 70 | #define HAVE_STRLEN 1 71 | #define HAVE_STRLCPY 1 72 | #define HAVE_STRLCAT 1 73 | #define HAVE_STRDUP 1 74 | #define HAVE_STRCHR 1 75 | #define HAVE_STRRCHR 1 76 | #define HAVE_STRSTR 1 77 | #define HAVE_STRTOL 1 78 | #define HAVE_STRTOUL 1 79 | #define HAVE_STRTOLL 1 80 | #define HAVE_STRTOULL 1 81 | #define HAVE_ATOI 1 82 | #define HAVE_ATOF 1 83 | #define HAVE_STRCMP 1 84 | #define HAVE_STRNCMP 1 85 | #define HAVE_STRCASECMP 1 86 | #define HAVE_STRNCASECMP 1 87 | #define HAVE_SSCANF 1 88 | #define HAVE_SNPRINTF 1 89 | #define HAVE_VSNPRINTF 1 90 | #define HAVE_SETJMP 1 91 | 92 | /* Enable various audio drivers */ 93 | #define SDL_AUDIO_DRIVER_NDS 1 94 | #define SDL_AUDIO_DRIVER_DUMMY 1 95 | 96 | /* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */ 97 | #define SDL_CDROM_DISABLED 1 98 | 99 | /* Enable various input drivers */ 100 | #define SDL_JOYSTICK_NDS 1 101 | 102 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 103 | #define SDL_LOADSO_DISABLED 1 104 | 105 | /* Enable the stub thread support (src/thread/generic/\*.c) */ 106 | #define SDL_THREADS_DISABLED 1 107 | 108 | /* Enable various timer systems */ 109 | #define SDL_TIMER_NDS 1 110 | 111 | /* Enable various video drivers */ 112 | #define SDL_VIDEO_DRIVER_NDS 1 113 | #define SDL_VIDEO_DRIVER_DUMMY 1 114 | 115 | #endif /* _SDL_config_nds_h */ 116 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_config_os2.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_os2_h 24 | #define _SDL_config_os2_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | typedef signed char int8_t; 31 | typedef unsigned char uint8_t; 32 | typedef signed short int16_t; 33 | typedef unsigned short uint16_t; 34 | typedef signed int int32_t; 35 | typedef unsigned int uint32_t; 36 | typedef unsigned int size_t; 37 | typedef unsigned long uintptr_t; 38 | typedef signed long long int64_t; 39 | typedef unsigned long long uint64_t; 40 | 41 | #define SDL_HAS_64BIT_TYPE 1 42 | 43 | /* Use Watcom's LIBC */ 44 | #define HAVE_LIBC 1 45 | 46 | /* Useful headers */ 47 | #define HAVE_SYS_TYPES_H 1 48 | #define HAVE_STDIO_H 1 49 | #define STDC_HEADERS 1 50 | #define HAVE_STDLIB_H 1 51 | #define HAVE_STDARG_H 1 52 | #define HAVE_MALLOC_H 1 53 | #define HAVE_MEMORY_H 1 54 | #define HAVE_STRING_H 1 55 | #define HAVE_STRINGS_H 1 56 | #define HAVE_INTTYPES_H 1 57 | #define HAVE_STDINT_H 1 58 | #define HAVE_CTYPE_H 1 59 | #define HAVE_MATH_H 1 60 | #define HAVE_SIGNAL_H 1 61 | 62 | /* C library functions */ 63 | #define HAVE_MALLOC 1 64 | #define HAVE_CALLOC 1 65 | #define HAVE_REALLOC 1 66 | #define HAVE_FREE 1 67 | #define HAVE_ALLOCA 1 68 | #define HAVE_GETENV 1 69 | #define HAVE_PUTENV 1 70 | #define HAVE_UNSETENV 1 71 | #define HAVE_QSORT 1 72 | #define HAVE_ABS 1 73 | #define HAVE_BCOPY 1 74 | #define HAVE_MEMSET 1 75 | #define HAVE_MEMCPY 1 76 | #define HAVE_MEMMOVE 1 77 | #define HAVE_MEMCMP 1 78 | #define HAVE_STRLEN 1 79 | #define HAVE_STRLCPY 1 80 | #define HAVE_STRLCAT 1 81 | #define HAVE_STRDUP 1 82 | #define HAVE__STRREV 1 83 | #define HAVE__STRUPR 1 84 | #define HAVE__STRLWR 1 85 | #define HAVE_INDEX 1 86 | #define HAVE_RINDEX 1 87 | #define HAVE_STRCHR 1 88 | #define HAVE_STRRCHR 1 89 | #define HAVE_STRSTR 1 90 | #define HAVE_ITOA 1 91 | #define HAVE__LTOA 1 92 | #define HAVE__UITOA 1 93 | #define HAVE__ULTOA 1 94 | #define HAVE_STRTOL 1 95 | #define HAVE__I64TOA 1 96 | #define HAVE__UI64TOA 1 97 | #define HAVE_STRTOLL 1 98 | #define HAVE_STRTOD 1 99 | #define HAVE_ATOI 1 100 | #define HAVE_ATOF 1 101 | #define HAVE_STRCMP 1 102 | #define HAVE_STRNCMP 1 103 | #define HAVE_STRICMP 1 104 | #define HAVE_STRCASECMP 1 105 | #define HAVE_SSCANF 1 106 | #define HAVE_SNPRINTF 1 107 | #define HAVE_VSNPRINTF 1 108 | #define HAVE_SETJMP 1 109 | #define HAVE_CLOCK_GETTIME 1 110 | 111 | /* Enable various audio drivers */ 112 | #define SDL_AUDIO_DRIVER_DART 1 113 | #define SDL_AUDIO_DRIVER_DISK 1 114 | #define SDL_AUDIO_DRIVER_DUMMY 1 115 | 116 | /* Enable various cdrom drivers */ 117 | #define SDL_CDROM_OS2 1 118 | 119 | /* Enable various input drivers */ 120 | #define SDL_JOYSTICK_OS2 1 121 | 122 | /* Enable various shared object loading systems */ 123 | #define SDL_LOADSO_OS2 1 124 | 125 | /* Enable various threading systems */ 126 | #define SDL_THREAD_OS2 1 127 | 128 | /* Enable various timer systems */ 129 | #define SDL_TIMER_OS2 1 130 | 131 | /* Enable various video drivers */ 132 | #define SDL_VIDEO_DRIVER_DUMMY 1 133 | #define SDL_VIDEO_DRIVER_OS2FS 1 134 | 135 | /* Enable OpenGL support */ 136 | /* Nothing here yet for OS/2... :( */ 137 | 138 | /* Enable assembly routines where available */ 139 | #define SDL_ASSEMBLY_ROUTINES 1 140 | 141 | #endif /* _SDL_config_os2_h */ 142 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_config_symbian.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* 24 | 25 | Symbian version Markus Mertama 26 | 27 | */ 28 | 29 | 30 | #ifndef _SDL_CONFIG_SYMBIAN_H 31 | #define _SDL_CONFIG_SYMBIAN_H 32 | 33 | #include "SDL_platform.h" 34 | 35 | /* This is the minimal configuration that can be used to build SDL */ 36 | 37 | 38 | #include 39 | #include 40 | 41 | 42 | #ifdef __GCCE__ 43 | #define SYMBIAN32_GCCE 44 | #endif 45 | 46 | #ifndef _SIZE_T_DEFINED 47 | typedef unsigned int size_t; 48 | #endif 49 | 50 | #ifndef _INTPTR_T_DECLARED 51 | typedef unsigned int uintptr_t; 52 | #endif 53 | 54 | #ifndef _INT8_T_DECLARED 55 | typedef signed char int8_t; 56 | #endif 57 | 58 | #ifndef _UINT8_T_DECLARED 59 | typedef unsigned char uint8_t; 60 | #endif 61 | 62 | #ifndef _INT16_T_DECLARED 63 | typedef signed short int16_t; 64 | #endif 65 | 66 | #ifndef _UINT16_T_DECLARED 67 | typedef unsigned short uint16_t; 68 | #endif 69 | 70 | #ifndef _INT32_T_DECLARED 71 | typedef signed int int32_t; 72 | #endif 73 | 74 | #ifndef _UINT32_T_DECLARED 75 | typedef unsigned int uint32_t; 76 | #endif 77 | 78 | #ifndef _INT64_T_DECLARED 79 | typedef signed long long int64_t; 80 | #endif 81 | 82 | #ifndef _UINT64_T_DECLARED 83 | typedef unsigned long long uint64_t; 84 | #endif 85 | 86 | #define SDL_AUDIO_DRIVER_EPOCAUDIO 1 87 | 88 | 89 | /* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */ 90 | #define SDL_CDROM_DISABLED 1 91 | 92 | /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ 93 | #define SDL_JOYSTICK_DISABLED 1 94 | 95 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 96 | #define SDL_LOADSO_DISABLED 1 97 | 98 | #define SDL_THREAD_SYMBIAN 1 99 | 100 | #define SDL_VIDEO_DRIVER_EPOC 1 101 | 102 | #define SDL_VIDEO_OPENGL 0 103 | 104 | #define SDL_HAS_64BIT_TYPE 1 105 | 106 | #define HAVE_LIBC 1 107 | #define HAVE_STDIO_H 1 108 | #define STDC_HEADERS 1 109 | #define HAVE_STRING_H 1 110 | #define HAVE_CTYPE_H 1 111 | #define HAVE_MATH_H 1 112 | 113 | #define HAVE_MALLOC 1 114 | #define HAVE_CALLOC 1 115 | #define HAVE_REALLOC 1 116 | #define HAVE_FREE 1 117 | /*#define HAVE_ALLOCA 1*/ 118 | #define HAVE_QSORT 1 119 | #define HAVE_ABS 1 120 | #define HAVE_MEMSET 1 121 | #define HAVE_MEMCPY 1 122 | #define HAVE_MEMMOVE 1 123 | #define HAVE_MEMCMP 1 124 | #define HAVE_STRLEN 1 125 | #define HAVE__STRUPR 1 126 | #define HAVE_STRCHR 1 127 | #define HAVE_STRRCHR 1 128 | #define HAVE_STRSTR 1 129 | #define HAVE_ITOA 1 130 | #define HAVE_STRTOL 1 131 | #define HAVE_STRTOUL 1 132 | #define HAVE_STRTOLL 1 133 | #define HAVE_STRTOD 1 134 | #define HAVE_ATOI 1 135 | #define HAVE_ATOF 1 136 | #define HAVE_STRCMP 1 137 | #define HAVE_STRNCMP 1 138 | /*#define HAVE__STRICMP 1*/ 139 | #define HAVE__STRNICMP 1 140 | #define HAVE_SSCANF 1 141 | #define HAVE_STDARG_H 1 142 | #define HAVE_STDDEF_H 1 143 | 144 | 145 | 146 | #endif /* _SDL_CONFIG_SYMBIAN_H */ 147 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_config_win32.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_win32_h 24 | #define _SDL_config_win32_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | #if defined(__GNUC__) || defined(__DMC__) 31 | #define HAVE_STDINT_H 1 32 | #elif defined(_MSC_VER) 33 | typedef signed __int8 int8_t; 34 | typedef unsigned __int8 uint8_t; 35 | typedef signed __int16 int16_t; 36 | typedef unsigned __int16 uint16_t; 37 | typedef signed __int32 int32_t; 38 | typedef unsigned __int32 uint32_t; 39 | typedef signed __int64 int64_t; 40 | typedef unsigned __int64 uint64_t; 41 | #ifndef _UINTPTR_T_DEFINED 42 | #ifdef _WIN64 43 | typedef unsigned __int64 uintptr_t; 44 | #else 45 | typedef unsigned int uintptr_t; 46 | #endif 47 | #define _UINTPTR_T_DEFINED 48 | #endif 49 | /* Older Visual C++ headers don't have the Win64-compatible typedefs... */ 50 | #if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) 51 | #define DWORD_PTR DWORD 52 | #endif 53 | #if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) 54 | #define LONG_PTR LONG 55 | #endif 56 | #else /* !__GNUC__ && !_MSC_VER */ 57 | typedef signed char int8_t; 58 | typedef unsigned char uint8_t; 59 | typedef signed short int16_t; 60 | typedef unsigned short uint16_t; 61 | typedef signed int int32_t; 62 | typedef unsigned int uint32_t; 63 | typedef signed long long int64_t; 64 | typedef unsigned long long uint64_t; 65 | #ifndef _SIZE_T_DEFINED_ 66 | #define _SIZE_T_DEFINED_ 67 | typedef unsigned int size_t; 68 | #endif 69 | typedef unsigned int uintptr_t; 70 | #endif /* __GNUC__ || _MSC_VER */ 71 | #define SDL_HAS_64BIT_TYPE 1 72 | 73 | /* Enabled for SDL 1.2 (binary compatibility) */ 74 | #define HAVE_LIBC 1 75 | #ifdef HAVE_LIBC 76 | /* Useful headers */ 77 | #define HAVE_STDIO_H 1 78 | #define STDC_HEADERS 1 79 | #define HAVE_STRING_H 1 80 | #define HAVE_CTYPE_H 1 81 | #define HAVE_MATH_H 1 82 | #ifndef _WIN32_WCE 83 | #define HAVE_SIGNAL_H 1 84 | #endif 85 | 86 | /* C library functions */ 87 | #define HAVE_MALLOC 1 88 | #define HAVE_CALLOC 1 89 | #define HAVE_REALLOC 1 90 | #define HAVE_FREE 1 91 | #define HAVE_ALLOCA 1 92 | #define HAVE_QSORT 1 93 | #define HAVE_ABS 1 94 | #define HAVE_MEMSET 1 95 | #define HAVE_MEMCPY 1 96 | #define HAVE_MEMMOVE 1 97 | #define HAVE_MEMCMP 1 98 | #define HAVE_STRLEN 1 99 | #define HAVE__STRREV 1 100 | #define HAVE__STRUPR 1 101 | #define HAVE__STRLWR 1 102 | #define HAVE_STRCHR 1 103 | #define HAVE_STRRCHR 1 104 | #define HAVE_STRSTR 1 105 | #define HAVE_ITOA 1 106 | #define HAVE__LTOA 1 107 | #define HAVE__ULTOA 1 108 | #define HAVE_STRTOL 1 109 | #define HAVE_STRTOUL 1 110 | #define HAVE_STRTOLL 1 111 | #define HAVE_STRTOD 1 112 | #define HAVE_ATOI 1 113 | #define HAVE_ATOF 1 114 | #define HAVE_STRCMP 1 115 | #define HAVE_STRNCMP 1 116 | #define HAVE__STRICMP 1 117 | #define HAVE__STRNICMP 1 118 | #define HAVE_SSCANF 1 119 | #else 120 | #define HAVE_STDARG_H 1 121 | #define HAVE_STDDEF_H 1 122 | #endif 123 | 124 | /* Enable various audio drivers */ 125 | #ifndef _WIN32_WCE 126 | #define SDL_AUDIO_DRIVER_DSOUND 1 127 | #endif 128 | #define SDL_AUDIO_DRIVER_WAVEOUT 1 129 | #define SDL_AUDIO_DRIVER_DISK 1 130 | #define SDL_AUDIO_DRIVER_DUMMY 1 131 | 132 | /* Enable various cdrom drivers */ 133 | #ifdef _WIN32_WCE 134 | #define SDL_CDROM_DISABLED 1 135 | #else 136 | #define SDL_CDROM_WIN32 1 137 | #endif 138 | 139 | /* Enable various input drivers */ 140 | #ifdef _WIN32_WCE 141 | #define SDL_JOYSTICK_DISABLED 1 142 | #else 143 | #define SDL_JOYSTICK_WINMM 1 144 | #endif 145 | 146 | /* Enable various shared object loading systems */ 147 | #define SDL_LOADSO_WIN32 1 148 | 149 | /* Enable various threading systems */ 150 | #define SDL_THREAD_WIN32 1 151 | 152 | /* Enable various timer systems */ 153 | #ifdef _WIN32_WCE 154 | #define SDL_TIMER_WINCE 1 155 | #else 156 | #define SDL_TIMER_WIN32 1 157 | #endif 158 | 159 | /* Enable various video drivers */ 160 | #ifdef _WIN32_WCE 161 | #define SDL_VIDEO_DRIVER_GAPI 1 162 | #endif 163 | #ifndef _WIN32_WCE 164 | #define SDL_VIDEO_DRIVER_DDRAW 1 165 | #endif 166 | #define SDL_VIDEO_DRIVER_DUMMY 1 167 | #define SDL_VIDEO_DRIVER_WINDIB 1 168 | 169 | /* Enable OpenGL support */ 170 | #ifndef _WIN32_WCE 171 | #define SDL_VIDEO_OPENGL 1 172 | #define SDL_VIDEO_OPENGL_WGL 1 173 | #endif 174 | 175 | /* Disable screensaver */ 176 | #define SDL_VIDEO_DISABLE_SCREENSAVER 1 177 | 178 | /* Enable assembly routines (Win64 doesn't have inline asm) */ 179 | #ifndef _WIN64 180 | #define SDL_ASSEMBLY_ROUTINES 1 181 | #endif 182 | 183 | #endif /* _SDL_config_win32_h */ 184 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_cpuinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_cpuinfo.h 25 | * CPU feature detection for SDL 26 | */ 27 | 28 | #ifndef _SDL_cpuinfo_h 29 | #define _SDL_cpuinfo_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** This function returns true if the CPU has the RDTSC instruction */ 40 | extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); 41 | 42 | /** This function returns true if the CPU has MMX features */ 43 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); 44 | 45 | /** This function returns true if the CPU has MMX Ext. features */ 46 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void); 47 | 48 | /** This function returns true if the CPU has 3DNow features */ 49 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); 50 | 51 | /** This function returns true if the CPU has 3DNow! Ext. features */ 52 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void); 53 | 54 | /** This function returns true if the CPU has SSE features */ 55 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); 56 | 57 | /** This function returns true if the CPU has SSE2 features */ 58 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); 59 | 60 | /** This function returns true if the CPU has AltiVec features */ 61 | extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); 62 | 63 | /* Ends C function definitions when using C++ */ 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #include "close_code.h" 68 | 69 | #endif /* _SDL_cpuinfo_h */ 70 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_endian.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_endian.h 25 | * Functions for reading and writing endian-specific values 26 | */ 27 | 28 | #ifndef _SDL_endian_h 29 | #define _SDL_endian_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | /** @name SDL_ENDIANs 34 | * The two types of endianness 35 | */ 36 | /*@{*/ 37 | #define SDL_LIL_ENDIAN 1234 38 | #define SDL_BIG_ENDIAN 4321 39 | /*@}*/ 40 | 41 | #ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ 42 | #ifdef __linux__ 43 | #include 44 | #define SDL_BYTEORDER __BYTE_ORDER 45 | #else /* __linux __ */ 46 | #if defined(__hppa__) || \ 47 | defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ 48 | (defined(__MIPS__) && defined(__MISPEB__)) || \ 49 | defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ 50 | defined(__sparc__) 51 | #define SDL_BYTEORDER SDL_BIG_ENDIAN 52 | #else 53 | #define SDL_BYTEORDER SDL_LIL_ENDIAN 54 | #endif 55 | #endif /* __linux __ */ 56 | #endif /* !SDL_BYTEORDER */ 57 | 58 | 59 | #include "begin_code.h" 60 | /* Set up for C function definitions, even when using C++ */ 61 | #ifdef __cplusplus 62 | extern "C" { 63 | #endif 64 | 65 | /** 66 | * @name SDL_Swap Functions 67 | * Use inline functions for compilers that support them, and static 68 | * functions for those that do not. Because these functions become 69 | * static for compilers that do not support inline functions, this 70 | * header should only be included in files that actually use them. 71 | */ 72 | /*@{*/ 73 | #if defined(__GNUC__) && defined(__i386__) && \ 74 | !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) 75 | static __inline__ Uint16 SDL_Swap16(Uint16 x) 76 | { 77 | __asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x)); 78 | return x; 79 | } 80 | #elif defined(__GNUC__) && defined(__x86_64__) 81 | static __inline__ Uint16 SDL_Swap16(Uint16 x) 82 | { 83 | __asm__("xchgb %b0,%h0" : "=Q" (x) : "0" (x)); 84 | return x; 85 | } 86 | #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) 87 | static __inline__ Uint16 SDL_Swap16(Uint16 x) 88 | { 89 | int result; 90 | 91 | __asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x)); 92 | return (Uint16)result; 93 | } 94 | #elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__)) 95 | static __inline__ Uint16 SDL_Swap16(Uint16 x) 96 | { 97 | __asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc"); 98 | return x; 99 | } 100 | #else 101 | static __inline__ Uint16 SDL_Swap16(Uint16 x) { 102 | return SDL_static_cast(Uint16, ((x<<8)|(x>>8))); 103 | } 104 | #endif 105 | 106 | #if defined(__GNUC__) && defined(__i386__) && \ 107 | !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) 108 | static __inline__ Uint32 SDL_Swap32(Uint32 x) 109 | { 110 | __asm__("bswap %0" : "=r" (x) : "0" (x)); 111 | return x; 112 | } 113 | #elif defined(__GNUC__) && defined(__x86_64__) 114 | static __inline__ Uint32 SDL_Swap32(Uint32 x) 115 | { 116 | __asm__("bswapl %0" : "=r" (x) : "0" (x)); 117 | return x; 118 | } 119 | #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) 120 | static __inline__ Uint32 SDL_Swap32(Uint32 x) 121 | { 122 | Uint32 result; 123 | 124 | __asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x)); 125 | __asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (x)); 126 | __asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x)); 127 | return result; 128 | } 129 | #elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__)) 130 | static __inline__ Uint32 SDL_Swap32(Uint32 x) 131 | { 132 | __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc"); 133 | return x; 134 | } 135 | #else 136 | static __inline__ Uint32 SDL_Swap32(Uint32 x) { 137 | return SDL_static_cast(Uint32, ((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24))); 138 | } 139 | #endif 140 | 141 | #ifdef SDL_HAS_64BIT_TYPE 142 | #if defined(__GNUC__) && defined(__i386__) && \ 143 | !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) 144 | static __inline__ Uint64 SDL_Swap64(Uint64 x) 145 | { 146 | union { 147 | struct { Uint32 a,b; } s; 148 | Uint64 u; 149 | } v; 150 | v.u = x; 151 | __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1" 152 | : "=r" (v.s.a), "=r" (v.s.b) 153 | : "0" (v.s.a), "1" (v.s.b)); 154 | return v.u; 155 | } 156 | #elif defined(__GNUC__) && defined(__x86_64__) 157 | static __inline__ Uint64 SDL_Swap64(Uint64 x) 158 | { 159 | __asm__("bswapq %0" : "=r" (x) : "0" (x)); 160 | return x; 161 | } 162 | #else 163 | static __inline__ Uint64 SDL_Swap64(Uint64 x) 164 | { 165 | Uint32 hi, lo; 166 | 167 | /* Separate into high and low 32-bit values and swap them */ 168 | lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF); 169 | x >>= 32; 170 | hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF); 171 | x = SDL_Swap32(lo); 172 | x <<= 32; 173 | x |= SDL_Swap32(hi); 174 | return (x); 175 | } 176 | #endif 177 | #else 178 | /* This is mainly to keep compilers from complaining in SDL code. 179 | * If there is no real 64-bit datatype, then compilers will complain about 180 | * the fake 64-bit datatype that SDL provides when it compiles user code. 181 | */ 182 | #define SDL_Swap64(X) (X) 183 | #endif /* SDL_HAS_64BIT_TYPE */ 184 | /*@}*/ 185 | 186 | /** 187 | * @name SDL_SwapLE and SDL_SwapBE Functions 188 | * Byteswap item from the specified endianness to the native endianness 189 | */ 190 | /*@{*/ 191 | #if SDL_BYTEORDER == SDL_LIL_ENDIAN 192 | #define SDL_SwapLE16(X) (X) 193 | #define SDL_SwapLE32(X) (X) 194 | #define SDL_SwapLE64(X) (X) 195 | #define SDL_SwapBE16(X) SDL_Swap16(X) 196 | #define SDL_SwapBE32(X) SDL_Swap32(X) 197 | #define SDL_SwapBE64(X) SDL_Swap64(X) 198 | #else 199 | #define SDL_SwapLE16(X) SDL_Swap16(X) 200 | #define SDL_SwapLE32(X) SDL_Swap32(X) 201 | #define SDL_SwapLE64(X) SDL_Swap64(X) 202 | #define SDL_SwapBE16(X) (X) 203 | #define SDL_SwapBE32(X) (X) 204 | #define SDL_SwapBE64(X) (X) 205 | #endif 206 | /*@}*/ 207 | 208 | /* Ends C function definitions when using C++ */ 209 | #ifdef __cplusplus 210 | } 211 | #endif 212 | #include "close_code.h" 213 | 214 | #endif /* _SDL_endian_h */ 215 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_error.h 25 | * Simple error message routines for SDL 26 | */ 27 | 28 | #ifndef _SDL_error_h 29 | #define _SDL_error_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * @name Public functions 41 | */ 42 | /*@{*/ 43 | extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...); 44 | extern DECLSPEC char * SDLCALL SDL_GetError(void); 45 | extern DECLSPEC void SDLCALL SDL_ClearError(void); 46 | /*@}*/ 47 | 48 | /** 49 | * @name Private functions 50 | * @internal Private error message function - used internally 51 | */ 52 | /*@{*/ 53 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) 54 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) 55 | typedef enum { 56 | SDL_ENOMEM, 57 | SDL_EFREAD, 58 | SDL_EFWRITE, 59 | SDL_EFSEEK, 60 | SDL_UNSUPPORTED, 61 | SDL_LASTERROR 62 | } SDL_errorcode; 63 | extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code); 64 | /*@}*/ 65 | 66 | /* Ends C function definitions when using C++ */ 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | #include "close_code.h" 71 | 72 | #endif /* _SDL_error_h */ 73 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_events.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_events.h 25 | * Include file for SDL event handling 26 | */ 27 | 28 | #ifndef _SDL_events_h 29 | #define _SDL_events_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_active.h" 34 | #include "SDL_keyboard.h" 35 | #include "SDL_mouse.h" 36 | #include "SDL_joystick.h" 37 | #include "SDL_quit.h" 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** @name General keyboard/mouse state definitions */ 46 | /*@{*/ 47 | #define SDL_RELEASED 0 48 | #define SDL_PRESSED 1 49 | /*@}*/ 50 | 51 | /** Event enumerations */ 52 | typedef enum { 53 | SDL_NOEVENT = 0, /**< Unused (do not remove) */ 54 | SDL_ACTIVEEVENT, /**< Application loses/gains visibility */ 55 | SDL_KEYDOWN, /**< Keys pressed */ 56 | SDL_KEYUP, /**< Keys released */ 57 | SDL_MOUSEMOTION, /**< Mouse moved */ 58 | SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */ 59 | SDL_MOUSEBUTTONUP, /**< Mouse button released */ 60 | SDL_JOYAXISMOTION, /**< Joystick axis motion */ 61 | SDL_JOYBALLMOTION, /**< Joystick trackball motion */ 62 | SDL_JOYHATMOTION, /**< Joystick hat position change */ 63 | SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ 64 | SDL_JOYBUTTONUP, /**< Joystick button released */ 65 | SDL_QUIT, /**< User-requested quit */ 66 | SDL_SYSWMEVENT, /**< System specific event */ 67 | SDL_EVENT_RESERVEDA, /**< Reserved for future use.. */ 68 | SDL_EVENT_RESERVEDB, /**< Reserved for future use.. */ 69 | SDL_VIDEORESIZE, /**< User resized video mode */ 70 | SDL_VIDEOEXPOSE, /**< Screen needs to be redrawn */ 71 | SDL_EVENT_RESERVED2, /**< Reserved for future use.. */ 72 | SDL_EVENT_RESERVED3, /**< Reserved for future use.. */ 73 | SDL_EVENT_RESERVED4, /**< Reserved for future use.. */ 74 | SDL_EVENT_RESERVED5, /**< Reserved for future use.. */ 75 | SDL_EVENT_RESERVED6, /**< Reserved for future use.. */ 76 | SDL_EVENT_RESERVED7, /**< Reserved for future use.. */ 77 | /** Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */ 78 | SDL_USEREVENT = 24, 79 | /** This last event is only for bounding internal arrays 80 | * It is the number of bits in the event mask datatype -- Uint32 81 | */ 82 | SDL_NUMEVENTS = 32 83 | } SDL_EventType; 84 | 85 | /** @name Predefined event masks */ 86 | /*@{*/ 87 | #define SDL_EVENTMASK(X) (1<<(X)) 88 | typedef enum { 89 | SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT), 90 | SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN), 91 | SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP), 92 | SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)| 93 | SDL_EVENTMASK(SDL_KEYUP), 94 | SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION), 95 | SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN), 96 | SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP), 97 | SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)| 98 | SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)| 99 | SDL_EVENTMASK(SDL_MOUSEBUTTONUP), 100 | SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION), 101 | SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION), 102 | SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION), 103 | SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN), 104 | SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP), 105 | SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)| 106 | SDL_EVENTMASK(SDL_JOYBALLMOTION)| 107 | SDL_EVENTMASK(SDL_JOYHATMOTION)| 108 | SDL_EVENTMASK(SDL_JOYBUTTONDOWN)| 109 | SDL_EVENTMASK(SDL_JOYBUTTONUP), 110 | SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE), 111 | SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE), 112 | SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT), 113 | SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT) 114 | } SDL_EventMask ; 115 | #define SDL_ALLEVENTS 0xFFFFFFFF 116 | /*@}*/ 117 | 118 | /** Application visibility event structure */ 119 | typedef struct SDL_ActiveEvent { 120 | Uint8 type; /**< SDL_ACTIVEEVENT */ 121 | Uint8 gain; /**< Whether given states were gained or lost (1/0) */ 122 | Uint8 state; /**< A mask of the focus states */ 123 | } SDL_ActiveEvent; 124 | 125 | /** Keyboard event structure */ 126 | typedef struct SDL_KeyboardEvent { 127 | Uint8 type; /**< SDL_KEYDOWN or SDL_KEYUP */ 128 | Uint8 which; /**< The keyboard device index */ 129 | Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ 130 | SDL_keysym keysym; 131 | } SDL_KeyboardEvent; 132 | 133 | /** Mouse motion event structure */ 134 | typedef struct SDL_MouseMotionEvent { 135 | Uint8 type; /**< SDL_MOUSEMOTION */ 136 | Uint8 which; /**< The mouse device index */ 137 | Uint8 state; /**< The current button state */ 138 | Uint16 x, y; /**< The X/Y coordinates of the mouse */ 139 | Sint16 xrel; /**< The relative motion in the X direction */ 140 | Sint16 yrel; /**< The relative motion in the Y direction */ 141 | } SDL_MouseMotionEvent; 142 | 143 | /** Mouse button event structure */ 144 | typedef struct SDL_MouseButtonEvent { 145 | Uint8 type; /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ 146 | Uint8 which; /**< The mouse device index */ 147 | Uint8 button; /**< The mouse button index */ 148 | Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ 149 | Uint16 x, y; /**< The X/Y coordinates of the mouse at press time */ 150 | } SDL_MouseButtonEvent; 151 | 152 | /** Joystick axis motion event structure */ 153 | typedef struct SDL_JoyAxisEvent { 154 | Uint8 type; /**< SDL_JOYAXISMOTION */ 155 | Uint8 which; /**< The joystick device index */ 156 | Uint8 axis; /**< The joystick axis index */ 157 | Sint16 value; /**< The axis value (range: -32768 to 32767) */ 158 | } SDL_JoyAxisEvent; 159 | 160 | /** Joystick trackball motion event structure */ 161 | typedef struct SDL_JoyBallEvent { 162 | Uint8 type; /**< SDL_JOYBALLMOTION */ 163 | Uint8 which; /**< The joystick device index */ 164 | Uint8 ball; /**< The joystick trackball index */ 165 | Sint16 xrel; /**< The relative motion in the X direction */ 166 | Sint16 yrel; /**< The relative motion in the Y direction */ 167 | } SDL_JoyBallEvent; 168 | 169 | /** Joystick hat position change event structure */ 170 | typedef struct SDL_JoyHatEvent { 171 | Uint8 type; /**< SDL_JOYHATMOTION */ 172 | Uint8 which; /**< The joystick device index */ 173 | Uint8 hat; /**< The joystick hat index */ 174 | Uint8 value; /**< The hat position value: 175 | * SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP 176 | * SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT 177 | * SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN 178 | * Note that zero means the POV is centered. 179 | */ 180 | } SDL_JoyHatEvent; 181 | 182 | /** Joystick button event structure */ 183 | typedef struct SDL_JoyButtonEvent { 184 | Uint8 type; /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ 185 | Uint8 which; /**< The joystick device index */ 186 | Uint8 button; /**< The joystick button index */ 187 | Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ 188 | } SDL_JoyButtonEvent; 189 | 190 | /** The "window resized" event 191 | * When you get this event, you are responsible for setting a new video 192 | * mode with the new width and height. 193 | */ 194 | typedef struct SDL_ResizeEvent { 195 | Uint8 type; /**< SDL_VIDEORESIZE */ 196 | int w; /**< New width */ 197 | int h; /**< New height */ 198 | } SDL_ResizeEvent; 199 | 200 | /** The "screen redraw" event */ 201 | typedef struct SDL_ExposeEvent { 202 | Uint8 type; /**< SDL_VIDEOEXPOSE */ 203 | } SDL_ExposeEvent; 204 | 205 | /** The "quit requested" event */ 206 | typedef struct SDL_QuitEvent { 207 | Uint8 type; /**< SDL_QUIT */ 208 | } SDL_QuitEvent; 209 | 210 | /** A user-defined event type */ 211 | typedef struct SDL_UserEvent { 212 | Uint8 type; /**< SDL_USEREVENT through SDL_NUMEVENTS-1 */ 213 | int code; /**< User defined event code */ 214 | void *data1; /**< User defined data pointer */ 215 | void *data2; /**< User defined data pointer */ 216 | } SDL_UserEvent; 217 | 218 | /** If you want to use this event, you should include SDL_syswm.h */ 219 | struct SDL_SysWMmsg; 220 | typedef struct SDL_SysWMmsg SDL_SysWMmsg; 221 | typedef struct SDL_SysWMEvent { 222 | Uint8 type; 223 | SDL_SysWMmsg *msg; 224 | } SDL_SysWMEvent; 225 | 226 | /** General event structure */ 227 | typedef union SDL_Event { 228 | Uint8 type; 229 | SDL_ActiveEvent active; 230 | SDL_KeyboardEvent key; 231 | SDL_MouseMotionEvent motion; 232 | SDL_MouseButtonEvent button; 233 | SDL_JoyAxisEvent jaxis; 234 | SDL_JoyBallEvent jball; 235 | SDL_JoyHatEvent jhat; 236 | SDL_JoyButtonEvent jbutton; 237 | SDL_ResizeEvent resize; 238 | SDL_ExposeEvent expose; 239 | SDL_QuitEvent quit; 240 | SDL_UserEvent user; 241 | SDL_SysWMEvent syswm; 242 | } SDL_Event; 243 | 244 | 245 | /* Function prototypes */ 246 | 247 | /** Pumps the event loop, gathering events from the input devices. 248 | * This function updates the event queue and internal input device state. 249 | * This should only be run in the thread that sets the video mode. 250 | */ 251 | extern DECLSPEC void SDLCALL SDL_PumpEvents(void); 252 | 253 | typedef enum { 254 | SDL_ADDEVENT, 255 | SDL_PEEKEVENT, 256 | SDL_GETEVENT 257 | } SDL_eventaction; 258 | 259 | /** 260 | * Checks the event queue for messages and optionally returns them. 261 | * 262 | * If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to 263 | * the back of the event queue. 264 | * If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front 265 | * of the event queue, matching 'mask', will be returned and will not 266 | * be removed from the queue. 267 | * If 'action' is SDL_GETEVENT, up to 'numevents' events at the front 268 | * of the event queue, matching 'mask', will be returned and will be 269 | * removed from the queue. 270 | * 271 | * @return 272 | * This function returns the number of events actually stored, or -1 273 | * if there was an error. 274 | * 275 | * This function is thread-safe. 276 | */ 277 | extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, 278 | SDL_eventaction action, Uint32 mask); 279 | 280 | /** Polls for currently pending events, and returns 1 if there are any pending 281 | * events, or 0 if there are none available. If 'event' is not NULL, the next 282 | * event is removed from the queue and stored in that area. 283 | */ 284 | extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event); 285 | 286 | /** Waits indefinitely for the next available event, returning 1, or 0 if there 287 | * was an error while waiting for events. If 'event' is not NULL, the next 288 | * event is removed from the queue and stored in that area. 289 | */ 290 | extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event); 291 | 292 | /** Add an event to the event queue. 293 | * This function returns 0 on success, or -1 if the event queue was full 294 | * or there was some other error. 295 | */ 296 | extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); 297 | 298 | /** @name Event Filtering */ 299 | /*@{*/ 300 | typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event); 301 | /** 302 | * This function sets up a filter to process all events before they 303 | * change internal state and are posted to the internal event queue. 304 | * 305 | * The filter is protypted as: 306 | * @code typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event); @endcode 307 | * 308 | * If the filter returns 1, then the event will be added to the internal queue. 309 | * If it returns 0, then the event will be dropped from the queue, but the 310 | * internal state will still be updated. This allows selective filtering of 311 | * dynamically arriving events. 312 | * 313 | * @warning Be very careful of what you do in the event filter function, as 314 | * it may run in a different thread! 315 | * 316 | * There is one caveat when dealing with the SDL_QUITEVENT event type. The 317 | * event filter is only called when the window manager desires to close the 318 | * application window. If the event filter returns 1, then the window will 319 | * be closed, otherwise the window will remain open if possible. 320 | * If the quit event is generated by an interrupt signal, it will bypass the 321 | * internal queue and be delivered to the application at the next event poll. 322 | */ 323 | extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter); 324 | 325 | /** 326 | * Return the current event filter - can be used to "chain" filters. 327 | * If there is no event filter set, this function returns NULL. 328 | */ 329 | extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void); 330 | /*@}*/ 331 | 332 | /** @name Event State */ 333 | /*@{*/ 334 | #define SDL_QUERY -1 335 | #define SDL_IGNORE 0 336 | #define SDL_DISABLE 0 337 | #define SDL_ENABLE 1 338 | /*@}*/ 339 | 340 | /** 341 | * This function allows you to set the state of processing certain events. 342 | * If 'state' is set to SDL_IGNORE, that event will be automatically dropped 343 | * from the event queue and will not event be filtered. 344 | * If 'state' is set to SDL_ENABLE, that event will be processed normally. 345 | * If 'state' is set to SDL_QUERY, SDL_EventState() will return the 346 | * current processing state of the specified event. 347 | */ 348 | extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state); 349 | 350 | /* Ends C function definitions when using C++ */ 351 | #ifdef __cplusplus 352 | } 353 | #endif 354 | #include "close_code.h" 355 | 356 | #endif /* _SDL_events_h */ 357 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_getenv.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_getenv.h 24 | * @deprecated Use SDL_stdinc.h instead 25 | */ 26 | 27 | /* DEPRECATED */ 28 | #include "SDL_stdinc.h" 29 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_joystick.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_joystick.h 24 | * Include file for SDL joystick event handling 25 | */ 26 | 27 | #ifndef _SDL_joystick_h 28 | #define _SDL_joystick_h 29 | 30 | #include "SDL_stdinc.h" 31 | #include "SDL_error.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** @file SDL_joystick.h 40 | * @note In order to use these functions, SDL_Init() must have been called 41 | * with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system 42 | * for joysticks, and load appropriate drivers. 43 | */ 44 | 45 | /** The joystick structure used to identify an SDL joystick */ 46 | struct _SDL_Joystick; 47 | typedef struct _SDL_Joystick SDL_Joystick; 48 | 49 | /* Function prototypes */ 50 | /** 51 | * Count the number of joysticks attached to the system 52 | */ 53 | extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); 54 | 55 | /** 56 | * Get the implementation dependent name of a joystick. 57 | * 58 | * This can be called before any joysticks are opened. 59 | * If no name can be found, this function returns NULL. 60 | */ 61 | extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index); 62 | 63 | /** 64 | * Open a joystick for use. 65 | * 66 | * @param[in] device_index 67 | * The index passed as an argument refers to 68 | * the N'th joystick on the system. This index is the value which will 69 | * identify this joystick in future joystick events. 70 | * 71 | * @return This function returns a joystick identifier, or NULL if an error occurred. 72 | */ 73 | extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index); 74 | 75 | /** 76 | * Returns 1 if the joystick has been opened, or 0 if it has not. 77 | */ 78 | extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index); 79 | 80 | /** 81 | * Get the device index of an opened joystick. 82 | */ 83 | extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick); 84 | 85 | /** 86 | * Get the number of general axis controls on a joystick 87 | */ 88 | extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick); 89 | 90 | /** 91 | * Get the number of trackballs on a joystick 92 | * 93 | * Joystick trackballs have only relative motion events associated 94 | * with them and their state cannot be polled. 95 | */ 96 | extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick); 97 | 98 | /** 99 | * Get the number of POV hats on a joystick 100 | */ 101 | extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick); 102 | 103 | /** 104 | * Get the number of buttons on a joystick 105 | */ 106 | extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick); 107 | 108 | /** 109 | * Update the current state of the open joysticks. 110 | * 111 | * This is called automatically by the event loop if any joystick 112 | * events are enabled. 113 | */ 114 | extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); 115 | 116 | /** 117 | * Enable/disable joystick event polling. 118 | * 119 | * If joystick events are disabled, you must call SDL_JoystickUpdate() 120 | * yourself and check the state of the joystick when you want joystick 121 | * information. 122 | * 123 | * @param[in] state The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. 124 | */ 125 | extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); 126 | 127 | /** 128 | * Get the current state of an axis control on a joystick 129 | * 130 | * @param[in] axis The axis indices start at index 0. 131 | * 132 | * @return The state is a value ranging from -32768 to 32767. 133 | */ 134 | extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis); 135 | 136 | /** 137 | * @name Hat Positions 138 | * The return value of SDL_JoystickGetHat() is one of the following positions: 139 | */ 140 | /*@{*/ 141 | #define SDL_HAT_CENTERED 0x00 142 | #define SDL_HAT_UP 0x01 143 | #define SDL_HAT_RIGHT 0x02 144 | #define SDL_HAT_DOWN 0x04 145 | #define SDL_HAT_LEFT 0x08 146 | #define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) 147 | #define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) 148 | #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) 149 | #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) 150 | /*@}*/ 151 | 152 | /** 153 | * Get the current state of a POV hat on a joystick 154 | * 155 | * @param[in] hat The hat indices start at index 0. 156 | */ 157 | extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat); 158 | 159 | /** 160 | * Get the ball axis change since the last poll 161 | * 162 | * @param[in] ball The ball indices start at index 0. 163 | * 164 | * @return This returns 0, or -1 if you passed it invalid parameters. 165 | */ 166 | extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); 167 | 168 | /** 169 | * Get the current state of a button on a joystick 170 | * 171 | * @param[in] button The button indices start at index 0. 172 | */ 173 | extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button); 174 | 175 | /** 176 | * Close a joystick previously opened with SDL_JoystickOpen() 177 | */ 178 | extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick); 179 | 180 | 181 | /* Ends C function definitions when using C++ */ 182 | #ifdef __cplusplus 183 | } 184 | #endif 185 | #include "close_code.h" 186 | 187 | #endif /* _SDL_joystick_h */ 188 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_keyboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_keyboard.h 24 | * Include file for SDL keyboard event handling 25 | */ 26 | 27 | #ifndef _SDL_keyboard_h 28 | #define _SDL_keyboard_h 29 | 30 | #include "SDL_stdinc.h" 31 | #include "SDL_error.h" 32 | #include "SDL_keysym.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** Keysym structure 41 | * 42 | * - The scancode is hardware dependent, and should not be used by general 43 | * applications. If no hardware scancode is available, it will be 0. 44 | * 45 | * - The 'unicode' translated character is only available when character 46 | * translation is enabled by the SDL_EnableUNICODE() API. If non-zero, 47 | * this is a UNICODE character corresponding to the keypress. If the 48 | * high 9 bits of the character are 0, then this maps to the equivalent 49 | * ASCII character: 50 | * @code 51 | * char ch; 52 | * if ( (keysym.unicode & 0xFF80) == 0 ) { 53 | * ch = keysym.unicode & 0x7F; 54 | * } else { 55 | * An international character.. 56 | * } 57 | * @endcode 58 | */ 59 | typedef struct SDL_keysym { 60 | Uint8 scancode; /**< hardware specific scancode */ 61 | SDLKey sym; /**< SDL virtual keysym */ 62 | SDLMod mod; /**< current key modifiers */ 63 | Uint16 unicode; /**< translated character */ 64 | } SDL_keysym; 65 | 66 | /** This is the mask which refers to all hotkey bindings */ 67 | #define SDL_ALL_HOTKEYS 0xFFFFFFFF 68 | 69 | /* Function prototypes */ 70 | /** 71 | * Enable/Disable UNICODE translation of keyboard input. 72 | * 73 | * This translation has some overhead, so translation defaults off. 74 | * 75 | * @param[in] enable 76 | * If 'enable' is 1, translation is enabled. 77 | * If 'enable' is 0, translation is disabled. 78 | * If 'enable' is -1, the translation state is not changed. 79 | * 80 | * @return It returns the previous state of keyboard translation. 81 | */ 82 | extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); 83 | 84 | #define SDL_DEFAULT_REPEAT_DELAY 500 85 | #define SDL_DEFAULT_REPEAT_INTERVAL 30 86 | /** 87 | * Enable/Disable keyboard repeat. Keyboard repeat defaults to off. 88 | * 89 | * @param[in] delay 90 | * 'delay' is the initial delay in ms between the time when a key is 91 | * pressed, and keyboard repeat begins. 92 | * 93 | * @param[in] interval 94 | * 'interval' is the time in ms between keyboard repeat events. 95 | * 96 | * If 'delay' is set to 0, keyboard repeat is disabled. 97 | */ 98 | extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval); 99 | extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval); 100 | 101 | /** 102 | * Get a snapshot of the current state of the keyboard. 103 | * Returns an array of keystates, indexed by the SDLK_* syms. 104 | * Usage: 105 | * @code 106 | * Uint8 *keystate = SDL_GetKeyState(NULL); 107 | * if ( keystate[SDLK_RETURN] ) //... \ is pressed. 108 | * @endcode 109 | */ 110 | extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys); 111 | 112 | /** 113 | * Get the current key modifier state 114 | */ 115 | extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void); 116 | 117 | /** 118 | * Set the current key modifier state. 119 | * This does not change the keyboard state, only the key modifier flags. 120 | */ 121 | extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate); 122 | 123 | /** 124 | * Get the name of an SDL virtual keysym 125 | */ 126 | extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key); 127 | 128 | 129 | /* Ends C function definitions when using C++ */ 130 | #ifdef __cplusplus 131 | } 132 | #endif 133 | #include "close_code.h" 134 | 135 | #endif /* _SDL_keyboard_h */ 136 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_keysym.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_keysym_h 24 | #define _SDL_keysym_h 25 | 26 | /** What we really want is a mapping of every raw key on the keyboard. 27 | * To support international keyboards, we use the range 0xA1 - 0xFF 28 | * as international virtual keycodes. We'll follow in the footsteps of X11... 29 | * @brief The names of the keys 30 | */ 31 | typedef enum { 32 | /** @name ASCII mapped keysyms 33 | * The keyboard syms have been cleverly chosen to map to ASCII 34 | */ 35 | /*@{*/ 36 | SDLK_UNKNOWN = 0, 37 | SDLK_FIRST = 0, 38 | SDLK_BACKSPACE = 8, 39 | SDLK_TAB = 9, 40 | SDLK_CLEAR = 12, 41 | SDLK_RETURN = 13, 42 | SDLK_PAUSE = 19, 43 | SDLK_ESCAPE = 27, 44 | SDLK_SPACE = 32, 45 | SDLK_EXCLAIM = 33, 46 | SDLK_QUOTEDBL = 34, 47 | SDLK_HASH = 35, 48 | SDLK_DOLLAR = 36, 49 | SDLK_AMPERSAND = 38, 50 | SDLK_QUOTE = 39, 51 | SDLK_LEFTPAREN = 40, 52 | SDLK_RIGHTPAREN = 41, 53 | SDLK_ASTERISK = 42, 54 | SDLK_PLUS = 43, 55 | SDLK_COMMA = 44, 56 | SDLK_MINUS = 45, 57 | SDLK_PERIOD = 46, 58 | SDLK_SLASH = 47, 59 | SDLK_0 = 48, 60 | SDLK_1 = 49, 61 | SDLK_2 = 50, 62 | SDLK_3 = 51, 63 | SDLK_4 = 52, 64 | SDLK_5 = 53, 65 | SDLK_6 = 54, 66 | SDLK_7 = 55, 67 | SDLK_8 = 56, 68 | SDLK_9 = 57, 69 | SDLK_COLON = 58, 70 | SDLK_SEMICOLON = 59, 71 | SDLK_LESS = 60, 72 | SDLK_EQUALS = 61, 73 | SDLK_GREATER = 62, 74 | SDLK_QUESTION = 63, 75 | SDLK_AT = 64, 76 | /* 77 | Skip uppercase letters 78 | */ 79 | SDLK_LEFTBRACKET = 91, 80 | SDLK_BACKSLASH = 92, 81 | SDLK_RIGHTBRACKET = 93, 82 | SDLK_CARET = 94, 83 | SDLK_UNDERSCORE = 95, 84 | SDLK_BACKQUOTE = 96, 85 | SDLK_a = 97, 86 | SDLK_b = 98, 87 | SDLK_c = 99, 88 | SDLK_d = 100, 89 | SDLK_e = 101, 90 | SDLK_f = 102, 91 | SDLK_g = 103, 92 | SDLK_h = 104, 93 | SDLK_i = 105, 94 | SDLK_j = 106, 95 | SDLK_k = 107, 96 | SDLK_l = 108, 97 | SDLK_m = 109, 98 | SDLK_n = 110, 99 | SDLK_o = 111, 100 | SDLK_p = 112, 101 | SDLK_q = 113, 102 | SDLK_r = 114, 103 | SDLK_s = 115, 104 | SDLK_t = 116, 105 | SDLK_u = 117, 106 | SDLK_v = 118, 107 | SDLK_w = 119, 108 | SDLK_x = 120, 109 | SDLK_y = 121, 110 | SDLK_z = 122, 111 | SDLK_DELETE = 127, 112 | /* End of ASCII mapped keysyms */ 113 | /*@}*/ 114 | 115 | /** @name International keyboard syms */ 116 | /*@{*/ 117 | SDLK_WORLD_0 = 160, /* 0xA0 */ 118 | SDLK_WORLD_1 = 161, 119 | SDLK_WORLD_2 = 162, 120 | SDLK_WORLD_3 = 163, 121 | SDLK_WORLD_4 = 164, 122 | SDLK_WORLD_5 = 165, 123 | SDLK_WORLD_6 = 166, 124 | SDLK_WORLD_7 = 167, 125 | SDLK_WORLD_8 = 168, 126 | SDLK_WORLD_9 = 169, 127 | SDLK_WORLD_10 = 170, 128 | SDLK_WORLD_11 = 171, 129 | SDLK_WORLD_12 = 172, 130 | SDLK_WORLD_13 = 173, 131 | SDLK_WORLD_14 = 174, 132 | SDLK_WORLD_15 = 175, 133 | SDLK_WORLD_16 = 176, 134 | SDLK_WORLD_17 = 177, 135 | SDLK_WORLD_18 = 178, 136 | SDLK_WORLD_19 = 179, 137 | SDLK_WORLD_20 = 180, 138 | SDLK_WORLD_21 = 181, 139 | SDLK_WORLD_22 = 182, 140 | SDLK_WORLD_23 = 183, 141 | SDLK_WORLD_24 = 184, 142 | SDLK_WORLD_25 = 185, 143 | SDLK_WORLD_26 = 186, 144 | SDLK_WORLD_27 = 187, 145 | SDLK_WORLD_28 = 188, 146 | SDLK_WORLD_29 = 189, 147 | SDLK_WORLD_30 = 190, 148 | SDLK_WORLD_31 = 191, 149 | SDLK_WORLD_32 = 192, 150 | SDLK_WORLD_33 = 193, 151 | SDLK_WORLD_34 = 194, 152 | SDLK_WORLD_35 = 195, 153 | SDLK_WORLD_36 = 196, 154 | SDLK_WORLD_37 = 197, 155 | SDLK_WORLD_38 = 198, 156 | SDLK_WORLD_39 = 199, 157 | SDLK_WORLD_40 = 200, 158 | SDLK_WORLD_41 = 201, 159 | SDLK_WORLD_42 = 202, 160 | SDLK_WORLD_43 = 203, 161 | SDLK_WORLD_44 = 204, 162 | SDLK_WORLD_45 = 205, 163 | SDLK_WORLD_46 = 206, 164 | SDLK_WORLD_47 = 207, 165 | SDLK_WORLD_48 = 208, 166 | SDLK_WORLD_49 = 209, 167 | SDLK_WORLD_50 = 210, 168 | SDLK_WORLD_51 = 211, 169 | SDLK_WORLD_52 = 212, 170 | SDLK_WORLD_53 = 213, 171 | SDLK_WORLD_54 = 214, 172 | SDLK_WORLD_55 = 215, 173 | SDLK_WORLD_56 = 216, 174 | SDLK_WORLD_57 = 217, 175 | SDLK_WORLD_58 = 218, 176 | SDLK_WORLD_59 = 219, 177 | SDLK_WORLD_60 = 220, 178 | SDLK_WORLD_61 = 221, 179 | SDLK_WORLD_62 = 222, 180 | SDLK_WORLD_63 = 223, 181 | SDLK_WORLD_64 = 224, 182 | SDLK_WORLD_65 = 225, 183 | SDLK_WORLD_66 = 226, 184 | SDLK_WORLD_67 = 227, 185 | SDLK_WORLD_68 = 228, 186 | SDLK_WORLD_69 = 229, 187 | SDLK_WORLD_70 = 230, 188 | SDLK_WORLD_71 = 231, 189 | SDLK_WORLD_72 = 232, 190 | SDLK_WORLD_73 = 233, 191 | SDLK_WORLD_74 = 234, 192 | SDLK_WORLD_75 = 235, 193 | SDLK_WORLD_76 = 236, 194 | SDLK_WORLD_77 = 237, 195 | SDLK_WORLD_78 = 238, 196 | SDLK_WORLD_79 = 239, 197 | SDLK_WORLD_80 = 240, 198 | SDLK_WORLD_81 = 241, 199 | SDLK_WORLD_82 = 242, 200 | SDLK_WORLD_83 = 243, 201 | SDLK_WORLD_84 = 244, 202 | SDLK_WORLD_85 = 245, 203 | SDLK_WORLD_86 = 246, 204 | SDLK_WORLD_87 = 247, 205 | SDLK_WORLD_88 = 248, 206 | SDLK_WORLD_89 = 249, 207 | SDLK_WORLD_90 = 250, 208 | SDLK_WORLD_91 = 251, 209 | SDLK_WORLD_92 = 252, 210 | SDLK_WORLD_93 = 253, 211 | SDLK_WORLD_94 = 254, 212 | SDLK_WORLD_95 = 255, /* 0xFF */ 213 | /*@}*/ 214 | 215 | /** @name Numeric keypad */ 216 | /*@{*/ 217 | SDLK_KP0 = 256, 218 | SDLK_KP1 = 257, 219 | SDLK_KP2 = 258, 220 | SDLK_KP3 = 259, 221 | SDLK_KP4 = 260, 222 | SDLK_KP5 = 261, 223 | SDLK_KP6 = 262, 224 | SDLK_KP7 = 263, 225 | SDLK_KP8 = 264, 226 | SDLK_KP9 = 265, 227 | SDLK_KP_PERIOD = 266, 228 | SDLK_KP_DIVIDE = 267, 229 | SDLK_KP_MULTIPLY = 268, 230 | SDLK_KP_MINUS = 269, 231 | SDLK_KP_PLUS = 270, 232 | SDLK_KP_ENTER = 271, 233 | SDLK_KP_EQUALS = 272, 234 | /*@}*/ 235 | 236 | /** @name Arrows + Home/End pad */ 237 | /*@{*/ 238 | SDLK_UP = 273, 239 | SDLK_DOWN = 274, 240 | SDLK_RIGHT = 275, 241 | SDLK_LEFT = 276, 242 | SDLK_INSERT = 277, 243 | SDLK_HOME = 278, 244 | SDLK_END = 279, 245 | SDLK_PAGEUP = 280, 246 | SDLK_PAGEDOWN = 281, 247 | /*@}*/ 248 | 249 | /** @name Function keys */ 250 | /*@{*/ 251 | SDLK_F1 = 282, 252 | SDLK_F2 = 283, 253 | SDLK_F3 = 284, 254 | SDLK_F4 = 285, 255 | SDLK_F5 = 286, 256 | SDLK_F6 = 287, 257 | SDLK_F7 = 288, 258 | SDLK_F8 = 289, 259 | SDLK_F9 = 290, 260 | SDLK_F10 = 291, 261 | SDLK_F11 = 292, 262 | SDLK_F12 = 293, 263 | SDLK_F13 = 294, 264 | SDLK_F14 = 295, 265 | SDLK_F15 = 296, 266 | /*@}*/ 267 | 268 | /** @name Key state modifier keys */ 269 | /*@{*/ 270 | SDLK_NUMLOCK = 300, 271 | SDLK_CAPSLOCK = 301, 272 | SDLK_SCROLLOCK = 302, 273 | SDLK_RSHIFT = 303, 274 | SDLK_LSHIFT = 304, 275 | SDLK_RCTRL = 305, 276 | SDLK_LCTRL = 306, 277 | SDLK_RALT = 307, 278 | SDLK_LALT = 308, 279 | SDLK_RMETA = 309, 280 | SDLK_LMETA = 310, 281 | SDLK_LSUPER = 311, /**< Left "Windows" key */ 282 | SDLK_RSUPER = 312, /**< Right "Windows" key */ 283 | SDLK_MODE = 313, /**< "Alt Gr" key */ 284 | SDLK_COMPOSE = 314, /**< Multi-key compose key */ 285 | /*@}*/ 286 | 287 | /** @name Miscellaneous function keys */ 288 | /*@{*/ 289 | SDLK_HELP = 315, 290 | SDLK_PRINT = 316, 291 | SDLK_SYSREQ = 317, 292 | SDLK_BREAK = 318, 293 | SDLK_MENU = 319, 294 | SDLK_POWER = 320, /**< Power Macintosh power key */ 295 | SDLK_EURO = 321, /**< Some european keyboards */ 296 | SDLK_UNDO = 322, /**< Atari keyboard has Undo */ 297 | /*@}*/ 298 | 299 | /* Add any other keys here */ 300 | 301 | SDLK_LAST 302 | } SDLKey; 303 | 304 | /** Enumeration of valid key mods (possibly OR'd together) */ 305 | typedef enum { 306 | KMOD_NONE = 0x0000, 307 | KMOD_LSHIFT= 0x0001, 308 | KMOD_RSHIFT= 0x0002, 309 | KMOD_LCTRL = 0x0040, 310 | KMOD_RCTRL = 0x0080, 311 | KMOD_LALT = 0x0100, 312 | KMOD_RALT = 0x0200, 313 | KMOD_LMETA = 0x0400, 314 | KMOD_RMETA = 0x0800, 315 | KMOD_NUM = 0x1000, 316 | KMOD_CAPS = 0x2000, 317 | KMOD_MODE = 0x4000, 318 | KMOD_RESERVED = 0x8000 319 | } SDLMod; 320 | 321 | #define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) 322 | #define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) 323 | #define KMOD_ALT (KMOD_LALT|KMOD_RALT) 324 | #define KMOD_META (KMOD_LMETA|KMOD_RMETA) 325 | 326 | #endif /* _SDL_keysym_h */ 327 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_loadso.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_loadso.h 24 | * System dependent library loading routines 25 | */ 26 | 27 | /** @file SDL_loadso.h 28 | * Some things to keep in mind: 29 | * - These functions only work on C function names. Other languages may 30 | * have name mangling and intrinsic language support that varies from 31 | * compiler to compiler. 32 | * - Make sure you declare your function pointers with the same calling 33 | * convention as the actual library function. Your code will crash 34 | * mysteriously if you do not do this. 35 | * - Avoid namespace collisions. If you load a symbol from the library, 36 | * it is not defined whether or not it goes into the global symbol 37 | * namespace for the application. If it does and it conflicts with 38 | * symbols in your code or other shared libraries, you will not get 39 | * the results you expect. :) 40 | */ 41 | 42 | 43 | #ifndef _SDL_loadso_h 44 | #define _SDL_loadso_h 45 | 46 | #include "SDL_stdinc.h" 47 | #include "SDL_error.h" 48 | 49 | #include "begin_code.h" 50 | /* Set up for C function definitions, even when using C++ */ 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | /** 56 | * This function dynamically loads a shared object and returns a pointer 57 | * to the object handle (or NULL if there was an error). 58 | * The 'sofile' parameter is a system dependent name of the object file. 59 | */ 60 | extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile); 61 | 62 | /** 63 | * Given an object handle, this function looks up the address of the 64 | * named function in the shared object and returns it. This address 65 | * is no longer valid after calling SDL_UnloadObject(). 66 | */ 67 | extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name); 68 | 69 | /** Unload a shared object from memory */ 70 | extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); 71 | 72 | /* Ends C function definitions when using C++ */ 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | #include "close_code.h" 77 | 78 | #endif /* _SDL_loadso_h */ 79 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_main.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_main_h 24 | #define _SDL_main_h 25 | 26 | #include "SDL_stdinc.h" 27 | 28 | /** @file SDL_main.h 29 | * Redefine main() on Win32 and MacOS so that it is called by winmain.c 30 | */ 31 | 32 | #if defined(__WIN32__) || \ 33 | (defined(__MWERKS__) && !defined(__BEOS__)) || \ 34 | defined(__MACOS__) || defined(__MACOSX__) || \ 35 | defined(__SYMBIAN32__) || defined(QWS) 36 | 37 | #ifdef __cplusplus 38 | #define C_LINKAGE "C" 39 | #else 40 | #define C_LINKAGE 41 | #endif /* __cplusplus */ 42 | 43 | /** The application's main() function must be called with C linkage, 44 | * and should be declared like this: 45 | * @code 46 | * #ifdef __cplusplus 47 | * extern "C" 48 | * #endif 49 | * int main(int argc, char *argv[]) 50 | * { 51 | * } 52 | * @endcode 53 | */ 54 | #define main SDL_main 55 | 56 | /** The prototype for the application's main() function */ 57 | extern C_LINKAGE int SDL_main(int argc, char *argv[]); 58 | 59 | 60 | /** @name From the SDL library code -- needed for registering the app on Win32 */ 61 | /*@{*/ 62 | #ifdef __WIN32__ 63 | 64 | #include "begin_code.h" 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | /** This should be called from your WinMain() function, if any */ 70 | extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst); 71 | /** This can also be called, but is no longer necessary */ 72 | extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); 73 | /** This can also be called, but is no longer necessary (SDL_Quit calls it) */ 74 | extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | #include "close_code.h" 79 | #endif 80 | /*@}*/ 81 | 82 | /** @name From the SDL library code -- needed for registering QuickDraw on MacOS */ 83 | /*@{*/ 84 | #if defined(__MACOS__) 85 | 86 | #include "begin_code.h" 87 | #ifdef __cplusplus 88 | extern "C" { 89 | #endif 90 | 91 | /** Forward declaration so we don't need to include QuickDraw.h */ 92 | struct QDGlobals; 93 | 94 | /** This should be called from your main() function, if any */ 95 | extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | #include "close_code.h" 101 | #endif 102 | /*@}*/ 103 | 104 | #endif /* Need to redefine main()? */ 105 | 106 | #endif /* _SDL_main_h */ 107 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_mouse.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_mouse.h 24 | * Include file for SDL mouse event handling 25 | */ 26 | 27 | #ifndef _SDL_mouse_h 28 | #define _SDL_mouse_h 29 | 30 | #include "SDL_stdinc.h" 31 | #include "SDL_error.h" 32 | #include "SDL_video.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | typedef struct WMcursor WMcursor; /**< Implementation dependent */ 41 | typedef struct SDL_Cursor { 42 | SDL_Rect area; /**< The area of the mouse cursor */ 43 | Sint16 hot_x, hot_y; /**< The "tip" of the cursor */ 44 | Uint8 *data; /**< B/W cursor data */ 45 | Uint8 *mask; /**< B/W cursor mask */ 46 | Uint8 *save[2]; /**< Place to save cursor area */ 47 | WMcursor *wm_cursor; /**< Window-manager cursor */ 48 | } SDL_Cursor; 49 | 50 | /* Function prototypes */ 51 | /** 52 | * Retrieve the current state of the mouse. 53 | * The current button state is returned as a button bitmask, which can 54 | * be tested using the SDL_BUTTON(X) macros, and x and y are set to the 55 | * current mouse cursor position. You can pass NULL for either x or y. 56 | */ 57 | extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y); 58 | 59 | /** 60 | * Retrieve the current state of the mouse. 61 | * The current button state is returned as a button bitmask, which can 62 | * be tested using the SDL_BUTTON(X) macros, and x and y are set to the 63 | * mouse deltas since the last call to SDL_GetRelativeMouseState(). 64 | */ 65 | extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); 66 | 67 | /** 68 | * Set the position of the mouse cursor (generates a mouse motion event) 69 | */ 70 | extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y); 71 | 72 | /** 73 | * Create a cursor using the specified data and mask (in MSB format). 74 | * The cursor width must be a multiple of 8 bits. 75 | * 76 | * The cursor is created in black and white according to the following: 77 | * data mask resulting pixel on screen 78 | * 0 1 White 79 | * 1 1 Black 80 | * 0 0 Transparent 81 | * 1 0 Inverted color if possible, black if not. 82 | * 83 | * Cursors created with this function must be freed with SDL_FreeCursor(). 84 | */ 85 | extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor 86 | (Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y); 87 | 88 | /** 89 | * Set the currently active cursor to the specified one. 90 | * If the cursor is currently visible, the change will be immediately 91 | * represented on the display. 92 | */ 93 | extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor); 94 | 95 | /** 96 | * Returns the currently active cursor. 97 | */ 98 | extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void); 99 | 100 | /** 101 | * Deallocates a cursor created with SDL_CreateCursor(). 102 | */ 103 | extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor); 104 | 105 | /** 106 | * Toggle whether or not the cursor is shown on the screen. 107 | * The cursor start off displayed, but can be turned off. 108 | * SDL_ShowCursor() returns 1 if the cursor was being displayed 109 | * before the call, or 0 if it was not. You can query the current 110 | * state by passing a 'toggle' value of -1. 111 | */ 112 | extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); 113 | 114 | /*@{*/ 115 | /** Used as a mask when testing buttons in buttonstate 116 | * Button 1: Left mouse button 117 | * Button 2: Middle mouse button 118 | * Button 3: Right mouse button 119 | * Button 4: Mouse wheel up (may also be a real button) 120 | * Button 5: Mouse wheel down (may also be a real button) 121 | */ 122 | #define SDL_BUTTON(X) (1 << ((X)-1)) 123 | #define SDL_BUTTON_LEFT 1 124 | #define SDL_BUTTON_MIDDLE 2 125 | #define SDL_BUTTON_RIGHT 3 126 | #define SDL_BUTTON_WHEELUP 4 127 | #define SDL_BUTTON_WHEELDOWN 5 128 | #define SDL_BUTTON_X1 6 129 | #define SDL_BUTTON_X2 7 130 | #define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) 131 | #define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) 132 | #define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) 133 | #define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) 134 | #define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) 135 | /*@}*/ 136 | 137 | /* Ends C function definitions when using C++ */ 138 | #ifdef __cplusplus 139 | } 140 | #endif 141 | #include "close_code.h" 142 | 143 | #endif /* _SDL_mouse_h */ 144 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_mutex_h 24 | #define _SDL_mutex_h 25 | 26 | /** @file SDL_mutex.h 27 | * Functions to provide thread synchronization primitives 28 | * 29 | * @note These are independent of the other SDL routines. 30 | */ 31 | 32 | #include "SDL_stdinc.h" 33 | #include "SDL_error.h" 34 | 35 | #include "begin_code.h" 36 | /* Set up for C function definitions, even when using C++ */ 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** Synchronization functions which can time out return this value 42 | * if they time out. 43 | */ 44 | #define SDL_MUTEX_TIMEDOUT 1 45 | 46 | /** This is the timeout value which corresponds to never time out */ 47 | #define SDL_MUTEX_MAXWAIT (~(Uint32)0) 48 | 49 | 50 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 51 | /** @name Mutex functions */ /*@{*/ 52 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 53 | 54 | /** The SDL mutex structure, defined in SDL_mutex.c */ 55 | struct SDL_mutex; 56 | typedef struct SDL_mutex SDL_mutex; 57 | 58 | /** Create a mutex, initialized unlocked */ 59 | extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void); 60 | 61 | #define SDL_LockMutex(m) SDL_mutexP(m) 62 | /** Lock the mutex 63 | * @return 0, or -1 on error 64 | */ 65 | extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex); 66 | 67 | #define SDL_UnlockMutex(m) SDL_mutexV(m) 68 | /** Unlock the mutex 69 | * @return 0, or -1 on error 70 | * 71 | * It is an error to unlock a mutex that has not been locked by 72 | * the current thread, and doing so results in undefined behavior. 73 | */ 74 | extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex); 75 | 76 | /** Destroy a mutex */ 77 | extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex); 78 | 79 | /*@}*/ 80 | 81 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 82 | /** @name Semaphore functions */ /*@{*/ 83 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 84 | 85 | /** The SDL semaphore structure, defined in SDL_sem.c */ 86 | struct SDL_semaphore; 87 | typedef struct SDL_semaphore SDL_sem; 88 | 89 | /** Create a semaphore, initialized with value, returns NULL on failure. */ 90 | extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value); 91 | 92 | /** Destroy a semaphore */ 93 | extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem); 94 | 95 | /** 96 | * This function suspends the calling thread until the semaphore pointed 97 | * to by sem has a positive count. It then atomically decreases the semaphore 98 | * count. 99 | */ 100 | extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem); 101 | 102 | /** Non-blocking variant of SDL_SemWait(). 103 | * @return 0 if the wait succeeds, 104 | * SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error. 105 | */ 106 | extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem); 107 | 108 | /** Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if 109 | * the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in 110 | * the allotted time, and -1 on error. 111 | * 112 | * On some platforms this function is implemented by looping with a delay 113 | * of 1 ms, and so should be avoided if possible. 114 | */ 115 | extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms); 116 | 117 | /** Atomically increases the semaphore's count (not blocking). 118 | * @return 0, or -1 on error. 119 | */ 120 | extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem); 121 | 122 | /** Returns the current count of the semaphore */ 123 | extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem); 124 | 125 | /*@}*/ 126 | 127 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 128 | /** @name Condition_variable_functions */ /*@{*/ 129 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 130 | 131 | /*@{*/ 132 | /** The SDL condition variable structure, defined in SDL_cond.c */ 133 | struct SDL_cond; 134 | typedef struct SDL_cond SDL_cond; 135 | /*@}*/ 136 | 137 | /** Create a condition variable */ 138 | extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void); 139 | 140 | /** Destroy a condition variable */ 141 | extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond); 142 | 143 | /** Restart one of the threads that are waiting on the condition variable, 144 | * @return 0 or -1 on error. 145 | */ 146 | extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond); 147 | 148 | /** Restart all threads that are waiting on the condition variable, 149 | * @return 0 or -1 on error. 150 | */ 151 | extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond); 152 | 153 | /** Wait on the condition variable, unlocking the provided mutex. 154 | * The mutex must be locked before entering this function! 155 | * The mutex is re-locked once the condition variable is signaled. 156 | * @return 0 when it is signaled, or -1 on error. 157 | */ 158 | extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut); 159 | 160 | /** Waits for at most 'ms' milliseconds, and returns 0 if the condition 161 | * variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not 162 | * signaled in the allotted time, and -1 on error. 163 | * On some platforms this function is implemented by looping with a delay 164 | * of 1 ms, and so should be avoided if possible. 165 | */ 166 | extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms); 167 | 168 | /*@}*/ 169 | 170 | /* Ends C function definitions when using C++ */ 171 | #ifdef __cplusplus 172 | } 173 | #endif 174 | #include "close_code.h" 175 | 176 | #endif /* _SDL_mutex_h */ 177 | 178 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_name.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SDLname_h_ 3 | #define _SDLname_h_ 4 | 5 | #if defined(__STDC__) || defined(__cplusplus) 6 | #define NeedFunctionPrototypes 1 7 | #endif 8 | 9 | #define SDL_NAME(X) SDL_##X 10 | 11 | #endif /* _SDLname_h_ */ 12 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_platform.h 24 | * Try to get a standard set of platform defines 25 | */ 26 | 27 | #ifndef _SDL_platform_h 28 | #define _SDL_platform_h 29 | 30 | #if defined(_AIX) 31 | #undef __AIX__ 32 | #define __AIX__ 1 33 | #endif 34 | #if defined(__BEOS__) 35 | #undef __BEOS__ 36 | #define __BEOS__ 1 37 | #endif 38 | #if defined(__HAIKU__) 39 | #undef __HAIKU__ 40 | #define __HAIKU__ 1 41 | #endif 42 | #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) 43 | #undef __BSDI__ 44 | #define __BSDI__ 1 45 | #endif 46 | #if defined(_arch_dreamcast) 47 | #undef __DREAMCAST__ 48 | #define __DREAMCAST__ 1 49 | #endif 50 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 51 | #undef __FREEBSD__ 52 | #define __FREEBSD__ 1 53 | #endif 54 | #if defined(__HAIKU__) 55 | #undef __HAIKU__ 56 | #define __HAIKU__ 1 57 | #endif 58 | #if defined(hpux) || defined(__hpux) || defined(__hpux__) 59 | #undef __HPUX__ 60 | #define __HPUX__ 1 61 | #endif 62 | #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) 63 | #undef __IRIX__ 64 | #define __IRIX__ 1 65 | #endif 66 | #if defined(linux) || defined(__linux) || defined(__linux__) 67 | #undef __LINUX__ 68 | #define __LINUX__ 1 69 | #endif 70 | #if defined(__APPLE__) 71 | #undef __MACOSX__ 72 | #define __MACOSX__ 1 73 | #elif defined(macintosh) 74 | #undef __MACOS__ 75 | #define __MACOS__ 1 76 | #endif 77 | #if defined(__NetBSD__) 78 | #undef __NETBSD__ 79 | #define __NETBSD__ 1 80 | #endif 81 | #if defined(__OpenBSD__) 82 | #undef __OPENBSD__ 83 | #define __OPENBSD__ 1 84 | #endif 85 | #if defined(__OS2__) 86 | #undef __OS2__ 87 | #define __OS2__ 1 88 | #endif 89 | #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) 90 | #undef __OSF__ 91 | #define __OSF__ 1 92 | #endif 93 | #if defined(__QNXNTO__) 94 | #undef __QNXNTO__ 95 | #define __QNXNTO__ 1 96 | #endif 97 | #if defined(riscos) || defined(__riscos) || defined(__riscos__) 98 | #undef __RISCOS__ 99 | #define __RISCOS__ 1 100 | #endif 101 | #if defined(__SVR4) 102 | #undef __SOLARIS__ 103 | #define __SOLARIS__ 1 104 | #endif 105 | #if defined(WIN32) || defined(_WIN32) 106 | #undef __WIN32__ 107 | #define __WIN32__ 1 108 | #endif 109 | 110 | #endif /* _SDL_platform_h */ 111 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_quit.h 24 | * Include file for SDL quit event handling 25 | */ 26 | 27 | #ifndef _SDL_quit_h 28 | #define _SDL_quit_h 29 | 30 | #include "SDL_stdinc.h" 31 | #include "SDL_error.h" 32 | 33 | /** @file SDL_quit.h 34 | * An SDL_QUITEVENT is generated when the user tries to close the application 35 | * window. If it is ignored or filtered out, the window will remain open. 36 | * If it is not ignored or filtered, it is queued normally and the window 37 | * is allowed to close. When the window is closed, screen updates will 38 | * complete, but have no effect. 39 | * 40 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 41 | * and SIGTERM (system termination request), if handlers do not already 42 | * exist, that generate SDL_QUITEVENT events as well. There is no way 43 | * to determine the cause of an SDL_QUITEVENT, but setting a signal 44 | * handler in your application will override the default generation of 45 | * quit events for that signal. 46 | */ 47 | 48 | /** @file SDL_quit.h 49 | * There are no functions directly affecting the quit event 50 | */ 51 | 52 | #define SDL_QuitRequested() \ 53 | (SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK)) 54 | 55 | #endif /* _SDL_quit_h */ 56 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_rwops.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_rwops.h 24 | * This file provides a general interface for SDL to read and write 25 | * data sources. It can easily be extended to files, memory, etc. 26 | */ 27 | 28 | #ifndef _SDL_rwops_h 29 | #define _SDL_rwops_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** This is the read/write operation structure -- very basic */ 41 | 42 | typedef struct SDL_RWops { 43 | /** Seek to 'offset' relative to whence, one of stdio's whence values: 44 | * SEEK_SET, SEEK_CUR, SEEK_END 45 | * Returns the final offset in the data source. 46 | */ 47 | int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence); 48 | 49 | /** Read up to 'maxnum' objects each of size 'size' from the data 50 | * source to the area pointed at by 'ptr'. 51 | * Returns the number of objects read, or -1 if the read failed. 52 | */ 53 | int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum); 54 | 55 | /** Write exactly 'num' objects each of size 'objsize' from the area 56 | * pointed at by 'ptr' to data source. 57 | * Returns 'num', or -1 if the write failed. 58 | */ 59 | int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num); 60 | 61 | /** Close and free an allocated SDL_FSops structure */ 62 | int (SDLCALL *close)(struct SDL_RWops *context); 63 | 64 | Uint32 type; 65 | union { 66 | #if defined(__WIN32__) && !defined(__SYMBIAN32__) 67 | struct { 68 | int append; 69 | void *h; 70 | struct { 71 | void *data; 72 | int size; 73 | int left; 74 | } buffer; 75 | } win32io; 76 | #endif 77 | #ifdef HAVE_STDIO_H 78 | struct { 79 | int autoclose; 80 | FILE *fp; 81 | } stdio; 82 | #endif 83 | struct { 84 | Uint8 *base; 85 | Uint8 *here; 86 | Uint8 *stop; 87 | } mem; 88 | struct { 89 | void *data1; 90 | } unknown; 91 | } hidden; 92 | 93 | } SDL_RWops; 94 | 95 | 96 | /** @name Functions to create SDL_RWops structures from various data sources */ 97 | /*@{*/ 98 | 99 | extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode); 100 | 101 | #ifdef HAVE_STDIO_H 102 | extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose); 103 | #endif 104 | 105 | extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size); 106 | extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size); 107 | 108 | extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void); 109 | extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area); 110 | 111 | /*@}*/ 112 | 113 | /** @name Seek Reference Points */ 114 | /*@{*/ 115 | #define RW_SEEK_SET 0 /**< Seek from the beginning of data */ 116 | #define RW_SEEK_CUR 1 /**< Seek relative to current read point */ 117 | #define RW_SEEK_END 2 /**< Seek relative to the end of data */ 118 | /*@}*/ 119 | 120 | /** @name Macros to easily read and write from an SDL_RWops structure */ 121 | /*@{*/ 122 | #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) 123 | #define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) 124 | #define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) 125 | #define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) 126 | #define SDL_RWclose(ctx) (ctx)->close(ctx) 127 | /*@}*/ 128 | 129 | /** @name Read an item of the specified endianness and return in native format */ 130 | /*@{*/ 131 | extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src); 132 | extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src); 133 | extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src); 134 | extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src); 135 | extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src); 136 | extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src); 137 | /*@}*/ 138 | 139 | /** @name Write an item of native format to the specified endianness */ 140 | /*@{*/ 141 | extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value); 142 | extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value); 143 | extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value); 144 | extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value); 145 | extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value); 146 | extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value); 147 | /*@}*/ 148 | 149 | /* Ends C function definitions when using C++ */ 150 | #ifdef __cplusplus 151 | } 152 | #endif 153 | #include "close_code.h" 154 | 155 | #endif /* _SDL_rwops_h */ 156 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_stdinc.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_stdinc.h 24 | * This is a general header that includes C language support 25 | */ 26 | 27 | #ifndef _SDL_stdinc_h 28 | #define _SDL_stdinc_h 29 | 30 | #include "SDL_config.h" 31 | 32 | 33 | #ifdef HAVE_SYS_TYPES_H 34 | #include 35 | #endif 36 | #ifdef HAVE_STDIO_H 37 | #include 38 | #endif 39 | #if defined(STDC_HEADERS) 40 | # include 41 | # include 42 | # include 43 | #else 44 | # if defined(HAVE_STDLIB_H) 45 | # include 46 | # elif defined(HAVE_MALLOC_H) 47 | # include 48 | # endif 49 | # if defined(HAVE_STDDEF_H) 50 | # include 51 | # endif 52 | # if defined(HAVE_STDARG_H) 53 | # include 54 | # endif 55 | #endif 56 | #ifdef HAVE_STRING_H 57 | # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) 58 | # include 59 | # endif 60 | # include 61 | #endif 62 | #ifdef HAVE_STRINGS_H 63 | # include 64 | #endif 65 | #if defined(HAVE_INTTYPES_H) 66 | # include 67 | #elif defined(HAVE_STDINT_H) 68 | # include 69 | #endif 70 | #ifdef HAVE_CTYPE_H 71 | # include 72 | #endif 73 | #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) 74 | # include 75 | #endif 76 | 77 | /** The number of elements in an array */ 78 | #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) 79 | #define SDL_TABLESIZE(table) SDL_arraysize(table) 80 | 81 | /* Use proper C++ casts when compiled as C++ to be compatible with the option 82 | -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above. */ 83 | #ifdef __cplusplus 84 | #define SDL_reinterpret_cast(type, expression) reinterpret_cast(expression) 85 | #define SDL_static_cast(type, expression) static_cast(expression) 86 | #else 87 | #define SDL_reinterpret_cast(type, expression) ((type)(expression)) 88 | #define SDL_static_cast(type, expression) ((type)(expression)) 89 | #endif 90 | 91 | /** @name Basic data types */ 92 | /*@{*/ 93 | typedef enum { 94 | SDL_FALSE = 0, 95 | SDL_TRUE = 1 96 | } SDL_bool; 97 | 98 | typedef int8_t Sint8; 99 | typedef uint8_t Uint8; 100 | typedef int16_t Sint16; 101 | typedef uint16_t Uint16; 102 | typedef int32_t Sint32; 103 | typedef uint32_t Uint32; 104 | 105 | #ifdef SDL_HAS_64BIT_TYPE 106 | typedef int64_t Sint64; 107 | #ifndef SYMBIAN32_GCCE 108 | typedef uint64_t Uint64; 109 | #endif 110 | #else 111 | /* This is really just a hack to prevent the compiler from complaining */ 112 | typedef struct { 113 | Uint32 hi; 114 | Uint32 lo; 115 | } Uint64, Sint64; 116 | #endif 117 | 118 | /*@}*/ 119 | 120 | /** @name Make sure the types really have the right sizes */ 121 | /*@{*/ 122 | #define SDL_COMPILE_TIME_ASSERT(name, x) \ 123 | typedef int SDL_dummy_ ## name[(x) * 2 - 1] 124 | 125 | SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); 126 | SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); 127 | SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); 128 | SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); 129 | SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); 130 | SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); 131 | SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); 132 | SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); 133 | /*@}*/ 134 | 135 | /** @name Enum Size Check 136 | * Check to make sure enums are the size of ints, for structure packing. 137 | * For both Watcom C/C++ and Borland C/C++ the compiler option that makes 138 | * enums having the size of an int must be enabled. 139 | * This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). 140 | */ 141 | /* Enable enums always int in CodeWarrior (for MPW use "-enum int") */ 142 | #ifdef __MWERKS__ 143 | #pragma enumsalwaysint on 144 | #endif 145 | 146 | typedef enum { 147 | DUMMY_ENUM_VALUE 148 | } SDL_DUMMY_ENUM; 149 | 150 | #ifndef __NDS__ 151 | SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); 152 | #endif 153 | /*@}*/ 154 | 155 | #include "begin_code.h" 156 | /* Set up for C function definitions, even when using C++ */ 157 | #ifdef __cplusplus 158 | extern "C" { 159 | #endif 160 | 161 | #ifdef HAVE_MALLOC 162 | #define SDL_malloc malloc 163 | #else 164 | extern DECLSPEC void * SDLCALL SDL_malloc(size_t size); 165 | #endif 166 | 167 | #ifdef HAVE_CALLOC 168 | #define SDL_calloc calloc 169 | #else 170 | extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size); 171 | #endif 172 | 173 | #ifdef HAVE_REALLOC 174 | #define SDL_realloc realloc 175 | #else 176 | extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); 177 | #endif 178 | 179 | #ifdef HAVE_FREE 180 | #define SDL_free free 181 | #else 182 | extern DECLSPEC void SDLCALL SDL_free(void *mem); 183 | #endif 184 | 185 | #if defined(HAVE_ALLOCA) && !defined(alloca) 186 | # if defined(HAVE_ALLOCA_H) 187 | # include 188 | # elif defined(__GNUC__) 189 | # define alloca __builtin_alloca 190 | # elif defined(_MSC_VER) 191 | # include 192 | # define alloca _alloca 193 | # elif defined(__WATCOMC__) 194 | # include 195 | # elif defined(__BORLANDC__) 196 | # include 197 | # elif defined(__DMC__) 198 | # include 199 | # elif defined(__AIX__) 200 | #pragma alloca 201 | # elif defined(__MRC__) 202 | void *alloca (unsigned); 203 | # else 204 | char *alloca (); 205 | # endif 206 | #endif 207 | #ifdef HAVE_ALLOCA 208 | #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) 209 | #define SDL_stack_free(data) 210 | #else 211 | #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count)) 212 | #define SDL_stack_free(data) SDL_free(data) 213 | #endif 214 | 215 | #ifdef HAVE_GETENV 216 | #define SDL_getenv getenv 217 | #else 218 | extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); 219 | #endif 220 | 221 | #ifdef HAVE_PUTENV 222 | #define SDL_putenv putenv 223 | #else 224 | extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); 225 | #endif 226 | 227 | #ifdef HAVE_QSORT 228 | #define SDL_qsort qsort 229 | #else 230 | extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, 231 | int (*compare)(const void *, const void *)); 232 | #endif 233 | 234 | #ifdef HAVE_ABS 235 | #define SDL_abs abs 236 | #else 237 | #define SDL_abs(X) ((X) < 0 ? -(X) : (X)) 238 | #endif 239 | 240 | #define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) 241 | #define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) 242 | 243 | #ifdef HAVE_CTYPE_H 244 | #define SDL_isdigit(X) isdigit(X) 245 | #define SDL_isspace(X) isspace(X) 246 | #define SDL_toupper(X) toupper(X) 247 | #define SDL_tolower(X) tolower(X) 248 | #else 249 | #define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9')) 250 | #define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n')) 251 | #define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X)) 252 | #define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X)) 253 | #endif 254 | 255 | #ifdef HAVE_MEMSET 256 | #define SDL_memset memset 257 | #else 258 | extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len); 259 | #endif 260 | 261 | #if defined(__GNUC__) && defined(i386) 262 | #define SDL_memset4(dst, val, len) \ 263 | do { \ 264 | int u0, u1, u2; \ 265 | __asm__ __volatile__ ( \ 266 | "cld\n\t" \ 267 | "rep ; stosl\n\t" \ 268 | : "=&D" (u0), "=&a" (u1), "=&c" (u2) \ 269 | : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) \ 270 | : "memory" ); \ 271 | } while(0) 272 | #endif 273 | #ifndef SDL_memset4 274 | #define SDL_memset4(dst, val, len) \ 275 | do { \ 276 | unsigned _count = (len); \ 277 | unsigned _n = (_count + 3) / 4; \ 278 | Uint32 *_p = SDL_static_cast(Uint32 *, dst); \ 279 | Uint32 _val = (val); \ 280 | if (len == 0) break; \ 281 | switch (_count % 4) { \ 282 | case 0: do { *_p++ = _val; \ 283 | case 3: *_p++ = _val; \ 284 | case 2: *_p++ = _val; \ 285 | case 1: *_p++ = _val; \ 286 | } while ( --_n ); \ 287 | } \ 288 | } while(0) 289 | #endif 290 | 291 | /* We can count on memcpy existing on Mac OS X and being well-tuned. */ 292 | #if defined(__MACH__) && defined(__APPLE__) 293 | #define SDL_memcpy(dst, src, len) memcpy(dst, src, len) 294 | #elif defined(__GNUC__) && defined(i386) 295 | #define SDL_memcpy(dst, src, len) \ 296 | do { \ 297 | int u0, u1, u2; \ 298 | __asm__ __volatile__ ( \ 299 | "cld\n\t" \ 300 | "rep ; movsl\n\t" \ 301 | "testb $2,%b4\n\t" \ 302 | "je 1f\n\t" \ 303 | "movsw\n" \ 304 | "1:\ttestb $1,%b4\n\t" \ 305 | "je 2f\n\t" \ 306 | "movsb\n" \ 307 | "2:" \ 308 | : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ 309 | : "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst),"2" (src) \ 310 | : "memory" ); \ 311 | } while(0) 312 | #endif 313 | #ifndef SDL_memcpy 314 | #ifdef HAVE_MEMCPY 315 | #define SDL_memcpy memcpy 316 | #elif defined(HAVE_BCOPY) 317 | #define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) 318 | #else 319 | extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); 320 | #endif 321 | #endif 322 | 323 | /* We can count on memcpy existing on Mac OS X and being well-tuned. */ 324 | #if defined(__MACH__) && defined(__APPLE__) 325 | #define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4) 326 | #elif defined(__GNUC__) && defined(i386) 327 | #define SDL_memcpy4(dst, src, len) \ 328 | do { \ 329 | int ecx, edi, esi; \ 330 | __asm__ __volatile__ ( \ 331 | "cld\n\t" \ 332 | "rep ; movsl" \ 333 | : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \ 334 | : "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src) \ 335 | : "memory" ); \ 336 | } while(0) 337 | #endif 338 | #ifndef SDL_memcpy4 339 | #define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2) 340 | #endif 341 | 342 | #if defined(__GNUC__) && defined(i386) 343 | #define SDL_revcpy(dst, src, len) \ 344 | do { \ 345 | int u0, u1, u2; \ 346 | char *dstp = SDL_static_cast(char *, dst); \ 347 | char *srcp = SDL_static_cast(char *, src); \ 348 | int n = (len); \ 349 | if ( n >= 4 ) { \ 350 | __asm__ __volatile__ ( \ 351 | "std\n\t" \ 352 | "rep ; movsl\n\t" \ 353 | "cld\n\t" \ 354 | : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ 355 | : "0" (n >> 2), \ 356 | "1" (dstp+(n-4)), "2" (srcp+(n-4)) \ 357 | : "memory" ); \ 358 | } \ 359 | switch (n & 3) { \ 360 | case 3: dstp[2] = srcp[2]; \ 361 | case 2: dstp[1] = srcp[1]; \ 362 | case 1: dstp[0] = srcp[0]; \ 363 | break; \ 364 | default: \ 365 | break; \ 366 | } \ 367 | } while(0) 368 | #endif 369 | #ifndef SDL_revcpy 370 | extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len); 371 | #endif 372 | 373 | #ifdef HAVE_MEMMOVE 374 | #define SDL_memmove memmove 375 | #elif defined(HAVE_BCOPY) 376 | #define SDL_memmove(d, s, n) bcopy((s), (d), (n)) 377 | #else 378 | #define SDL_memmove(dst, src, len) \ 379 | do { \ 380 | if ( dst < src ) { \ 381 | SDL_memcpy(dst, src, len); \ 382 | } else { \ 383 | SDL_revcpy(dst, src, len); \ 384 | } \ 385 | } while(0) 386 | #endif 387 | 388 | #ifdef HAVE_MEMCMP 389 | #define SDL_memcmp memcmp 390 | #else 391 | extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); 392 | #endif 393 | 394 | #ifdef HAVE_STRLEN 395 | #define SDL_strlen strlen 396 | #else 397 | extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); 398 | #endif 399 | 400 | #ifdef HAVE_STRLCPY 401 | #define SDL_strlcpy strlcpy 402 | #else 403 | extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); 404 | #endif 405 | 406 | #ifdef HAVE_STRLCAT 407 | #define SDL_strlcat strlcat 408 | #else 409 | extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); 410 | #endif 411 | 412 | #ifdef HAVE_STRDUP 413 | #define SDL_strdup strdup 414 | #else 415 | extern DECLSPEC char * SDLCALL SDL_strdup(const char *string); 416 | #endif 417 | 418 | #ifdef HAVE__STRREV 419 | #define SDL_strrev _strrev 420 | #else 421 | extern DECLSPEC char * SDLCALL SDL_strrev(char *string); 422 | #endif 423 | 424 | #ifdef HAVE__STRUPR 425 | #define SDL_strupr _strupr 426 | #else 427 | extern DECLSPEC char * SDLCALL SDL_strupr(char *string); 428 | #endif 429 | 430 | #ifdef HAVE__STRLWR 431 | #define SDL_strlwr _strlwr 432 | #else 433 | extern DECLSPEC char * SDLCALL SDL_strlwr(char *string); 434 | #endif 435 | 436 | #ifdef HAVE_STRCHR 437 | #define SDL_strchr strchr 438 | #elif defined(HAVE_INDEX) 439 | #define SDL_strchr index 440 | #else 441 | extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c); 442 | #endif 443 | 444 | #ifdef HAVE_STRRCHR 445 | #define SDL_strrchr strrchr 446 | #elif defined(HAVE_RINDEX) 447 | #define SDL_strrchr rindex 448 | #else 449 | extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c); 450 | #endif 451 | 452 | #ifdef HAVE_STRSTR 453 | #define SDL_strstr strstr 454 | #else 455 | extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle); 456 | #endif 457 | 458 | #ifdef HAVE_ITOA 459 | #define SDL_itoa itoa 460 | #else 461 | #define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix) 462 | #endif 463 | 464 | #ifdef HAVE__LTOA 465 | #define SDL_ltoa _ltoa 466 | #else 467 | extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix); 468 | #endif 469 | 470 | #ifdef HAVE__UITOA 471 | #define SDL_uitoa _uitoa 472 | #else 473 | #define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix) 474 | #endif 475 | 476 | #ifdef HAVE__ULTOA 477 | #define SDL_ultoa _ultoa 478 | #else 479 | extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix); 480 | #endif 481 | 482 | #ifdef HAVE_STRTOL 483 | #define SDL_strtol strtol 484 | #else 485 | extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base); 486 | #endif 487 | 488 | #ifdef HAVE_STRTOUL 489 | #define SDL_strtoul strtoul 490 | #else 491 | extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base); 492 | #endif 493 | 494 | #ifdef SDL_HAS_64BIT_TYPE 495 | 496 | #ifdef HAVE__I64TOA 497 | #define SDL_lltoa _i64toa 498 | #else 499 | extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix); 500 | #endif 501 | 502 | #ifdef HAVE__UI64TOA 503 | #define SDL_ulltoa _ui64toa 504 | #else 505 | extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix); 506 | #endif 507 | 508 | #ifdef HAVE_STRTOLL 509 | #define SDL_strtoll strtoll 510 | #else 511 | extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base); 512 | #endif 513 | 514 | #ifdef HAVE_STRTOULL 515 | #define SDL_strtoull strtoull 516 | #else 517 | extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base); 518 | #endif 519 | 520 | #endif /* SDL_HAS_64BIT_TYPE */ 521 | 522 | #ifdef HAVE_STRTOD 523 | #define SDL_strtod strtod 524 | #else 525 | extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp); 526 | #endif 527 | 528 | #ifdef HAVE_ATOI 529 | #define SDL_atoi atoi 530 | #else 531 | #define SDL_atoi(X) SDL_strtol(X, NULL, 0) 532 | #endif 533 | 534 | #ifdef HAVE_ATOF 535 | #define SDL_atof atof 536 | #else 537 | #define SDL_atof(X) SDL_strtod(X, NULL) 538 | #endif 539 | 540 | #ifdef HAVE_STRCMP 541 | #define SDL_strcmp strcmp 542 | #else 543 | extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); 544 | #endif 545 | 546 | #ifdef HAVE_STRNCMP 547 | #define SDL_strncmp strncmp 548 | #else 549 | extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); 550 | #endif 551 | 552 | #ifdef HAVE_STRCASECMP 553 | #define SDL_strcasecmp strcasecmp 554 | #elif defined(HAVE__STRICMP) 555 | #define SDL_strcasecmp _stricmp 556 | #else 557 | extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); 558 | #endif 559 | 560 | #ifdef HAVE_STRNCASECMP 561 | #define SDL_strncasecmp strncasecmp 562 | #elif defined(HAVE__STRNICMP) 563 | #define SDL_strncasecmp _strnicmp 564 | #else 565 | extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen); 566 | #endif 567 | 568 | #ifdef HAVE_SSCANF 569 | #define SDL_sscanf sscanf 570 | #else 571 | extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); 572 | #endif 573 | 574 | #ifdef HAVE_SNPRINTF 575 | #define SDL_snprintf snprintf 576 | #else 577 | extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); 578 | #endif 579 | 580 | #ifdef HAVE_VSNPRINTF 581 | #define SDL_vsnprintf vsnprintf 582 | #else 583 | extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); 584 | #endif 585 | 586 | /** @name SDL_ICONV Error Codes 587 | * The SDL implementation of iconv() returns these error codes 588 | */ 589 | /*@{*/ 590 | #define SDL_ICONV_ERROR (size_t)-1 591 | #define SDL_ICONV_E2BIG (size_t)-2 592 | #define SDL_ICONV_EILSEQ (size_t)-3 593 | #define SDL_ICONV_EINVAL (size_t)-4 594 | /*@}*/ 595 | 596 | #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) 597 | #define SDL_iconv_t iconv_t 598 | #define SDL_iconv_open iconv_open 599 | #define SDL_iconv_close iconv_close 600 | #else 601 | typedef struct _SDL_iconv_t *SDL_iconv_t; 602 | extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); 603 | extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); 604 | #endif 605 | extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); 606 | /** This function converts a string between encodings in one pass, returning a 607 | * string that must be freed with SDL_free() or NULL on error. 608 | */ 609 | extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft); 610 | #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) 611 | #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) 612 | #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) 613 | 614 | /* Ends C function definitions when using C++ */ 615 | #ifdef __cplusplus 616 | } 617 | #endif 618 | #include "close_code.h" 619 | 620 | #endif /* _SDL_stdinc_h */ 621 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_syswm.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_syswm.h 24 | * Include file for SDL custom system window manager hooks 25 | */ 26 | 27 | #ifndef _SDL_syswm_h 28 | #define _SDL_syswm_h 29 | 30 | #include "SDL_stdinc.h" 31 | #include "SDL_error.h" 32 | #include "SDL_version.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @file SDL_syswm.h 41 | * Your application has access to a special type of event 'SDL_SYSWMEVENT', 42 | * which contains window-manager specific information and arrives whenever 43 | * an unhandled window event occurs. This event is ignored by default, but 44 | * you can enable it with SDL_EventState() 45 | */ 46 | #ifdef SDL_PROTOTYPES_ONLY 47 | struct SDL_SysWMinfo; 48 | typedef struct SDL_SysWMinfo SDL_SysWMinfo; 49 | #else 50 | 51 | /* This is the structure for custom window manager events */ 52 | #if defined(SDL_VIDEO_DRIVER_X11) 53 | #if defined(__APPLE__) && defined(__MACH__) 54 | /* conflicts with Quickdraw.h */ 55 | #define Cursor X11Cursor 56 | #endif 57 | 58 | #include 59 | #include 60 | 61 | #if defined(__APPLE__) && defined(__MACH__) 62 | /* matches the re-define above */ 63 | #undef Cursor 64 | #endif 65 | 66 | /** These are the various supported subsystems under UNIX */ 67 | typedef enum { 68 | SDL_SYSWM_X11 69 | } SDL_SYSWM_TYPE; 70 | 71 | /** The UNIX custom event structure */ 72 | struct SDL_SysWMmsg { 73 | SDL_version version; 74 | SDL_SYSWM_TYPE subsystem; 75 | union { 76 | XEvent xevent; 77 | } event; 78 | }; 79 | 80 | /** The UNIX custom window manager information structure. 81 | * When this structure is returned, it holds information about which 82 | * low level system it is using, and will be one of SDL_SYSWM_TYPE. 83 | */ 84 | typedef struct SDL_SysWMinfo { 85 | SDL_version version; 86 | SDL_SYSWM_TYPE subsystem; 87 | union { 88 | struct { 89 | Display *display; /**< The X11 display */ 90 | Window window; /**< The X11 display window */ 91 | /** These locking functions should be called around 92 | * any X11 functions using the display variable, 93 | * but not the gfxdisplay variable. 94 | * They lock the event thread, so should not be 95 | * called around event functions or from event filters. 96 | */ 97 | /*@{*/ 98 | void (*lock_func)(void); 99 | void (*unlock_func)(void); 100 | /*@}*/ 101 | 102 | /** @name Introduced in SDL 1.0.2 */ 103 | /*@{*/ 104 | Window fswindow; /**< The X11 fullscreen window */ 105 | Window wmwindow; /**< The X11 managed input window */ 106 | /*@}*/ 107 | 108 | /** @name Introduced in SDL 1.2.12 */ 109 | /*@{*/ 110 | Display *gfxdisplay; /**< The X11 display to which rendering is done */ 111 | /*@}*/ 112 | } x11; 113 | } info; 114 | } SDL_SysWMinfo; 115 | 116 | #elif defined(SDL_VIDEO_DRIVER_NANOX) 117 | #include 118 | 119 | /** The generic custom event structure */ 120 | struct SDL_SysWMmsg { 121 | SDL_version version; 122 | int data; 123 | }; 124 | 125 | /** The windows custom window manager information structure */ 126 | typedef struct SDL_SysWMinfo { 127 | SDL_version version ; 128 | GR_WINDOW_ID window ; /* The display window */ 129 | } SDL_SysWMinfo; 130 | 131 | #elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI) 132 | #define WIN32_LEAN_AND_MEAN 133 | #include 134 | 135 | /** The windows custom event structure */ 136 | struct SDL_SysWMmsg { 137 | SDL_version version; 138 | HWND hwnd; /**< The window for the message */ 139 | UINT msg; /**< The type of message */ 140 | WPARAM wParam; /**< WORD message parameter */ 141 | LPARAM lParam; /**< LONG message parameter */ 142 | }; 143 | 144 | /** The windows custom window manager information structure */ 145 | typedef struct SDL_SysWMinfo { 146 | SDL_version version; 147 | HWND window; /**< The Win32 display window */ 148 | HGLRC hglrc; /**< The OpenGL context, if any */ 149 | } SDL_SysWMinfo; 150 | 151 | #elif defined(SDL_VIDEO_DRIVER_RISCOS) 152 | 153 | /** RISC OS custom event structure */ 154 | struct SDL_SysWMmsg { 155 | SDL_version version; 156 | int eventCode; /**< The window for the message */ 157 | int pollBlock[64]; 158 | }; 159 | 160 | /** The RISC OS custom window manager information structure */ 161 | typedef struct SDL_SysWMinfo { 162 | SDL_version version; 163 | int wimpVersion; /**< Wimp version running under */ 164 | int taskHandle; /**< The RISC OS task handle */ 165 | int window; /**< The RISC OS display window */ 166 | } SDL_SysWMinfo; 167 | 168 | #elif defined(SDL_VIDEO_DRIVER_PHOTON) 169 | #include 170 | #include 171 | 172 | /** The QNX custom event structure */ 173 | struct SDL_SysWMmsg { 174 | SDL_version version; 175 | int data; 176 | }; 177 | 178 | /** The QNX custom window manager information structure */ 179 | typedef struct SDL_SysWMinfo { 180 | SDL_version version; 181 | int data; 182 | } SDL_SysWMinfo; 183 | 184 | #else 185 | 186 | /** The generic custom event structure */ 187 | struct SDL_SysWMmsg { 188 | SDL_version version; 189 | int data; 190 | }; 191 | 192 | /** The generic custom window manager information structure */ 193 | typedef struct SDL_SysWMinfo { 194 | SDL_version version; 195 | int data; 196 | } SDL_SysWMinfo; 197 | 198 | #endif /* video driver type */ 199 | 200 | #endif /* SDL_PROTOTYPES_ONLY */ 201 | 202 | /* Function prototypes */ 203 | /** 204 | * This function gives you custom hooks into the window manager information. 205 | * It fills the structure pointed to by 'info' with custom information and 206 | * returns 0 if the function is not implemented, 1 if the function is 207 | * implemented and no error occurred, and -1 if the version member of 208 | * the 'info' structure is not filled in or not supported. 209 | * 210 | * You typically use this function like this: 211 | * @code 212 | * SDL_SysWMinfo info; 213 | * SDL_VERSION(&info.version); 214 | * if ( SDL_GetWMInfo(&info) ) { ... } 215 | * @endcode 216 | */ 217 | extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info); 218 | 219 | 220 | /* Ends C function definitions when using C++ */ 221 | #ifdef __cplusplus 222 | } 223 | #endif 224 | #include "close_code.h" 225 | 226 | #endif /* _SDL_syswm_h */ 227 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_thread.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_thread_h 24 | #define _SDL_thread_h 25 | 26 | /** @file SDL_thread.h 27 | * Header for the SDL thread management routines 28 | * 29 | * @note These are independent of the other SDL routines. 30 | */ 31 | 32 | #include "SDL_stdinc.h" 33 | #include "SDL_error.h" 34 | 35 | /* Thread synchronization primitives */ 36 | #include "SDL_mutex.h" 37 | 38 | #include "begin_code.h" 39 | /* Set up for C function definitions, even when using C++ */ 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /** The SDL thread structure, defined in SDL_thread.c */ 45 | struct SDL_Thread; 46 | typedef struct SDL_Thread SDL_Thread; 47 | 48 | /** Create a thread */ 49 | #if ((defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)) && !defined(__SYMBIAN32__) 50 | /** 51 | * We compile SDL into a DLL on OS/2. This means, that it's the DLL which 52 | * creates a new thread for the calling process with the SDL_CreateThread() 53 | * API. There is a problem with this, that only the RTL of the SDL.DLL will 54 | * be initialized for those threads, and not the RTL of the calling application! 55 | * To solve this, we make a little hack here. 56 | * We'll always use the caller's _beginthread() and _endthread() APIs to 57 | * start a new thread. This way, if it's the SDL.DLL which uses this API, 58 | * then the RTL of SDL.DLL will be used to create the new thread, and if it's 59 | * the application, then the RTL of the application will be used. 60 | * So, in short: 61 | * Always use the _beginthread() and _endthread() of the calling runtime library! 62 | */ 63 | #define SDL_PASSED_BEGINTHREAD_ENDTHREAD 64 | #ifndef _WIN32_WCE 65 | #include /* This has _beginthread() and _endthread() defined! */ 66 | #endif 67 | 68 | #ifdef __OS2__ 69 | typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg); 70 | typedef void (*pfnSDL_CurrentEndThread)(void); 71 | #else 72 | typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, 73 | unsigned (__stdcall *func)(void *), void *arg, 74 | unsigned, unsigned *threadID); 75 | typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code); 76 | #endif 77 | 78 | extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); 79 | 80 | #ifdef __OS2__ 81 | #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread) 82 | #elif defined(_WIN32_WCE) 83 | #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL) 84 | #else 85 | #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex) 86 | #endif 87 | #else 88 | extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data); 89 | #endif 90 | 91 | /** Get the 32-bit thread identifier for the current thread */ 92 | extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void); 93 | 94 | /** Get the 32-bit thread identifier for the specified thread, 95 | * equivalent to SDL_ThreadID() if the specified thread is NULL. 96 | */ 97 | extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread); 98 | 99 | /** Wait for a thread to finish. 100 | * The return code for the thread function is placed in the area 101 | * pointed to by 'status', if 'status' is not NULL. 102 | */ 103 | extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status); 104 | 105 | /** Forcefully kill a thread without worrying about its state */ 106 | extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread); 107 | 108 | 109 | /* Ends C function definitions when using C++ */ 110 | #ifdef __cplusplus 111 | } 112 | #endif 113 | #include "close_code.h" 114 | 115 | #endif /* _SDL_thread_h */ 116 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_timer_h 24 | #define _SDL_timer_h 25 | 26 | /** @file SDL_timer.h 27 | * Header for the SDL time management routines 28 | */ 29 | 30 | #include "SDL_stdinc.h" 31 | #include "SDL_error.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** This is the OS scheduler timeslice, in milliseconds */ 40 | #define SDL_TIMESLICE 10 41 | 42 | /** This is the maximum resolution of the SDL timer on all platforms */ 43 | #define TIMER_RESOLUTION 10 /**< Experimentally determined */ 44 | 45 | /** 46 | * Get the number of milliseconds since the SDL library initialization. 47 | * Note that this value wraps if the program runs for more than ~49 days. 48 | */ 49 | extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); 50 | 51 | /** Wait a specified number of milliseconds before returning */ 52 | extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); 53 | 54 | /** Function prototype for the timer callback function */ 55 | typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval); 56 | 57 | /** 58 | * Set a callback to run after the specified number of milliseconds has 59 | * elapsed. The callback function is passed the current timer interval 60 | * and returns the next timer interval. If the returned value is the 61 | * same as the one passed in, the periodic alarm continues, otherwise a 62 | * new alarm is scheduled. If the callback returns 0, the periodic alarm 63 | * is cancelled. 64 | * 65 | * To cancel a currently running timer, call SDL_SetTimer(0, NULL); 66 | * 67 | * The timer callback function may run in a different thread than your 68 | * main code, and so shouldn't call any functions from within itself. 69 | * 70 | * The maximum resolution of this timer is 10 ms, which means that if 71 | * you request a 16 ms timer, your callback will run approximately 20 ms 72 | * later on an unloaded system. If you wanted to set a flag signaling 73 | * a frame update at 30 frames per second (every 33 ms), you might set a 74 | * timer for 30 ms: 75 | * @code SDL_SetTimer((33/10)*10, flag_update); @endcode 76 | * 77 | * If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init(). 78 | * 79 | * Under UNIX, you should not use raise or use SIGALRM and this function 80 | * in the same program, as it is implemented using setitimer(). You also 81 | * should not use this function in multi-threaded applications as signals 82 | * to multi-threaded apps have undefined behavior in some implementations. 83 | * 84 | * This function returns 0 if successful, or -1 if there was an error. 85 | */ 86 | extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback); 87 | 88 | /** @name New timer API 89 | * New timer API, supports multiple timers 90 | * Written by Stephane Peter 91 | */ 92 | /*@{*/ 93 | 94 | /** 95 | * Function prototype for the new timer callback function. 96 | * The callback function is passed the current timer interval and returns 97 | * the next timer interval. If the returned value is the same as the one 98 | * passed in, the periodic alarm continues, otherwise a new alarm is 99 | * scheduled. If the callback returns 0, the periodic alarm is cancelled. 100 | */ 101 | typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param); 102 | 103 | /** Definition of the timer ID type */ 104 | typedef struct _SDL_TimerID *SDL_TimerID; 105 | 106 | /** Add a new timer to the pool of timers already running. 107 | * Returns a timer ID, or NULL when an error occurs. 108 | */ 109 | extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param); 110 | 111 | /** 112 | * Remove one of the multiple timers knowing its ID. 113 | * Returns a boolean value indicating success. 114 | */ 115 | extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t); 116 | 117 | /*@}*/ 118 | 119 | /* Ends C function definitions when using C++ */ 120 | #ifdef __cplusplus 121 | } 122 | #endif 123 | #include "close_code.h" 124 | 125 | #endif /* _SDL_timer_h */ 126 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_types.h 24 | * @deprecated Use SDL_stdinc.h instead. 25 | */ 26 | 27 | /* DEPRECATED */ 28 | #include "SDL_stdinc.h" 29 | -------------------------------------------------------------------------------- /third_party/sdl/include/SDL_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 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. 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 13 | Lesser General Public License for more details. 14 | 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 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_version.h 24 | * This header defines the current SDL version 25 | */ 26 | 27 | #ifndef _SDL_version_h 28 | #define _SDL_version_h 29 | 30 | #include "SDL_stdinc.h" 31 | 32 | #include "begin_code.h" 33 | /* Set up for C function definitions, even when using C++ */ 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /** @name Version Number 39 | * Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL 40 | */ 41 | /*@{*/ 42 | #define SDL_MAJOR_VERSION 1 43 | #define SDL_MINOR_VERSION 2 44 | #define SDL_PATCHLEVEL 15 45 | /*@}*/ 46 | 47 | typedef struct SDL_version { 48 | Uint8 major; 49 | Uint8 minor; 50 | Uint8 patch; 51 | } SDL_version; 52 | 53 | /** 54 | * This macro can be used to fill a version structure with the compile-time 55 | * version of the SDL library. 56 | */ 57 | #define SDL_VERSION(X) \ 58 | { \ 59 | (X)->major = SDL_MAJOR_VERSION; \ 60 | (X)->minor = SDL_MINOR_VERSION; \ 61 | (X)->patch = SDL_PATCHLEVEL; \ 62 | } 63 | 64 | /** This macro turns the version numbers into a numeric value: 65 | * (1,2,3) -> (1203) 66 | * This assumes that there will never be more than 100 patchlevels 67 | */ 68 | #define SDL_VERSIONNUM(X, Y, Z) \ 69 | ((X)*1000 + (Y)*100 + (Z)) 70 | 71 | /** This is the version number macro for the current SDL version */ 72 | #define SDL_COMPILEDVERSION \ 73 | SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) 74 | 75 | /** This macro will evaluate to true if compiled with SDL at least X.Y.Z */ 76 | #define SDL_VERSION_ATLEAST(X, Y, Z) \ 77 | (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) 78 | 79 | /** This function gets the version of the dynamically linked SDL library. 80 | * it should NOT be used to fill a version structure, instead you should 81 | * use the SDL_Version() macro. 82 | */ 83 | extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void); 84 | 85 | /* Ends C function definitions when using C++ */ 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | #include "close_code.h" 90 | 91 | #endif /* _SDL_version_h */ 92 | -------------------------------------------------------------------------------- /third_party/sdl/include/begin_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 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 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file begin_code.h 25 | * This file sets things up for C dynamic library function definitions, 26 | * static inlined functions, and structures aligned at 4-byte alignment. 27 | * If you don't like ugly C preprocessor code, don't look at this file. :) 28 | */ 29 | 30 | /** 31 | * @file begin_code.h 32 | * This shouldn't be nested -- included it around code only. 33 | */ 34 | #ifdef _begin_code_h 35 | #error Nested inclusion of begin_code.h 36 | #endif 37 | #define _begin_code_h 38 | 39 | /** 40 | * @def DECLSPEC 41 | * Some compilers use a special export keyword 42 | */ 43 | #ifndef DECLSPEC 44 | # if defined(__BEOS__) || defined(__HAIKU__) 45 | # if defined(__GNUC__) 46 | # define DECLSPEC 47 | # else 48 | # define DECLSPEC __declspec(export) 49 | # endif 50 | # elif defined(__WIN32__) 51 | # ifdef __BORLANDC__ 52 | # ifdef BUILD_SDL 53 | # define DECLSPEC 54 | # else 55 | # define DECLSPEC __declspec(dllimport) 56 | # endif 57 | # else 58 | # define DECLSPEC __declspec(dllexport) 59 | # endif 60 | # elif defined(__OS2__) 61 | # ifdef __WATCOMC__ 62 | # ifdef BUILD_SDL 63 | # define DECLSPEC __declspec(dllexport) 64 | # else 65 | # define DECLSPEC 66 | # endif 67 | # elif defined (__GNUC__) && __GNUC__ < 4 68 | # /* Added support for GCC-EMX = 4 81 | # define DECLSPEC __attribute__ ((visibility("default"))) 82 | # else 83 | # define DECLSPEC 84 | # endif 85 | # endif 86 | #endif 87 | 88 | /** 89 | * @def SDLCALL 90 | * By default SDL uses the C calling convention 91 | */ 92 | #ifndef SDLCALL 93 | # if defined(__WIN32__) && !defined(__GNUC__) 94 | # define SDLCALL __cdecl 95 | # elif defined(__OS2__) 96 | # if defined (__GNUC__) && __GNUC__ < 4 97 | # /* Added support for GCC-EMX >", 21 | # header: "".} [T] = object 22 | CppUniquePtr* {.importcpp: "std::unique_ptr", header: "", byref.} [T] = object 23 | CppVector* {.importcpp"std::vector", header: "", byref.} [T] = object 24 | CppString* {.importcpp: "std::string", header: "", byref.} = object 25 | 26 | proc newCppVector*[T](): CppVector[T] {.importcpp: "std::vector<'0>()", header: "", constructor.} 27 | proc newCppVector*[T](size: int): CppVector[T] {.importcpp: "std::vector<'0>(#)", header: "", constructor.} 28 | proc len*(v: CppVector): int {.importcpp: "#.size()", header: "".} 29 | proc add*[T](v: var CppVector[T], elem: T){.importcpp: "#.push_back(#)", header: "".} 30 | proc `[]`*[T](v: CppVector[T], idx: int): T{.importcpp: "#[#]", header: "".} 31 | proc `[]`*[T](v: var CppVector[T], idx: int): var T{.importcpp: "#[#]", header: "".} 32 | --------------------------------------------------------------------------------