├── !Docs ├── Shadow.png ├── Sprites.png └── Textures.png ├── .github ├── downloads │ └── Castenstein 1.0.3.zip └── screenshots │ ├── 001.jpg │ ├── 001.thumb.jpg │ ├── 002.jpg │ ├── 002.thumb.jpg │ ├── 003.jpg │ ├── 003.thumb.jpg │ ├── 004.jpg │ ├── 004.thumb.jpg │ ├── 005.jpg │ ├── 005.thumb.jpg │ ├── 006.jpg │ └── 006.thumb.jpg ├── .gitignore ├── Castenstein.sln ├── Castenstein ├── AnimatedTexture.cpp ├── AnimatedTexture.h ├── Block.cpp ├── Block.h ├── Castenstein.h ├── Castenstein.ico ├── Castenstein.rc ├── Castenstein.vcxproj ├── Castenstein.vcxproj.filters ├── Color.cpp ├── Color.h ├── Engine.cpp ├── Engine.h ├── FPSCounter.cpp ├── FPSCounter.h ├── Font.cpp ├── Font.h ├── Graphics.cpp ├── Graphics.h ├── Input.cpp ├── Input.h ├── Map.cpp ├── Map.h ├── Media │ ├── Images │ │ ├── Font.png │ │ └── Icon.png │ ├── Maps │ │ └── Map.txt │ ├── Sprites │ │ ├── Barrel.png │ │ ├── Drum.png │ │ ├── Grail.png │ │ ├── Guard.png │ │ ├── Light.png │ │ ├── Pillar.png │ │ ├── Plant1.png │ │ ├── Plant2.png │ │ ├── Skeleton1.png │ │ ├── Skeleton2.png │ │ ├── Soldier.png │ │ └── Table.png │ └── Textures │ │ ├── Bricks1.png │ │ ├── Bricks2.png │ │ ├── Ceiling1.png │ │ ├── Ceiling2.png │ │ ├── Door.png │ │ ├── Grass.png │ │ ├── Grass_Plate.png │ │ ├── Grass_Shadow.png │ │ ├── Sky.png │ │ ├── StoneFloor.png │ │ ├── Stones.png │ │ ├── Stones_Logo1.png │ │ ├── Stones_Logo2.png │ │ ├── Stones_Moss.png │ │ ├── Tiles1.png │ │ ├── Tiles2.png │ │ ├── Tiles2_Shadow.png │ │ ├── Wood.png │ │ └── Wood_Logo.png ├── MouseButton.h ├── Player.cpp ├── Player.h ├── Point.cpp ├── Point.h ├── RenderThread.cpp ├── RenderThread.h ├── SDL │ ├── SDL.h │ ├── SDL_assert.h │ ├── SDL_atomic.h │ ├── SDL_audio.h │ ├── SDL_bits.h │ ├── SDL_blendmode.h │ ├── SDL_clipboard.h │ ├── SDL_config.h │ ├── SDL_config_android.h │ ├── SDL_config_iphoneos.h │ ├── SDL_config_macosx.h │ ├── SDL_config_minimal.h │ ├── SDL_config_pandora.h │ ├── SDL_config_psp.h │ ├── SDL_config_windows.h │ ├── SDL_config_winrt.h │ ├── SDL_config_wiz.h │ ├── SDL_copying.h │ ├── SDL_cpuinfo.h │ ├── SDL_egl.h │ ├── SDL_endian.h │ ├── SDL_error.h │ ├── SDL_events.h │ ├── SDL_filesystem.h │ ├── SDL_gamecontroller.h │ ├── SDL_gesture.h │ ├── SDL_haptic.h │ ├── SDL_hints.h │ ├── SDL_image.h │ ├── SDL_joystick.h │ ├── SDL_keyboard.h │ ├── SDL_keycode.h │ ├── SDL_loadso.h │ ├── SDL_log.h │ ├── SDL_main.h │ ├── SDL_messagebox.h │ ├── SDL_mouse.h │ ├── SDL_mutex.h │ ├── SDL_name.h │ ├── SDL_opengl.h │ ├── SDL_opengl_glext.h │ ├── SDL_opengles.h │ ├── SDL_opengles2.h │ ├── SDL_opengles2_gl2.h │ ├── SDL_opengles2_gl2ext.h │ ├── SDL_opengles2_gl2platform.h │ ├── SDL_opengles2_khrplatform.h │ ├── SDL_pixels.h │ ├── SDL_platform.h │ ├── SDL_power.h │ ├── SDL_quit.h │ ├── SDL_rect.h │ ├── SDL_render.h │ ├── SDL_revision.h │ ├── SDL_rwops.h │ ├── SDL_scancode.h │ ├── SDL_shape.h │ ├── SDL_stdinc.h │ ├── SDL_surface.h │ ├── SDL_system.h │ ├── SDL_syswm.h │ ├── SDL_test.h │ ├── SDL_test_assert.h │ ├── SDL_test_common.h │ ├── SDL_test_compare.h │ ├── SDL_test_crc32.h │ ├── SDL_test_font.h │ ├── SDL_test_fuzzer.h │ ├── SDL_test_harness.h │ ├── SDL_test_images.h │ ├── SDL_test_log.h │ ├── SDL_test_md5.h │ ├── SDL_test_random.h │ ├── SDL_thread.h │ ├── SDL_timer.h │ ├── SDL_touch.h │ ├── SDL_types.h │ ├── SDL_version.h │ ├── SDL_video.h │ ├── begin_code.h │ └── close_code.h ├── SDL2.dll ├── SDL2.lib ├── SDL2_image.dll ├── SDL2_image.lib ├── SDL2main.lib ├── SDLUtility.h ├── Sky.cpp ├── Sky.h ├── Sprite.cpp ├── Sprite.h ├── Texture.cpp ├── Texture.h ├── libjpeg-9.dll ├── libpng16-16.dll ├── libtiff-5.dll ├── libwebp-4.dll ├── main.cpp ├── resource.h └── zlib1.dll ├── LICENSE.md └── README.md /!Docs/Shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/!Docs/Shadow.png -------------------------------------------------------------------------------- /!Docs/Sprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/!Docs/Sprites.png -------------------------------------------------------------------------------- /!Docs/Textures.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/!Docs/Textures.png -------------------------------------------------------------------------------- /.github/downloads/Castenstein 1.0.3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/downloads/Castenstein 1.0.3.zip -------------------------------------------------------------------------------- /.github/screenshots/001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/001.jpg -------------------------------------------------------------------------------- /.github/screenshots/001.thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/001.thumb.jpg -------------------------------------------------------------------------------- /.github/screenshots/002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/002.jpg -------------------------------------------------------------------------------- /.github/screenshots/002.thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/002.thumb.jpg -------------------------------------------------------------------------------- /.github/screenshots/003.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/003.jpg -------------------------------------------------------------------------------- /.github/screenshots/003.thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/003.thumb.jpg -------------------------------------------------------------------------------- /.github/screenshots/004.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/004.jpg -------------------------------------------------------------------------------- /.github/screenshots/004.thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/004.thumb.jpg -------------------------------------------------------------------------------- /.github/screenshots/005.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/005.jpg -------------------------------------------------------------------------------- /.github/screenshots/005.thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/005.thumb.jpg -------------------------------------------------------------------------------- /.github/screenshots/006.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/006.jpg -------------------------------------------------------------------------------- /.github/screenshots/006.thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/.github/screenshots/006.thumb.jpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | bin/ 3 | obj/ 4 | Debug/ 5 | Release/ 6 | ipch/ 7 | TestResults/ 8 | *.suo 9 | *.user 10 | *.sdf 11 | *.opensdf 12 | *.opendb 13 | *.VC.db 14 | *.aps 15 | [Tt]humbs.db 16 | *~*.xlsx 17 | *~*.docx 18 | 19 | $Build/ -------------------------------------------------------------------------------- /Castenstein.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Castenstein", "Castenstein\Castenstein.vcxproj", "{C9C7B714-2749-4A63-B4FA-081986E3A113}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C9C7B714-2749-4A63-B4FA-081986E3A113}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {C9C7B714-2749-4A63-B4FA-081986E3A113}.Debug|Win32.Build.0 = Debug|Win32 16 | {C9C7B714-2749-4A63-B4FA-081986E3A113}.Release|Win32.ActiveCfg = Release|Win32 17 | {C9C7B714-2749-4A63-B4FA-081986E3A113}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Castenstein/AnimatedTexture.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | AnimatedTexture::AnimatedTexture(string path, Color fogColor, float ambientBrightness) 4 | { 5 | SDL_Surface *surface = Engine::LoadSDLSurface(path); 6 | if (surface->w / surface->h != surface->w * 1.f / surface->h || (surface->w & (surface->w - 1))) throw; 7 | FrameCount = surface->w / surface->h; 8 | Frames = new Texture*[FrameCount]; 9 | 10 | for (int i = 0; i < FrameCount; i++) 11 | { 12 | Frames[i] = new Texture(); 13 | Frames[i]->Size = surface->h; 14 | Frames[i]->SizeExponent = int(log2(Frames[i]->Size)); 15 | Frames[i]->Buffer = new int**[2]; 16 | for (int j = 0; j < 2; j++) Frames[i]->Buffer[j] = new int*[FogLevels]; 17 | Frames[i]->LoadFromSDLSurface(surface, i, FrameCount, fogColor, ambientBrightness); 18 | } 19 | 20 | SDL_FreeSurface(surface); 21 | } 22 | AnimatedTexture::AnimatedTexture(Texture *texture) 23 | { 24 | FrameCount = 1; 25 | Frames = new Texture*[1]; 26 | Frames[0] = texture; 27 | } 28 | AnimatedTexture::~AnimatedTexture() 29 | { 30 | delete[] Frames; 31 | } -------------------------------------------------------------------------------- /Castenstein/AnimatedTexture.h: -------------------------------------------------------------------------------- 1 | class AnimatedTexture 2 | { 3 | public: 4 | Texture **Frames; 5 | int FrameCount; 6 | 7 | AnimatedTexture(string path, Color fogColor, float ambientBrightness); 8 | AnimatedTexture(Texture *texture); 9 | ~AnimatedTexture(); 10 | }; -------------------------------------------------------------------------------- /Castenstein/Block.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | Block::Block() 4 | { 5 | IsWall = false; 6 | BlockTexture = nullptr; 7 | CeilingTexture = nullptr; 8 | } 9 | Block::Block(bool isWall, Texture *blockTexture, Texture *ceilingTexture) 10 | { 11 | IsWall = isWall; 12 | BlockTexture = blockTexture; 13 | CeilingTexture = ceilingTexture; 14 | } -------------------------------------------------------------------------------- /Castenstein/Block.h: -------------------------------------------------------------------------------- 1 | class Block 2 | { 3 | private: 4 | Block(); 5 | public: 6 | bool IsWall; 7 | Texture *BlockTexture; 8 | Texture *CeilingTexture; 9 | 10 | Block(bool isWall, Texture *blockTexture, Texture *ceilingTexture); 11 | 12 | friend class Map; 13 | }; -------------------------------------------------------------------------------- /Castenstein/Castenstein.h: -------------------------------------------------------------------------------- 1 | #pragma comment(lib, "SDL2.lib") 2 | #pragma comment(lib, "SDL2main.lib") 3 | #pragma comment(lib, "SDL2_image.lib") 4 | #pragma comment(linker, "/subsystem:windows") 5 | #define _SCL_SECURE_NO_WARNINGS 6 | 7 | #include "SDL\SDL.h" 8 | #include "SDL\SDL_image.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | using namespace std; 20 | 21 | #define clip(value, start, end) min(max(value, start), end) 22 | #define sind(value) sin((value) * float(M_PI / 180)) 23 | #define cosd(value) cos((value) * float(M_PI / 180)) 24 | #define tand(value) tan((value) * float(M_PI / 180)) 25 | 26 | const int FogDetail = 7, FogLevels = 1 << FogDetail; 27 | #define ComputeFogLevel(distance, fogRange) (FogLevels - (fogRange == 0 ? 1 : clip(int((distance) * FogLevels / (fogRange)), 1, FogLevels))) 28 | 29 | #include "MouseButton.h" 30 | #include "Point.h" 31 | #include "Color.h" 32 | #include "Font.h" 33 | #include "Graphics.h" 34 | #include "Input.h" 35 | #include "Texture.h" 36 | #include "AnimatedTexture.h" 37 | #include "Sky.h" 38 | #include "Block.h" 39 | #include "Map.h" 40 | #include "Player.h" 41 | #include "Sprite.h" 42 | #include "RenderThread.h" 43 | #include "Engine.h" 44 | #include "FPSCounter.h" -------------------------------------------------------------------------------- /Castenstein/Castenstein.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Castenstein.ico -------------------------------------------------------------------------------- /Castenstein/Castenstein.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Castenstein.rc -------------------------------------------------------------------------------- /Castenstein/Color.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | Color::Color() 4 | { 5 | R = 0; 6 | G = 0; 7 | B = 0; 8 | } 9 | Color::Color(int r, int g, int b) 10 | { 11 | R = r; 12 | G = g; 13 | B = b; 14 | } 15 | Color::Color(int rgb) 16 | { 17 | R = (rgb & 0xff0000) >> 16; 18 | G = (rgb & 0xff00) >> 8; 19 | B = rgb & 0xff; 20 | } 21 | 22 | int Color::getRGB() 23 | { 24 | return R << 16 | G << 8 | B; 25 | } -------------------------------------------------------------------------------- /Castenstein/Color.h: -------------------------------------------------------------------------------- 1 | struct Color 2 | { 3 | public: 4 | int R, G, B; 5 | 6 | Color(); 7 | Color(int r, int g, int b); 8 | Color(int rgb); 9 | 10 | int getRGB(); 11 | }; -------------------------------------------------------------------------------- /Castenstein/Engine.h: -------------------------------------------------------------------------------- 1 | class Engine 2 | { 3 | private: 4 | static int Width; 5 | static int Height; 6 | static SDL_Window *Window; 7 | static SDL_Renderer *Renderer; 8 | static SDL_Texture *ScreenTexture; 9 | 10 | static int ThreadCount; 11 | static RenderThread **Threads; 12 | static float *FloorDistanceCache; 13 | static int *FloorBrightnessCache; 14 | static int *SkyVCache; 15 | 16 | static int *BackBuffer; 17 | static float *DepthBuffer; 18 | static Map *CurrentMap; 19 | static Sky *CurrentSky; 20 | static Player *CurrentPlayer; 21 | static list *Sprites; 22 | 23 | static int RenderThreadFunction(void *data); 24 | static SDL_Surface* LoadSDLSurface(string path); 25 | public: 26 | static void Initialize(int width, int height); 27 | static void Destroy(); 28 | static void Render(); 29 | static void Present(); 30 | static void AddSprite(Sprite *sprite); 31 | 32 | static string getTitle(); 33 | static int getWidth(); 34 | static int getHeight(); 35 | static Map *getMap(); 36 | static Sky *getSky(); 37 | static Player *getPlayer(); 38 | 39 | static void setTitle(string title); 40 | static void setIcon(string path); 41 | static void setMap(Map *map); 42 | static void setSky(Sky *sky); 43 | static void setPlayer(Player *player); 44 | 45 | friend class Input; 46 | friend class Graphics; 47 | friend class Font; 48 | friend class Player; 49 | friend class Texture; 50 | friend class AnimatedTexture; 51 | friend class Sky; 52 | }; -------------------------------------------------------------------------------- /Castenstein/FPSCounter.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | FPSCounter::FPSCounter() 4 | { 5 | Interval = 1000; 6 | FPS = 0; 7 | FPSCount = 0; 8 | FrameTime = 0; 9 | MedianFrameTime = 0; 10 | LastMeasuredTime = clock(); 11 | } 12 | FPSCounter::FPSCounter(int interval) 13 | { 14 | Interval = interval; 15 | FPS = 0; 16 | FPSCount = 0; 17 | FrameTime = 0; 18 | MedianFrameTime = 0; 19 | LastMeasuredTime = clock(); 20 | } 21 | 22 | void FPSCounter::Frame() 23 | { 24 | clock_t time = clock(); 25 | if (time - LastMeasuredTime > Interval) 26 | { 27 | FPS = FPSCount * 1000 / Interval; 28 | MedianFrameTime = FPSCount == 0 ? 0 : Interval / FPSCount; 29 | FPSCount = 0; 30 | LastMeasuredTime = time; 31 | } 32 | FrameTime = time - LastFrame; 33 | LastFrame = time; 34 | FPSCount++; 35 | } 36 | 37 | int FPSCounter::getInterval() 38 | { 39 | return Interval; 40 | } 41 | int FPSCounter::getFPS() 42 | { 43 | return FPS; 44 | } 45 | int FPSCounter::getFrameTime() 46 | { 47 | return FrameTime; 48 | } 49 | int FPSCounter::getMedianFrameTime() 50 | { 51 | return MedianFrameTime; 52 | } 53 | 54 | void FPSCounter::setInterval(int interval) 55 | { 56 | Interval = interval; 57 | } -------------------------------------------------------------------------------- /Castenstein/FPSCounter.h: -------------------------------------------------------------------------------- 1 | class FPSCounter 2 | { 3 | private: 4 | int Interval, FPS, FPSCount, FrameTime, MedianFrameTime; 5 | clock_t LastMeasuredTime, LastFrame; 6 | public: 7 | FPSCounter(); 8 | FPSCounter(int interval); 9 | 10 | void Frame(); 11 | 12 | int getInterval(); 13 | int getFPS(); 14 | int getFrameTime(); 15 | int getMedianFrameTime(); 16 | 17 | void setInterval(int interval); 18 | }; -------------------------------------------------------------------------------- /Castenstein/Font.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | Font::Font(string path) 4 | { 5 | SDL_Surface *bitmap = Engine::LoadSDLSurface(path); 6 | if (bitmap->w % 16 > 0 || bitmap->h % 16 > 0 || bitmap->w > 4096) throw; 7 | 8 | Width = bitmap->w >> 4; 9 | Height = bitmap->h >> 4; 10 | CharacterSpacing = 2; 11 | Buffer = new unsigned char[bitmap->w * bitmap->h]; 12 | CharacterDimensions = new Point[256]; 13 | 14 | unsigned char *bitmapPtr = Buffer; 15 | for (int i = 0, *buffer = (int*)bitmap->pixels; i < bitmap->w * bitmap->h; i++) 16 | { 17 | int r = (*buffer & 0xff0000) >> 16; 18 | int g = (*buffer & 0xff00) >> 8; 19 | int b = *buffer & 0xff; 20 | buffer++; 21 | *bitmapPtr++ = (r + g + b) / 3; 22 | } 23 | SDL_FreeSurface(bitmap); 24 | 25 | for (int i = 0; i < 256; i++) 26 | { 27 | CharacterDimensions[i] = Point(0, CharacterSpacing * 3); 28 | int characterX = (i & 15) * Width, characterY = (i >> 4) * Height; 29 | 30 | bool found = false; 31 | for (int x = 0; x < Width; x++) 32 | { 33 | for (int y = 0; y < Height; y++) 34 | { 35 | if (Buffer[(x + characterX) + (y + characterY) * (Width << 4)]) 36 | { 37 | CharacterDimensions[i].X = x; 38 | found = true; 39 | break; 40 | } 41 | } 42 | if (found) break; 43 | } 44 | 45 | found = false; 46 | for (int x = Width - 1; x >= 0; x--) 47 | { 48 | for (int y = 0; y < Height; y++) 49 | { 50 | if (Buffer[(x + characterX) + (y + characterY) * (Width << 4)]) 51 | { 52 | CharacterDimensions[i].Y = x + 1; 53 | found = true; 54 | break; 55 | } 56 | } 57 | if (found) break; 58 | } 59 | } 60 | } 61 | Font::~Font() 62 | { 63 | delete[] Buffer, CharacterDimensions; 64 | } 65 | 66 | int Font::getCharacterSpacing() 67 | { 68 | return CharacterSpacing; 69 | } 70 | 71 | void Font::setCharacterSpacing(int characterSpacing) 72 | { 73 | CharacterSpacing = characterSpacing; 74 | } -------------------------------------------------------------------------------- /Castenstein/Font.h: -------------------------------------------------------------------------------- 1 | class Font 2 | { 3 | private: 4 | int Width, Height, CharacterSpacing; 5 | unsigned char *Buffer; 6 | Point *CharacterDimensions; 7 | public: 8 | Font(string path); 9 | ~Font(); 10 | 11 | int getCharacterSpacing(); 12 | 13 | void setCharacterSpacing(int characterSpacing); 14 | 15 | friend class Graphics; 16 | }; -------------------------------------------------------------------------------- /Castenstein/Graphics.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | void Graphics::FillRectangle(int x, int y, int width, int height, Color color) 4 | { 5 | x = clip(x, 0, Engine::Width); 6 | y = clip(y, 0, Engine::Height); 7 | width = clip(x + width, 0, Engine::Width); 8 | height = clip(y + height, 0, Engine::Height); 9 | int rgb = color.getRGB(); 10 | 11 | for (int y2 = y; y2 < height; y2++) 12 | { 13 | for (int x2 = x, *backBuffer = &Engine::BackBuffer[y2 * Engine::Width + x2]; x2 < width; x2++) 14 | { 15 | *backBuffer++ = rgb; 16 | } 17 | } 18 | } 19 | void Graphics::FillRectangle(int x, int y, int width, int height, Color color, float opacity) 20 | { 21 | x = clip(x, 0, Engine::Width); 22 | y = clip(y, 0, Engine::Height); 23 | width = clip(x + width, 0, Engine::Width); 24 | height = clip(y + height, 0, Engine::Height); 25 | opacity = clip(opacity, 0, 1); 26 | int opacityA = int(opacity * 256); 27 | int opacityB = 256 - opacityA; 28 | 29 | for (int y2 = y; y2 < height; y2++) 30 | { 31 | for (int x2 = x, *backBuffer = &Engine::BackBuffer[y2 * Engine::Width + x2]; x2 < width; x2++) 32 | { 33 | int r = (*backBuffer & 0xff0000) >> 16; 34 | int g = (*backBuffer & 0xff00) >> 8; 35 | int b = *backBuffer & 0xff; 36 | *backBuffer++ = (r * opacityB + color.R * opacityA) >> 8 << 16 | (g * opacityB + color.B * opacityA) >> 8 << 8 | (b * opacityB + color.B * opacityA) >> 8; 37 | } 38 | } 39 | } 40 | void Graphics::DrawString(int x, int y, string text, Font *font) 41 | { 42 | DrawString(x, y, text, font, Color(255, 255, 255)); 43 | } 44 | void Graphics::DrawString(int x, int y, string text, Font *font, Color color) 45 | { 46 | int textLength = int(text.length()); 47 | unsigned char *bitmapPtr = font->Buffer; 48 | 49 | for (int i = 0, x2 = x; i < textLength; i++) 50 | { 51 | char character = text[i]; 52 | int characterX = (text[i] & 15) * font->Width, characterY = (text[i] >> 4) * font->Height; 53 | Point characterDimension = font->CharacterDimensions[character]; 54 | int characterWidth = characterDimension.Y - characterDimension.X; 55 | 56 | for (int py = 0; py < font->Height; py++) 57 | { 58 | for (int px = 0, *backBufferPtr = &Engine::BackBuffer[x2 + (y + py) * Engine::Width]; px < characterWidth; px++) 59 | { 60 | int r = (*backBufferPtr & 0xff0000) >> 16; 61 | int g = (*backBufferPtr & 0xff00) >> 8; 62 | int b = *backBufferPtr & 0xff; 63 | int opacityA = bitmapPtr[(px + characterDimension.X + characterX) + (py + characterY) * (font->Width << 4)]; 64 | int opacityB = 255 - opacityA; 65 | *backBufferPtr++ = (r * opacityB + color.R * opacityA) >> 8 << 16 | int(g * opacityB + color.G * opacityA) >> 8 << 8 | (b * opacityB + color.B * opacityA) >> 8; 66 | } 67 | } 68 | x2 += characterWidth + font->CharacterSpacing; 69 | } 70 | } 71 | void Graphics::DrawMinimap(int x, int y, int size, float relativeBlockSize, float opacity, float shadedAreaBrightness) 72 | { 73 | opacity = clip(opacity, 0, 1); 74 | 75 | int radius = (size >> 1); 76 | int radius2 = radius * radius; 77 | float blockSize = size * relativeBlockSize; 78 | float sinRotation = sind(Engine::CurrentPlayer->Rotation); 79 | float cosRotation = cosd(Engine::CurrentPlayer->Rotation); 80 | 81 | for (int y2 = 0, *backBuffer = &Engine::BackBuffer[x + y * Engine::Width]; y2 < size; y2++) 82 | { 83 | for (int x2 = 0; x2 < size; x2++) 84 | { 85 | if ((x2 - radius) * (x2 - radius) + (y2 - radius) * (y2 - radius) < radius2) 86 | { 87 | float ox = (x2 - radius) / blockSize; 88 | float oy = (y2 - radius) / blockSize; 89 | float mapX = ox * cosRotation - oy * sinRotation + Engine::CurrentPlayer->X; 90 | float mapY = ox * sinRotation + oy * cosRotation + Engine::CurrentPlayer->Y; 91 | 92 | Color color; 93 | float actualOpacity = opacity; 94 | if (mapX >= 0 && mapX < Engine::CurrentMap->Size.X && mapY >= 0 && mapY < Engine::CurrentMap->Size.Y && Engine::CurrentMap->Blocks[int(mapY)][int(mapX)]->BlockTexture != nullptr) 95 | { 96 | Texture *texture = Engine::CurrentMap->Blocks[int(mapY)][int(mapX)]->BlockTexture; 97 | float brightness = abs(x2 - radius) < radius - y2 ? 1 : shadedAreaBrightness; 98 | if (!Engine::CurrentMap->Blocks[int(mapY)][int(mapX)]->IsWall && Engine::CurrentMap->Blocks[int(mapY)][int(mapX)]->CeilingTexture != nullptr) brightness *= Engine::CurrentMap->AmbientBrightness; 99 | color = texture->AverageColor; 100 | color.R = int(color.R * brightness); 101 | color.G = int(color.G * brightness); 102 | color.B = int(color.B * brightness); 103 | } 104 | else 105 | { 106 | color = Color(0, 0, 0); 107 | actualOpacity /= 4; 108 | } 109 | 110 | int screenR = (*backBuffer & 0xff0000) >> 16; 111 | int screenG = (*backBuffer & 0xff00) >> 8; 112 | int screenB = *backBuffer & 0xff; 113 | int pixelR = int(color.R * actualOpacity + screenR * (1 - actualOpacity)); 114 | int pixelG = int(color.G * actualOpacity + screenG * (1 - actualOpacity)); 115 | int pixelB = int(color.B * actualOpacity + screenB * (1 - actualOpacity)); 116 | *backBuffer = pixelR << 16 | pixelG << 8 | pixelB; 117 | } 118 | backBuffer++; 119 | } 120 | backBuffer += Engine::Width - size; 121 | } 122 | } -------------------------------------------------------------------------------- /Castenstein/Graphics.h: -------------------------------------------------------------------------------- 1 | class Graphics 2 | { 3 | public: 4 | static void FillRectangle(int x, int y, int width, int height, Color color); 5 | static void FillRectangle(int x, int y, int width, int height, Color color, float opacity); 6 | static void DrawString(int x, int y, string text, Font *font); 7 | static void DrawString(int x, int y, string text, Font *font, Color color); 8 | static void DrawMinimap(int x, int y, int size, float relativeBlockSize, float opacity, float shadedAreaBrightness); 9 | }; -------------------------------------------------------------------------------- /Castenstein/Input.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | bool Input::Quit; 4 | int Input::MouseX; 5 | int Input::MouseY; 6 | int Input::MouseZ; 7 | int Input::MouseXSpeed; 8 | int Input::MouseYSpeed; 9 | int Input::MouseZSpeed; 10 | bool *Input::MouseDown; 11 | bool *Input::KeyDown; 12 | 13 | void Input::Initialize() 14 | { 15 | MouseDown = new bool[3]; 16 | KeyDown = new bool[2048]; 17 | memset(MouseDown, 0, 3); 18 | memset(KeyDown, 0, 2048); 19 | } 20 | void Input::Destroy() 21 | { 22 | delete[] MouseDown; 23 | delete[] KeyDown; 24 | } 25 | 26 | void Input::Update() 27 | { 28 | MouseXSpeed = 0; 29 | MouseYSpeed = 0; 30 | MouseZSpeed = 0; 31 | 32 | SDL_Event e; 33 | int key; 34 | 35 | while (SDL_PollEvent(&e)) 36 | { 37 | switch (e.type) 38 | { 39 | case SDL_QUIT: 40 | Quit = true; 41 | break; 42 | case SDL_MOUSEBUTTONDOWN: 43 | switch (e.button.button) 44 | { 45 | case SDL_BUTTON_LEFT: MouseDown[0] = true; break; 46 | case SDL_BUTTON_RIGHT: MouseDown[1] = true; break; 47 | case SDL_BUTTON_MIDDLE: MouseDown[2] = true; break; 48 | } 49 | break; 50 | case SDL_MOUSEBUTTONUP: 51 | switch (e.button.button) 52 | { 53 | case SDL_BUTTON_LEFT: MouseDown[0] = false; break; 54 | case SDL_BUTTON_RIGHT: MouseDown[1] = false; break; 55 | case SDL_BUTTON_MIDDLE: MouseDown[2] = false; break; 56 | } 57 | break; 58 | case SDL_MOUSEMOTION: 59 | MouseXSpeed += (e.motion.x - MouseX); 60 | MouseYSpeed += (e.motion.y - MouseY); 61 | MouseX = e.motion.x; 62 | MouseY = e.motion.y; 63 | break; 64 | case SDL_MOUSEWHEEL: 65 | MouseZ += e.wheel.y; 66 | MouseZSpeed = e.wheel.y; 67 | break; 68 | case SDL_KEYDOWN: 69 | key = e.key.keysym.sym; 70 | if ((key & SDLK_SCANCODE_MASK) == SDLK_SCANCODE_MASK) key += 1024 - SDLK_SCANCODE_MASK; 71 | if (key < 2048) KeyDown[key] = true; 72 | break; 73 | case SDL_KEYUP: 74 | key = e.key.keysym.sym; 75 | if ((key & SDLK_SCANCODE_MASK) == SDLK_SCANCODE_MASK) key += 1024 - SDLK_SCANCODE_MASK; 76 | if (key < 2048) KeyDown[key] = false; 77 | break; 78 | } 79 | } 80 | } 81 | 82 | bool Input::getQuit() 83 | { 84 | return Quit; 85 | } 86 | int Input::getMouseX() 87 | { 88 | return MouseX; 89 | } 90 | int Input::getMouseY() 91 | { 92 | return MouseY; 93 | } 94 | int Input::getMouseZ() 95 | { 96 | return MouseZ; 97 | } 98 | int Input::getMouseXSpeed() 99 | { 100 | return MouseXSpeed; 101 | } 102 | int Input::getMouseYSpeed() 103 | { 104 | return MouseYSpeed; 105 | } 106 | int Input::getMouseZSpeed() 107 | { 108 | return MouseZSpeed; 109 | } 110 | bool Input::getMouseDown(MouseButton mouseButton) 111 | { 112 | return MouseDown[int(mouseButton)]; 113 | } 114 | bool Input::getKeyDown(int key) 115 | { 116 | if ((key & SDLK_SCANCODE_MASK) == SDLK_SCANCODE_MASK) key += 1024 - SDLK_SCANCODE_MASK; 117 | return KeyDown[key]; 118 | } 119 | 120 | void Input::setMousePosition(int x, int y, bool updateMouseSpeed) 121 | { 122 | if (updateMouseSpeed) 123 | { 124 | MouseXSpeed += MouseX - x; 125 | MouseYSpeed += MouseY - y; 126 | } 127 | MouseX = x; 128 | MouseY = y; 129 | SDL_WarpMouseInWindow(Engine::Window, x, y); 130 | } -------------------------------------------------------------------------------- /Castenstein/Input.h: -------------------------------------------------------------------------------- 1 | class Input 2 | { 3 | private: 4 | static bool Quit; 5 | static int MouseX; 6 | static int MouseY; 7 | static int MouseZ; 8 | static int MouseXSpeed; 9 | static int MouseYSpeed; 10 | static int MouseZSpeed; 11 | static bool *MouseDown; 12 | static bool *KeyDown; 13 | 14 | static void Initialize(); 15 | static void Destroy(); 16 | public: 17 | static void Update(); 18 | 19 | static bool getQuit(); 20 | static int getMouseX(); 21 | static int getMouseY(); 22 | static int getMouseZ(); 23 | static int getMouseXSpeed(); 24 | static int getMouseYSpeed(); 25 | static int getMouseZSpeed(); 26 | static bool getMouseDown(MouseButton mouseButton); 27 | static bool getKeyDown(int key); 28 | 29 | static void setMousePosition(int x, int y, bool updateMouseSpeed); 30 | 31 | friend class Engine; 32 | }; -------------------------------------------------------------------------------- /Castenstein/Map.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | Map::Map(int width, int height) 4 | { 5 | SpawnX = 0; 6 | SpawnY = 0; 7 | SpawnRotation = 0; 8 | FogColor = Color(0, 0, 0); 9 | AmbientBrightness = .5f; 10 | 11 | Size = Point(width, height); 12 | Blocks = new Block**[Size.Y]; 13 | 14 | for (int y = 0; y < Size.Y; y++) 15 | { 16 | Blocks[y] = new Block*[Size.X]; 17 | for (int x = 0; x < Size.X; x++) Blocks[y][x] = new Block(); 18 | } 19 | } 20 | Map::Map(string path) 21 | { 22 | SpawnX = 0; 23 | SpawnY = 0; 24 | SpawnRotation = 0; 25 | FogColor = Color(0, 0, 0); 26 | AmbientBrightness = .5f; 27 | Blocks = nullptr; 28 | 29 | int mapWidth = -1, mapHeight = -1; 30 | string str, str2, section = ""; 31 | vector textureChars = vector(); 32 | vector textureWalls = vector(); 33 | vector textures = vector(); 34 | vector spriteNames = vector(); 35 | vector spritesAnim = vector(); 36 | vector spriteTextures = vector(); 37 | 38 | ifstream file; 39 | file.open(path); 40 | 41 | while (!file.eof()) 42 | { 43 | file >> str; 44 | if (str[0] == '[' && str[str.length() - 1] == ']') 45 | { 46 | section = str.substr(1, str.length() - 2); 47 | if (section != "map" && section != "ceiling") continue; 48 | } 49 | 50 | if (section == "properties") 51 | { 52 | if (str == "width") 53 | { 54 | file >> mapWidth; 55 | if (mapWidth < 1) throw; 56 | } 57 | else if (str == "height") 58 | { 59 | file >> mapHeight; 60 | if (mapHeight < 1) throw; 61 | } 62 | else if (str == "sky") 63 | { 64 | file >> str; 65 | Engine::setSky(new Sky(str)); 66 | } 67 | else if (str == "fogrange") 68 | { 69 | file >> FogRange; 70 | } 71 | else if (str == "fogcolor") 72 | { 73 | file >> FogColor.R >> FogColor.G >> FogColor.B; 74 | } 75 | else if (str == "ambient") 76 | { 77 | file >> AmbientBrightness; 78 | } 79 | else if (str == "spawn") 80 | { 81 | file >> SpawnX >> SpawnY >> SpawnRotation; 82 | } 83 | else 84 | { 85 | throw; 86 | } 87 | if (Blocks == nullptr && mapWidth > -1 && mapHeight > -1) 88 | { 89 | Size = Point(mapWidth, mapHeight); 90 | Blocks = new Block**[Size.Y]; 91 | for (int y = 0; y < Size.Y; y++) 92 | { 93 | Blocks[y] = new Block*[Size.X]; 94 | } 95 | } 96 | } 97 | else if (section == "textures.map") 98 | { 99 | textureChars.push_back(str[0]); 100 | file >> str >> str2; 101 | if (str == "wall") 102 | { 103 | textureWalls.push_back(true); 104 | } 105 | else if (str == "floor") 106 | { 107 | textureWalls.push_back(false); 108 | } 109 | else 110 | { 111 | throw; 112 | } 113 | textures.push_back(new Texture(str2, FogColor, AmbientBrightness)); 114 | } 115 | else if (section == "textures.sprites") 116 | { 117 | spriteNames.push_back(str); 118 | file >> str >> str2; 119 | if (str == "static") spritesAnim.push_back(false); 120 | else if (str == "anim") spritesAnim.push_back(true); 121 | else throw; 122 | spriteTextures.push_back(new AnimatedTexture(str2, FogColor, AmbientBrightness)); 123 | } 124 | else if (section == "map" || section == "ceiling") 125 | { 126 | getline(file, str); 127 | for (int y = 0; y < Size.Y; y++) 128 | { 129 | getline(file, str); 130 | if (str.length() != Size.X) throw; 131 | for (int x = 0; x < Size.X; x++) 132 | { 133 | bool found = false; 134 | for (int i = 0; i < int(textureChars.size()); i++) 135 | { 136 | if (str[x] == textureChars[i]) 137 | { 138 | if (section == "map") Blocks[y][x] = new Block(textureWalls[i], textures[i], nullptr); 139 | else Blocks[y][x]->CeilingTexture = textures[i]; 140 | found = true; 141 | break; 142 | } 143 | } 144 | if (section == "map" && !found) Blocks[y][x] = new Block(); 145 | } 146 | } 147 | } 148 | else if (section == "sprites") 149 | { 150 | string::size_type sz; 151 | float spriteX = stof(str.c_str(), &sz), spriteY, rotation = 0; 152 | file >> spriteY >> str; 153 | bool found = false; 154 | for (int i = 0; i < int(spriteNames.size()); i++) 155 | { 156 | if (str == spriteNames[i]) 157 | { 158 | if (spritesAnim[i]) file >> rotation; 159 | Engine::AddSprite(new Sprite(spriteX, spriteY, spriteTextures[i], rotation)); 160 | found = true; 161 | break; 162 | } 163 | } 164 | if (!found) throw; 165 | } 166 | else 167 | { 168 | throw; 169 | } 170 | } 171 | file.close(); 172 | } 173 | Map::~Map() 174 | { 175 | delete[] Blocks; 176 | } 177 | 178 | Point Map::getSize() 179 | { 180 | return Size; 181 | } 182 | Block *Map::getBlock(int x, int y) 183 | { 184 | return Blocks[y][x]; 185 | } 186 | float Map::getFogRange() 187 | { 188 | return FogRange; 189 | } 190 | Color Map::getFogColor() 191 | { 192 | return FogColor; 193 | } 194 | float Map::getAmbientBrightness() 195 | { 196 | return AmbientBrightness; 197 | } 198 | float Map::getSpawnX() 199 | { 200 | return SpawnX; 201 | } 202 | float Map::getSpawnY() 203 | { 204 | return SpawnY; 205 | } 206 | float Map::getSpawnRotation() 207 | { 208 | return SpawnRotation; 209 | } 210 | 211 | void Map::setBlock(int x, int y, Block *block) 212 | { 213 | Blocks[y][x] = block; 214 | } 215 | void Map::setFogRange(float fogRange) 216 | { 217 | FogRange = fogRange; 218 | } 219 | void Map::setFogColor(Color fogColor) 220 | { 221 | FogColor = fogColor; 222 | } 223 | void Map::setAmbientBrightness(float ambientBrightness) 224 | { 225 | AmbientBrightness = ambientBrightness; 226 | } 227 | void Map::setSpawnX(float spawnX) 228 | { 229 | SpawnX = spawnX; 230 | } 231 | void Map::setSpawnRotation(float spawnRotation) 232 | { 233 | SpawnRotation = spawnRotation; 234 | } 235 | void Map::setSpawnY(float spawnY) 236 | { 237 | SpawnY = spawnY; 238 | } -------------------------------------------------------------------------------- /Castenstein/Map.h: -------------------------------------------------------------------------------- 1 | class Map 2 | { 3 | private: 4 | Point Size; 5 | Block ***Blocks; 6 | float FogRange; 7 | Color FogColor; 8 | float AmbientBrightness; 9 | float SpawnX, SpawnY, SpawnRotation; 10 | public: 11 | 12 | Map(int width, int height); 13 | Map(string path); 14 | ~Map(); 15 | 16 | Point getSize(); 17 | Block *getBlock(int x, int y); 18 | float getFogRange(); 19 | Color getFogColor(); 20 | float getAmbientBrightness(); 21 | float getSpawnX(); 22 | float getSpawnY(); 23 | float getSpawnRotation(); 24 | 25 | void setBlock(int x, int y, Block *block); 26 | void setFogRange(float fogRange); 27 | void setFogColor(Color fogColor); 28 | void setAmbientBrightness(float ambientBrightness); 29 | void setSpawnX(float spawnX); 30 | void setSpawnY(float spawnY); 31 | void setSpawnRotation(float spawnRotation); 32 | 33 | friend class Engine; 34 | friend class Graphics; 35 | friend class Player; 36 | friend class Texture; 37 | }; -------------------------------------------------------------------------------- /Castenstein/Media/Images/Font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Images/Font.png -------------------------------------------------------------------------------- /Castenstein/Media/Images/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Images/Icon.png -------------------------------------------------------------------------------- /Castenstein/Media/Maps/Map.txt: -------------------------------------------------------------------------------- 1 | [properties] 2 | width 24 3 | height 24 4 | sky Media\Textures\Sky.png 5 | fogrange 20 6 | fogcolor 160 165 169 7 | ambient .6 8 | spawn 12.5 15.5 0 9 | 10 | [textures.map] 11 | . floor Media\Textures\Grass.png 12 | o floor Media\Textures\Grass_Shadow.png 13 | g floor Media\Textures\Grass_Plate.png 14 | , floor Media\Textures\Tiles1.png 15 | - floor Media\Textures\StoneFloor.png 16 | | floor Media\Textures\Tiles2.png 17 | = floor Media\Textures\Tiles2_Shadow.png 18 | X wall Media\Textures\Stones.png 19 | x wall Media\Textures\Stones_Logo1.png 20 | e wall Media\Textures\Stones_Logo2.png 21 | Y wall Media\Textures\Stones_Moss.png 22 | d wall Media\Textures\Door.png 23 | w wall Media\Textures\Bricks1.png 24 | W wall Media\Textures\Bricks2.png 25 | T wall Media\Textures\Wood.png 26 | B wall Media\Textures\Wood_Logo.png 27 | c wall Media\Textures\Ceiling1.png 28 | C wall Media\Textures\Ceiling2.png 29 | 30 | [textures.sprites] 31 | barrel static Media\Sprites\Barrel.png 32 | skeleton1 static Media\Sprites\Skeleton1.png 33 | skeleton2 static Media\Sprites\Skeleton2.png 34 | table static Media\Sprites\Table.png 35 | light static Media\Sprites\Light.png 36 | pillar static Media\Sprites\Pillar.png 37 | drum static Media\Sprites\Drum.png 38 | plant1 static Media\Sprites\Plant1.png 39 | plant2 static Media\Sprites\Plant2.png 40 | grail static Media\Sprites\Grail.png 41 | soldier anim Media\Sprites\Soldier.png 42 | guard anim Media\Sprites\Guard.png 43 | 44 | [map] 45 | XXXXxXXXxXXXxXXXxXXXxXXX 46 | Xo....................oX 47 | X......................X 48 | x......................X 49 | X.....YYYYY....WowoW...x 50 | X.....Y---Y....o...o...X 51 | X.....Y---Y....w.g.w...X 52 | x.....Y---Y....o...o...X 53 | X.....YY.YY....WowoW...x 54 | X......o.o.............X 55 | X......................X 56 | x......................x 57 | X....o.................X 58 | X...o.o................X 59 | X....o.................X 60 | x......................x 61 | XTTTTTTTT...........==.X 62 | X..T,,,,T..........o==.X 63 | X...,,B,To..........||.X 64 | x..T,,,,T...........||.x 65 | X..TTTTTT..............X 66 | e.......o..............d 67 | Xo......o.........o....X 68 | XXXXxXXXxXXXxXXXxXXXxXXX 69 | 70 | [ceiling] 71 | 72 | 73 | 74 | 75 | YYYYY W w W 76 | YcccY 77 | YcccY w w 78 | YcccY 79 | YYcYY W w W 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | TTTTTTTT 88 | TCCCCT 89 | CCCCCT ccccc 90 | TCCCCT ccccc 91 | TTTTTT ccccc 92 | ccccd 93 | ccccc 94 | ccccc 95 | 96 | [sprites] 97 | 7.5 5.5 drum 98 | 7.9 5.8 drum 99 | 7.4 6.2 drum 100 | 9.7 7.6 barrel 101 | 20.3 22.7 barrel 102 | 20 22.1 barrel 103 | 19.3 21.8 barrel 104 | 18.5 22.5 barrel 105 | 9.6 5.4 skeleton1 106 | 7.3 7.6 skeleton2 107 | 20.5 16.5 table 108 | 20.5 17.5 table 109 | 20.5 18.5 table 110 | 20.5 19.5 table 111 | 21.5 16.5 table 112 | 21.5 17.5 table 113 | 21.5 18.5 table 114 | 21.5 19.5 table 115 | 21 19.5 light 116 | 21 21.5 light 117 | 22.5 18.5 pillar 118 | 22.5 18.5 pillar 119 | 22.5 20.5 pillar 120 | 19.5 18.5 pillar 121 | 19.5 20.5 pillar 122 | 19.5 22.5 pillar 123 | 1.5 1.5 plant1 124 | 1.5 22.5 plant1 125 | 22.5 1.5 plant1 126 | 22.5 22.5 plant1 127 | 7.5 17.5 plant2 128 | 7.5 19.5 plant2 129 | 4.5 17.5 plant2 130 | 4.5 19.5 plant2 131 | 5.5 12.5 plant1 132 | 4.5 13.5 plant1 133 | 5.5 14.5 plant1 134 | 6.5 13.5 plant1 135 | 9.5 18.5 plant1 136 | 17.5 6.5 grail 137 | 7.5 9.5 soldier 0 138 | 9.5 9.5 soldier 0 139 | 16.5 8.5 soldier 0 140 | 18.5 8.5 soldier 0 141 | 16.5 4.5 soldier 180 142 | 18.5 4.5 soldier 180 143 | 15.5 5.5 soldier -90 144 | 15.5 7.5 soldier -90 145 | 19.5 5.5 soldier 90 146 | 19.5 7.5 soldier 90 147 | 8.5 21.5 guard 90 148 | 8.5 22.5 guard 90 149 | 2.5 17.5 guard -90 150 | 2.5 19.5 guard -90 151 | 19.5 17.5 guard -90 152 | 19.5 19.5 guard -90 -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Barrel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Barrel.png -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Drum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Drum.png -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Grail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Grail.png -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Guard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Guard.png -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Light.png -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Pillar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Pillar.png -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Plant1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Plant1.png -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Plant2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Plant2.png -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Skeleton1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Skeleton1.png -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Skeleton2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Skeleton2.png -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Soldier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Soldier.png -------------------------------------------------------------------------------- /Castenstein/Media/Sprites/Table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Sprites/Table.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Bricks1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Bricks1.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Bricks2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Bricks2.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Ceiling1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Ceiling1.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Ceiling2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Ceiling2.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Door.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Door.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Grass.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Grass_Plate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Grass_Plate.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Grass_Shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Grass_Shadow.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Sky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Sky.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/StoneFloor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/StoneFloor.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Stones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Stones.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Stones_Logo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Stones_Logo1.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Stones_Logo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Stones_Logo2.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Stones_Moss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Stones_Moss.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Tiles1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Tiles1.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Tiles2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Tiles2.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Tiles2_Shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Tiles2_Shadow.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Wood.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Wood.png -------------------------------------------------------------------------------- /Castenstein/Media/Textures/Wood_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/Media/Textures/Wood_Logo.png -------------------------------------------------------------------------------- /Castenstein/MouseButton.h: -------------------------------------------------------------------------------- 1 | enum class MouseButton 2 | { 3 | Left = 0, 4 | Right = 1, 5 | Middle = 2 6 | }; -------------------------------------------------------------------------------- /Castenstein/Player.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | Player::Player() 4 | { 5 | X = 0; 6 | Y = 0; 7 | Z = 0; 8 | Vx = 0; 9 | Vy = 0; 10 | Rotation = 0; 11 | Tilt = 0; 12 | RotationVelocity = 0; 13 | TiltVelocity = 0; 14 | WalkDistance = 0; 15 | } 16 | Player::Player(float x, float y) 17 | { 18 | X = x; 19 | Y = y; 20 | Z = 0; 21 | Vx = 0; 22 | Vy = 0; 23 | Rotation = 0; 24 | Tilt = 0; 25 | RotationVelocity = 0; 26 | TiltVelocity = 0; 27 | WalkDistance = 0; 28 | } 29 | Player::Player(float x, float y, float rotation) 30 | { 31 | X = x; 32 | Y = y; 33 | Z = 0; 34 | Vx = 0; 35 | Vy = 0; 36 | Rotation = rotation; 37 | Tilt = 0; 38 | RotationVelocity = 0; 39 | TiltVelocity = 0; 40 | WalkDistance = 0; 41 | } 42 | 43 | void Player::UpdateInput(float movementSpeed, float rotationSpeed, float movementSmoothness, float rotationSmoothness, float collisionDistance) 44 | { 45 | if (Input::getKeyDown(SDLK_LSHIFT)) movementSpeed *= 1.5f; 46 | 47 | RotationVelocity = (RotationVelocity + Input::getMouseXSpeed()) * rotationSmoothness; 48 | TiltVelocity = (TiltVelocity + Input::getMouseYSpeed() / 1.5f) * rotationSmoothness; 49 | float ox = float(Input::getKeyDown(SDLK_d) - Input::getKeyDown(SDLK_a)); 50 | float oy = float(Input::getKeyDown(SDLK_s) - Input::getKeyDown(SDLK_w)); 51 | if (ox != 0 && oy != 0) 52 | { 53 | float d = sqrt(2.f); 54 | ox /= d; 55 | oy /= d; 56 | } 57 | Vx = (Vx + ox * cosd(Rotation) - oy * sind(Rotation)) * movementSmoothness; 58 | Vy = (Vy + ox * sind(Rotation) + oy * cosd(Rotation)) * movementSmoothness; 59 | 60 | float dx = Vx * movementSpeed, dy = Vy * movementSpeed; 61 | int mapX = int(X), mapY = int(Y); 62 | int colX = int(X + dx + copysign(collisionDistance, dx)); 63 | int colY = int(Y + dy + copysign(collisionDistance, dy)); 64 | float newX = X, newY = Y; 65 | if (Engine::CurrentMap->Blocks[mapY][colX]->IsWall || Y - floor(Y) < collisionDistance && Engine::CurrentMap->Blocks[mapY - 1][colX]->IsWall || ceil(Y) - Y < collisionDistance && Engine::CurrentMap->Blocks[mapY + 1][colX]->IsWall) 66 | { 67 | if (dx > 0) newX = ceil(X) - collisionDistance; else if (dx < 0) newX = floor(X) + collisionDistance; 68 | } 69 | else 70 | { 71 | newX = X + dx; 72 | } 73 | if (Engine::CurrentMap->Blocks[colY][mapX]->IsWall || X - floor(X) < collisionDistance && Engine::CurrentMap->Blocks[colY][mapX - 1]->IsWall || ceil(X) - X < collisionDistance && Engine::CurrentMap->Blocks[colY][mapX + 1]->IsWall) 74 | { 75 | if (dy > 0) newY = ceil(Y) - collisionDistance; else if (dy < 0) newY = floor(Y) + collisionDistance; 76 | } 77 | else 78 | { 79 | newY = Y + dy; 80 | } 81 | X = clip(newX, 1 + collisionDistance, Engine::CurrentMap->Size.X - 1 - collisionDistance); 82 | Y = clip(newY, 1 + collisionDistance, Engine::CurrentMap->Size.Y - 1 - collisionDistance); 83 | 84 | Z = sin(WalkDistance += sqrt(Vx * Vx + Vy * Vy) * movementSpeed * 4) * .05f - .2f; 85 | Rotation += RotationVelocity * rotationSpeed; 86 | Tilt += TiltVelocity * rotationSpeed; 87 | Tilt = clip(Tilt, -45, 45); 88 | } 89 | 90 | float Player::getX() 91 | { 92 | return X; 93 | } 94 | float Player::getY() 95 | { 96 | return Y; 97 | } 98 | float Player::getZ() 99 | { 100 | return Z; 101 | } 102 | float Player::getVx() 103 | { 104 | return Vx; 105 | } 106 | float Player::getVy() 107 | { 108 | return Vy; 109 | } 110 | float Player::getRotation() 111 | { 112 | return Rotation; 113 | } 114 | float Player::getTilt() 115 | { 116 | return Tilt; 117 | } 118 | float Player::getRotationVelocity() 119 | { 120 | return RotationVelocity; 121 | } 122 | float Player::getTiltVelocity() 123 | { 124 | return TiltVelocity; 125 | } 126 | 127 | void Player::setX(float x) 128 | { 129 | X = x; 130 | } 131 | void Player::setY(float y) 132 | { 133 | Y = y; 134 | } 135 | void Player::setZ(float z) 136 | { 137 | Z = z; 138 | } 139 | void Player::setVx(float vx) 140 | { 141 | Vx = vx; 142 | } 143 | void Player::setVy(float vy) 144 | { 145 | Vy = vy; 146 | } 147 | void Player::setRotation(float rotation) 148 | { 149 | Rotation = rotation; 150 | } 151 | void Player::setTilt(float tilt) 152 | { 153 | Tilt = tilt; 154 | } 155 | void Player::setRotationVelocity(float rotationVelocity) 156 | { 157 | RotationVelocity = rotationVelocity; 158 | } 159 | void Player::setTiltVelocity(float tiltVelocity) 160 | { 161 | TiltVelocity = tiltVelocity; 162 | } -------------------------------------------------------------------------------- /Castenstein/Player.h: -------------------------------------------------------------------------------- 1 | class Player 2 | { 3 | private: 4 | float X, Y, Z; 5 | float Vx, Vy; 6 | float Rotation, Tilt; 7 | float RotationVelocity, TiltVelocity; 8 | float WalkDistance; 9 | public: 10 | Player(); 11 | Player(float x, float y); 12 | Player(float x, float y, float rotation); 13 | 14 | void UpdateInput(float movementSpeed, float rotationSpeed, float movementSmoothness, float rotationSmoothness, float collisionDistance); 15 | 16 | float getX(); 17 | float getY(); 18 | float getZ(); 19 | float getVx(); 20 | float getVy(); 21 | float getRotation(); 22 | float getTilt(); 23 | float getRotationVelocity(); 24 | float getTiltVelocity(); 25 | 26 | void setX(float x); 27 | void setY(float y); 28 | void setZ(float z); 29 | void setVx(float x); 30 | void setVy(float y); 31 | void setRotation(float rotation); 32 | void setTilt(float tilt); 33 | void setRotationVelocity(float rotationVelocity); 34 | void setTiltVelocity(float tiltVelocity); 35 | 36 | friend class Engine; 37 | friend class Graphics; 38 | }; -------------------------------------------------------------------------------- /Castenstein/Point.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | Point::Point() 4 | { 5 | X = 0; 6 | Y = 0; 7 | } 8 | Point::Point(int x, int y) 9 | { 10 | X = x; 11 | Y = y; 12 | } -------------------------------------------------------------------------------- /Castenstein/Point.h: -------------------------------------------------------------------------------- 1 | struct Point 2 | { 3 | public: 4 | int X, Y; 5 | 6 | Point(); 7 | Point(int x, int y); 8 | }; -------------------------------------------------------------------------------- /Castenstein/RenderThread.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" -------------------------------------------------------------------------------- /Castenstein/RenderThread.h: -------------------------------------------------------------------------------- 1 | class RenderThread 2 | { 3 | private: 4 | SDL_Thread *SDLThread; 5 | int ThreadNumber; 6 | SDL_mutex *Mutex; 7 | SDL_cond *Cond; 8 | bool Running; 9 | bool Quit; 10 | 11 | friend class Engine; 12 | }; -------------------------------------------------------------------------------- /Castenstein/SDL/SDL.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL.h 24 | * 25 | * Main include header for the SDL library 26 | */ 27 | 28 | 29 | #ifndef _SDL_H 30 | #define _SDL_H 31 | 32 | #include "SDL_main.h" 33 | #include "SDL_stdinc.h" 34 | #include "SDL_assert.h" 35 | #include "SDL_atomic.h" 36 | #include "SDL_audio.h" 37 | #include "SDL_clipboard.h" 38 | #include "SDL_cpuinfo.h" 39 | #include "SDL_endian.h" 40 | #include "SDL_error.h" 41 | #include "SDL_events.h" 42 | #include "SDL_filesystem.h" 43 | #include "SDL_joystick.h" 44 | #include "SDL_gamecontroller.h" 45 | #include "SDL_haptic.h" 46 | #include "SDL_hints.h" 47 | #include "SDL_loadso.h" 48 | #include "SDL_log.h" 49 | #include "SDL_messagebox.h" 50 | #include "SDL_mutex.h" 51 | #include "SDL_power.h" 52 | #include "SDL_render.h" 53 | #include "SDL_rwops.h" 54 | #include "SDL_system.h" 55 | #include "SDL_thread.h" 56 | #include "SDL_timer.h" 57 | #include "SDL_version.h" 58 | #include "SDL_video.h" 59 | 60 | #include "begin_code.h" 61 | /* Set up for C function definitions, even when using C++ */ 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | /* As of version 0.5, SDL is loaded dynamically into the application */ 67 | 68 | /** 69 | * \name SDL_INIT_* 70 | * 71 | * These are the flags which may be passed to SDL_Init(). You should 72 | * specify the subsystems which you will be using in your application. 73 | */ 74 | /* @{ */ 75 | #define SDL_INIT_TIMER 0x00000001u 76 | #define SDL_INIT_AUDIO 0x00000010u 77 | #define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ 78 | #define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ 79 | #define SDL_INIT_HAPTIC 0x00001000u 80 | #define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ 81 | #define SDL_INIT_EVENTS 0x00004000u 82 | #define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */ 83 | #define SDL_INIT_EVERYTHING ( \ 84 | SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ 85 | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ 86 | ) 87 | /* @} */ 88 | 89 | /** 90 | * This function initializes the subsystems specified by \c flags 91 | */ 92 | extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); 93 | 94 | /** 95 | * This function initializes specific SDL subsystems 96 | * 97 | * Subsystem initialization is ref-counted, you must call 98 | * SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly 99 | * shutdown a subsystem manually (or call SDL_Quit() to force shutdown). 100 | * If a subsystem is already loaded then this call will 101 | * increase the ref-count and return. 102 | */ 103 | extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); 104 | 105 | /** 106 | * This function cleans up specific SDL subsystems 107 | */ 108 | extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); 109 | 110 | /** 111 | * This function returns a mask of the specified subsystems which have 112 | * previously been initialized. 113 | * 114 | * If \c flags is 0, it returns a mask of all initialized subsystems. 115 | */ 116 | extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); 117 | 118 | /** 119 | * This function cleans up all initialized subsystems. You should 120 | * call it upon all exit conditions. 121 | */ 122 | extern DECLSPEC void SDLCALL SDL_Quit(void); 123 | 124 | /* Ends C function definitions when using C++ */ 125 | #ifdef __cplusplus 126 | } 127 | #endif 128 | #include "close_code.h" 129 | 130 | #endif /* _SDL_H */ 131 | 132 | /* vi: set ts=4 sw=4 expandtab: */ 133 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_bits.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_bits.h 24 | * 25 | * Functions for fiddling with bits and bitmasks. 26 | */ 27 | 28 | #ifndef _SDL_bits_h 29 | #define _SDL_bits_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 | * \file SDL_bits.h 41 | */ 42 | 43 | /** 44 | * Get the index of the most significant bit. Result is undefined when called 45 | * with 0. This operation can also be stated as "count leading zeroes" and 46 | * "log base 2". 47 | * 48 | * \return Index of the most significant bit, or -1 if the value is 0. 49 | */ 50 | SDL_FORCE_INLINE int 51 | SDL_MostSignificantBitIndex32(Uint32 x) 52 | { 53 | #if defined(__GNUC__) && __GNUC__ >= 4 54 | /* Count Leading Zeroes builtin in GCC. 55 | * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html 56 | */ 57 | if (x == 0) { 58 | return -1; 59 | } 60 | return 31 - __builtin_clz(x); 61 | #else 62 | /* Based off of Bit Twiddling Hacks by Sean Eron Anderson 63 | * , released in the public domain. 64 | * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog 65 | */ 66 | const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; 67 | const int S[] = {1, 2, 4, 8, 16}; 68 | 69 | int msbIndex = 0; 70 | int i; 71 | 72 | if (x == 0) { 73 | return -1; 74 | } 75 | 76 | for (i = 4; i >= 0; i--) 77 | { 78 | if (x & b[i]) 79 | { 80 | x >>= S[i]; 81 | msbIndex |= S[i]; 82 | } 83 | } 84 | 85 | return msbIndex; 86 | #endif 87 | } 88 | 89 | /* Ends C function definitions when using C++ */ 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | #include "close_code.h" 94 | 95 | #endif /* _SDL_bits_h */ 96 | 97 | /* vi: set ts=4 sw=4 expandtab: */ 98 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_blendmode.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_blendmode.h 24 | * 25 | * Header file declaring the SDL_BlendMode enumeration 26 | */ 27 | 28 | #ifndef _SDL_blendmode_h 29 | #define _SDL_blendmode_h 30 | 31 | #include "begin_code.h" 32 | /* Set up for C function definitions, even when using C++ */ 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /** 38 | * \brief The blend mode used in SDL_RenderCopy() and drawing operations. 39 | */ 40 | typedef enum 41 | { 42 | SDL_BLENDMODE_NONE = 0x00000000, /**< no blending 43 | dstRGBA = srcRGBA */ 44 | SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending 45 | dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) 46 | dstA = srcA + (dstA * (1-srcA)) */ 47 | SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending 48 | dstRGB = (srcRGB * srcA) + dstRGB 49 | dstA = dstA */ 50 | SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate 51 | dstRGB = srcRGB * dstRGB 52 | dstA = dstA */ 53 | } SDL_BlendMode; 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* _SDL_blendmode_h */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_clipboard.h 24 | * 25 | * Include file for SDL clipboard handling 26 | */ 27 | 28 | #ifndef _SDL_clipboard_h 29 | #define _SDL_clipboard_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 | /* Function prototypes */ 40 | 41 | /** 42 | * \brief Put UTF-8 text into the clipboard 43 | * 44 | * \sa SDL_GetClipboardText() 45 | */ 46 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); 47 | 48 | /** 49 | * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() 50 | * 51 | * \sa SDL_SetClipboardText() 52 | */ 53 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); 54 | 55 | /** 56 | * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty 57 | * 58 | * \sa SDL_GetClipboardText() 59 | */ 60 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); 61 | 62 | 63 | /* Ends C function definitions when using C++ */ 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #include "close_code.h" 68 | 69 | #endif /* _SDL_clipboard_h */ 70 | 71 | /* vi: set ts=4 sw=4 expandtab: */ 72 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_config_android.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2015 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_config_android_h 23 | #define _SDL_config_android_h 24 | 25 | #include "SDL_platform.h" 26 | 27 | /** 28 | * \file SDL_config_android.h 29 | * 30 | * This is a configuration that can be used to build SDL for Android 31 | */ 32 | 33 | #include 34 | 35 | #define HAVE_GCC_ATOMICS 1 36 | 37 | #define HAVE_ALLOCA_H 1 38 | #define HAVE_SYS_TYPES_H 1 39 | #define HAVE_STDIO_H 1 40 | #define STDC_HEADERS 1 41 | #define HAVE_STRING_H 1 42 | #define HAVE_INTTYPES_H 1 43 | #define HAVE_STDINT_H 1 44 | #define HAVE_CTYPE_H 1 45 | #define HAVE_MATH_H 1 46 | 47 | /* C library functions */ 48 | #define HAVE_MALLOC 1 49 | #define HAVE_CALLOC 1 50 | #define HAVE_REALLOC 1 51 | #define HAVE_FREE 1 52 | #define HAVE_ALLOCA 1 53 | #define HAVE_GETENV 1 54 | #define HAVE_SETENV 1 55 | #define HAVE_PUTENV 1 56 | #define HAVE_SETENV 1 57 | #define HAVE_UNSETENV 1 58 | #define HAVE_QSORT 1 59 | #define HAVE_ABS 1 60 | #define HAVE_BCOPY 1 61 | #define HAVE_MEMSET 1 62 | #define HAVE_MEMCPY 1 63 | #define HAVE_MEMMOVE 1 64 | #define HAVE_MEMCMP 1 65 | #define HAVE_STRLEN 1 66 | #define HAVE_STRLCPY 1 67 | #define HAVE_STRLCAT 1 68 | #define HAVE_STRDUP 1 69 | #define HAVE_STRCHR 1 70 | #define HAVE_STRRCHR 1 71 | #define HAVE_STRSTR 1 72 | #define HAVE_STRTOL 1 73 | #define HAVE_STRTOUL 1 74 | #define HAVE_STRTOLL 1 75 | #define HAVE_STRTOULL 1 76 | #define HAVE_STRTOD 1 77 | #define HAVE_ATOI 1 78 | #define HAVE_STRCMP 1 79 | #define HAVE_STRNCMP 1 80 | #define HAVE_STRCASECMP 1 81 | #define HAVE_STRNCASECMP 1 82 | #define HAVE_VSSCANF 1 83 | #define HAVE_VSNPRINTF 1 84 | #define HAVE_M_PI 1 85 | #define HAVE_ATAN 1 86 | #define HAVE_ATAN2 1 87 | #define HAVE_ACOS 1 88 | #define HAVE_ASIN 1 89 | #define HAVE_CEIL 1 90 | #define HAVE_COPYSIGN 1 91 | #define HAVE_COS 1 92 | #define HAVE_COSF 1 93 | #define HAVE_FABS 1 94 | #define HAVE_FLOOR 1 95 | #define HAVE_LOG 1 96 | #define HAVE_POW 1 97 | #define HAVE_SCALBN 1 98 | #define HAVE_SIN 1 99 | #define HAVE_SINF 1 100 | #define HAVE_SQRT 1 101 | #define HAVE_SQRTF 1 102 | #define HAVE_TAN 1 103 | #define HAVE_TANF 1 104 | #define HAVE_SETJMP 1 105 | #define HAVE_NANOSLEEP 1 106 | #define HAVE_SYSCONF 1 107 | #define HAVE_CLOCK_GETTIME 1 108 | 109 | #define SIZEOF_VOIDP 4 110 | 111 | /* Enable various audio drivers */ 112 | #define SDL_AUDIO_DRIVER_ANDROID 1 113 | #define SDL_AUDIO_DRIVER_DUMMY 1 114 | 115 | /* Enable various input drivers */ 116 | #define SDL_JOYSTICK_ANDROID 1 117 | #define SDL_HAPTIC_DUMMY 1 118 | 119 | /* Enable various shared object loading systems */ 120 | #define SDL_LOADSO_DLOPEN 1 121 | 122 | /* Enable various threading systems */ 123 | #define SDL_THREAD_PTHREAD 1 124 | #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 125 | 126 | /* Enable various timer systems */ 127 | #define SDL_TIMER_UNIX 1 128 | 129 | /* Enable various video drivers */ 130 | #define SDL_VIDEO_DRIVER_ANDROID 1 131 | 132 | /* Enable OpenGL ES */ 133 | #define SDL_VIDEO_OPENGL_ES 1 134 | #define SDL_VIDEO_OPENGL_ES2 1 135 | #define SDL_VIDEO_OPENGL_EGL 1 136 | #define SDL_VIDEO_RENDER_OGL_ES 1 137 | #define SDL_VIDEO_RENDER_OGL_ES2 1 138 | 139 | /* Enable system power support */ 140 | #define SDL_POWER_ANDROID 1 141 | 142 | /* Enable the filesystem driver */ 143 | #define SDL_FILESYSTEM_ANDROID 1 144 | 145 | #endif /* _SDL_config_android_h */ 146 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_config_iphoneos.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2015 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_config_iphoneos_h 23 | #define _SDL_config_iphoneos_h 24 | 25 | #include "SDL_platform.h" 26 | 27 | #ifdef __LP64__ 28 | #define SIZEOF_VOIDP 8 29 | #else 30 | #define SIZEOF_VOIDP 4 31 | #endif 32 | 33 | #define HAVE_GCC_ATOMICS 1 34 | 35 | #define HAVE_ALLOCA_H 1 36 | #define HAVE_SYS_TYPES_H 1 37 | #define HAVE_STDIO_H 1 38 | #define STDC_HEADERS 1 39 | #define HAVE_STRING_H 1 40 | #define HAVE_INTTYPES_H 1 41 | #define HAVE_STDINT_H 1 42 | #define HAVE_CTYPE_H 1 43 | #define HAVE_MATH_H 1 44 | #define HAVE_SIGNAL_H 1 45 | 46 | /* C library functions */ 47 | #define HAVE_MALLOC 1 48 | #define HAVE_CALLOC 1 49 | #define HAVE_REALLOC 1 50 | #define HAVE_FREE 1 51 | #define HAVE_ALLOCA 1 52 | #define HAVE_GETENV 1 53 | #define HAVE_SETENV 1 54 | #define HAVE_PUTENV 1 55 | #define HAVE_SETENV 1 56 | #define HAVE_UNSETENV 1 57 | #define HAVE_QSORT 1 58 | #define HAVE_ABS 1 59 | #define HAVE_BCOPY 1 60 | #define HAVE_MEMSET 1 61 | #define HAVE_MEMCPY 1 62 | #define HAVE_MEMMOVE 1 63 | #define HAVE_MEMCMP 1 64 | #define HAVE_STRLEN 1 65 | #define HAVE_STRLCPY 1 66 | #define HAVE_STRLCAT 1 67 | #define HAVE_STRDUP 1 68 | #define HAVE_STRCHR 1 69 | #define HAVE_STRRCHR 1 70 | #define HAVE_STRSTR 1 71 | #define HAVE_STRTOL 1 72 | #define HAVE_STRTOUL 1 73 | #define HAVE_STRTOLL 1 74 | #define HAVE_STRTOULL 1 75 | #define HAVE_STRTOD 1 76 | #define HAVE_ATOI 1 77 | #define HAVE_ATOF 1 78 | #define HAVE_STRCMP 1 79 | #define HAVE_STRNCMP 1 80 | #define HAVE_STRCASECMP 1 81 | #define HAVE_STRNCASECMP 1 82 | #define HAVE_VSSCANF 1 83 | #define HAVE_VSNPRINTF 1 84 | #define HAVE_M_PI 1 85 | #define HAVE_ATAN 1 86 | #define HAVE_ATAN2 1 87 | #define HAVE_ACOS 1 88 | #define HAVE_ASIN 1 89 | #define HAVE_CEIL 1 90 | #define HAVE_COPYSIGN 1 91 | #define HAVE_COS 1 92 | #define HAVE_COSF 1 93 | #define HAVE_FABS 1 94 | #define HAVE_FLOOR 1 95 | #define HAVE_LOG 1 96 | #define HAVE_POW 1 97 | #define HAVE_SCALBN 1 98 | #define HAVE_SIN 1 99 | #define HAVE_SINF 1 100 | #define HAVE_SQRT 1 101 | #define HAVE_SQRTF 1 102 | #define HAVE_TAN 1 103 | #define HAVE_TANF 1 104 | #define HAVE_SIGACTION 1 105 | #define HAVE_SETJMP 1 106 | #define HAVE_NANOSLEEP 1 107 | #define HAVE_SYSCONF 1 108 | #define HAVE_SYSCTLBYNAME 1 109 | 110 | /* enable iPhone version of Core Audio driver */ 111 | #define SDL_AUDIO_DRIVER_COREAUDIO 1 112 | /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ 113 | #define SDL_AUDIO_DRIVER_DUMMY 1 114 | 115 | /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ 116 | #define SDL_HAPTIC_DUMMY 1 117 | 118 | /* Enable MFi joystick support */ 119 | #define SDL_JOYSTICK_MFI 1 120 | 121 | /* Enable Unix style SO loading */ 122 | /* Technically this works, but violates the iOS dev agreement prior to iOS 8 */ 123 | /* #define SDL_LOADSO_DLOPEN 1 */ 124 | 125 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 126 | #define SDL_LOADSO_DISABLED 1 127 | 128 | /* Enable various threading systems */ 129 | #define SDL_THREAD_PTHREAD 1 130 | #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 131 | 132 | /* Enable various timer systems */ 133 | #define SDL_TIMER_UNIX 1 134 | 135 | /* Supported video drivers */ 136 | #define SDL_VIDEO_DRIVER_UIKIT 1 137 | #define SDL_VIDEO_DRIVER_DUMMY 1 138 | 139 | /* enable OpenGL ES */ 140 | #define SDL_VIDEO_OPENGL_ES2 1 141 | #define SDL_VIDEO_OPENGL_ES 1 142 | #define SDL_VIDEO_RENDER_OGL_ES 1 143 | #define SDL_VIDEO_RENDER_OGL_ES2 1 144 | 145 | /* Enable system power support */ 146 | #define SDL_POWER_UIKIT 1 147 | 148 | /* enable iPhone keyboard support */ 149 | #define SDL_IPHONE_KEYBOARD 1 150 | 151 | /* enable iOS extended launch screen */ 152 | #define SDL_IPHONE_LAUNCHSCREEN 1 153 | 154 | /* Set max recognized G-force from accelerometer 155 | See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed 156 | */ 157 | #define SDL_IPHONE_MAX_GFORCE 5.0 158 | 159 | /* enable filesystem support */ 160 | #define SDL_FILESYSTEM_COCOA 1 161 | 162 | #endif /* _SDL_config_iphoneos_h */ 163 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_config_macosx.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2015 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_config_macosx_h 23 | #define _SDL_config_macosx_h 24 | 25 | #include "SDL_platform.h" 26 | 27 | /* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ 28 | #include 29 | 30 | /* This is a set of defines to configure the SDL features */ 31 | 32 | #ifdef __LP64__ 33 | #define SIZEOF_VOIDP 8 34 | #else 35 | #define SIZEOF_VOIDP 4 36 | #endif 37 | 38 | /* Useful headers */ 39 | #define HAVE_ALLOCA_H 1 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_SETENV 1 58 | #define HAVE_PUTENV 1 59 | #define HAVE_UNSETENV 1 60 | #define HAVE_QSORT 1 61 | #define HAVE_ABS 1 62 | #define HAVE_BCOPY 1 63 | #define HAVE_MEMSET 1 64 | #define HAVE_MEMCPY 1 65 | #define HAVE_MEMMOVE 1 66 | #define HAVE_MEMCMP 1 67 | #define HAVE_STRLEN 1 68 | #define HAVE_STRLCPY 1 69 | #define HAVE_STRLCAT 1 70 | #define HAVE_STRDUP 1 71 | #define HAVE_STRCHR 1 72 | #define HAVE_STRRCHR 1 73 | #define HAVE_STRSTR 1 74 | #define HAVE_STRTOL 1 75 | #define HAVE_STRTOUL 1 76 | #define HAVE_STRTOLL 1 77 | #define HAVE_STRTOULL 1 78 | #define HAVE_STRTOD 1 79 | #define HAVE_ATOI 1 80 | #define HAVE_ATOF 1 81 | #define HAVE_STRCMP 1 82 | #define HAVE_STRNCMP 1 83 | #define HAVE_STRCASECMP 1 84 | #define HAVE_STRNCASECMP 1 85 | #define HAVE_VSSCANF 1 86 | #define HAVE_VSNPRINTF 1 87 | #define HAVE_CEIL 1 88 | #define HAVE_COPYSIGN 1 89 | #define HAVE_COS 1 90 | #define HAVE_COSF 1 91 | #define HAVE_FABS 1 92 | #define HAVE_FLOOR 1 93 | #define HAVE_LOG 1 94 | #define HAVE_POW 1 95 | #define HAVE_SCALBN 1 96 | #define HAVE_SIN 1 97 | #define HAVE_SINF 1 98 | #define HAVE_SQRT 1 99 | #define HAVE_SQRTF 1 100 | #define HAVE_TAN 1 101 | #define HAVE_TANF 1 102 | #define HAVE_SIGACTION 1 103 | #define HAVE_SETJMP 1 104 | #define HAVE_NANOSLEEP 1 105 | #define HAVE_SYSCONF 1 106 | #define HAVE_SYSCTLBYNAME 1 107 | #define HAVE_ATAN 1 108 | #define HAVE_ATAN2 1 109 | #define HAVE_ACOS 1 110 | #define HAVE_ASIN 1 111 | 112 | /* Enable various audio drivers */ 113 | #define SDL_AUDIO_DRIVER_COREAUDIO 1 114 | #define SDL_AUDIO_DRIVER_DISK 1 115 | #define SDL_AUDIO_DRIVER_DUMMY 1 116 | 117 | /* Enable various input drivers */ 118 | #define SDL_JOYSTICK_IOKIT 1 119 | #define SDL_HAPTIC_IOKIT 1 120 | 121 | /* Enable various shared object loading systems */ 122 | #define SDL_LOADSO_DLOPEN 1 123 | 124 | /* Enable various threading systems */ 125 | #define SDL_THREAD_PTHREAD 1 126 | #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 127 | 128 | /* Enable various timer systems */ 129 | #define SDL_TIMER_UNIX 1 130 | 131 | /* Enable various video drivers */ 132 | #define SDL_VIDEO_DRIVER_COCOA 1 133 | #define SDL_VIDEO_DRIVER_DUMMY 1 134 | #undef SDL_VIDEO_DRIVER_X11 135 | #define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" 136 | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" 137 | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" 138 | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib" 139 | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" 140 | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" 141 | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" 142 | #define SDL_VIDEO_DRIVER_X11_XDBE 1 143 | #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 144 | #define SDL_VIDEO_DRIVER_X11_XRANDR 1 145 | #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 146 | #define SDL_VIDEO_DRIVER_X11_XSHAPE 1 147 | #define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 148 | #define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 149 | 150 | #ifdef MAC_OS_X_VERSION_10_8 151 | /* 152 | * No matter the versions targeted, this is the 10.8 or later SDK, so you have 153 | * to use the external Xquartz, which is a more modern Xlib. Previous SDKs 154 | * used an older Xlib. 155 | */ 156 | #define SDL_VIDEO_DRIVER_X11_XINPUT2 1 157 | #define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 158 | #define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1 159 | #endif 160 | 161 | #ifndef SDL_VIDEO_RENDER_OGL 162 | #define SDL_VIDEO_RENDER_OGL 1 163 | #endif 164 | 165 | /* Enable OpenGL support */ 166 | #ifndef SDL_VIDEO_OPENGL 167 | #define SDL_VIDEO_OPENGL 1 168 | #endif 169 | #ifndef SDL_VIDEO_OPENGL_CGL 170 | #define SDL_VIDEO_OPENGL_CGL 1 171 | #endif 172 | #ifndef SDL_VIDEO_OPENGL_GLX 173 | #define SDL_VIDEO_OPENGL_GLX 1 174 | #endif 175 | 176 | /* Enable system power support */ 177 | #define SDL_POWER_MACOSX 1 178 | 179 | /* enable filesystem support */ 180 | #define SDL_FILESYSTEM_COCOA 1 181 | 182 | /* Enable assembly routines */ 183 | #define SDL_ASSEMBLY_ROUTINES 1 184 | #ifdef __ppc__ 185 | #define SDL_ALTIVEC_BLITTERS 1 186 | #endif 187 | 188 | #endif /* _SDL_config_macosx_h */ 189 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_config_minimal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2015 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_config_minimal_h 23 | #define _SDL_config_minimal_h 24 | 25 | #include "SDL_platform.h" 26 | 27 | /** 28 | * \file SDL_config_minimal.h 29 | * 30 | * This is the minimal configuration that can be used to build SDL. 31 | */ 32 | 33 | #define HAVE_STDARG_H 1 34 | #define HAVE_STDDEF_H 1 35 | 36 | /* Most everything except Visual Studio 2008 and earlier has stdint.h now */ 37 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 38 | /* Here are some reasonable defaults */ 39 | typedef unsigned int size_t; 40 | typedef signed char int8_t; 41 | typedef unsigned char uint8_t; 42 | typedef signed short int16_t; 43 | typedef unsigned short uint16_t; 44 | typedef signed int int32_t; 45 | typedef unsigned int uint32_t; 46 | typedef signed long long int64_t; 47 | typedef unsigned long long uint64_t; 48 | typedef unsigned long uintptr_t; 49 | #else 50 | #define HAVE_STDINT_H 1 51 | #endif /* Visual Studio 2008 */ 52 | 53 | #ifdef __GNUC__ 54 | #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 55 | #endif 56 | 57 | /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ 58 | #define SDL_AUDIO_DRIVER_DUMMY 1 59 | 60 | /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ 61 | #define SDL_JOYSTICK_DISABLED 1 62 | 63 | /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ 64 | #define SDL_HAPTIC_DISABLED 1 65 | 66 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 67 | #define SDL_LOADSO_DISABLED 1 68 | 69 | /* Enable the stub thread support (src/thread/generic/\*.c) */ 70 | #define SDL_THREADS_DISABLED 1 71 | 72 | /* Enable the stub timer support (src/timer/dummy/\*.c) */ 73 | #define SDL_TIMERS_DISABLED 1 74 | 75 | /* Enable the dummy video driver (src/video/dummy/\*.c) */ 76 | #define SDL_VIDEO_DRIVER_DUMMY 1 77 | 78 | /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ 79 | #define SDL_FILESYSTEM_DUMMY 1 80 | 81 | #endif /* _SDL_config_minimal_h */ 82 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_config_pandora.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2015 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_config_h 23 | #define _SDL_config_h 24 | 25 | /* This is a set of defines to configure the SDL features */ 26 | 27 | /* General platform specific identifiers */ 28 | #include "SDL_platform.h" 29 | 30 | #ifdef __LP64__ 31 | #define SIZEOF_VOIDP 8 32 | #else 33 | #define SIZEOF_VOIDP 4 34 | #endif 35 | 36 | #define SDL_BYTEORDER 1234 37 | 38 | #define HAVE_ALLOCA_H 1 39 | #define HAVE_SYS_TYPES_H 1 40 | #define HAVE_STDIO_H 1 41 | #define STDC_HEADERS 1 42 | #define HAVE_STDLIB_H 1 43 | #define HAVE_STDARG_H 1 44 | #define HAVE_MALLOC_H 1 45 | #define HAVE_MEMORY_H 1 46 | #define HAVE_STRING_H 1 47 | #define HAVE_STRINGS_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 | #define HAVE_MALLOC 1 55 | #define HAVE_CALLOC 1 56 | #define HAVE_REALLOC 1 57 | #define HAVE_FREE 1 58 | #define HAVE_ALLOCA 1 59 | #define HAVE_GETENV 1 60 | #define HAVE_SETENV 1 61 | #define HAVE_PUTENV 1 62 | #define HAVE_UNSETENV 1 63 | #define HAVE_QSORT 1 64 | #define HAVE_ABS 1 65 | #define HAVE_BCOPY 1 66 | #define HAVE_MEMSET 1 67 | #define HAVE_MEMCPY 1 68 | #define HAVE_MEMMOVE 1 69 | #define HAVE_STRLEN 1 70 | #define HAVE_STRDUP 1 71 | #define HAVE_STRCHR 1 72 | #define HAVE_STRRCHR 1 73 | #define HAVE_STRSTR 1 74 | #define HAVE_STRTOL 1 75 | #define HAVE_STRTOUL 1 76 | #define HAVE_STRTOLL 1 77 | #define HAVE_STRTOULL 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_VSSCANF 1 85 | #define HAVE_VSNPRINTF 1 86 | #define HAVE_M_PI 1 87 | #define HAVE_CEIL 1 88 | #define HAVE_COPYSIGN 1 89 | #define HAVE_COS 1 90 | #define HAVE_COSF 1 91 | #define HAVE_FABS 1 92 | #define HAVE_FLOOR 1 93 | #define HAVE_LOG 1 94 | #define HAVE_SCALBN 1 95 | #define HAVE_SIN 1 96 | #define HAVE_SINF 1 97 | #define HAVE_SQRT 1 98 | #define HAVE_SQRTF 1 99 | #define HAVE_TAN 1 100 | #define HAVE_TANF 1 101 | #define HAVE_SIGACTION 1 102 | #define HAVE_SETJMP 1 103 | #define HAVE_NANOSLEEP 1 104 | 105 | #define SDL_AUDIO_DRIVER_DUMMY 1 106 | #define SDL_AUDIO_DRIVER_OSS 1 107 | 108 | #define SDL_INPUT_LINUXEV 1 109 | #define SDL_INPUT_TSLIB 1 110 | #define SDL_JOYSTICK_LINUX 1 111 | #define SDL_HAPTIC_LINUX 1 112 | 113 | #define SDL_LOADSO_DLOPEN 1 114 | 115 | #define SDL_THREAD_PTHREAD 1 116 | #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 117 | 118 | #define SDL_TIMER_UNIX 1 119 | #define SDL_FILESYSTEM_UNIX 1 120 | 121 | #define SDL_VIDEO_DRIVER_DUMMY 1 122 | #define SDL_VIDEO_DRIVER_X11 1 123 | #define SDL_VIDEO_DRIVER_PANDORA 1 124 | #define SDL_VIDEO_RENDER_OGL_ES 1 125 | #define SDL_VIDEO_OPENGL_ES 1 126 | 127 | #endif /* _SDL_config_h */ 128 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_config_psp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2015 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_config_psp_h 23 | #define _SDL_config_psp_h 24 | 25 | #include "SDL_platform.h" 26 | 27 | 28 | 29 | #ifdef __GNUC__ 30 | #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 31 | #endif 32 | 33 | #define HAVE_GCC_ATOMICS 1 34 | 35 | #define HAVE_ALLOCA_H 1 36 | #define HAVE_SYS_TYPES_H 1 37 | #define HAVE_STDIO_H 1 38 | #define STDC_HEADERS 1 39 | #define HAVE_STRING_H 1 40 | #define HAVE_INTTYPES_H 1 41 | #define HAVE_STDINT_H 1 42 | #define HAVE_CTYPE_H 1 43 | #define HAVE_MATH_H 1 44 | #define HAVE_SIGNAL_H 1 45 | 46 | /* C library functions */ 47 | #define HAVE_MALLOC 1 48 | #define HAVE_CALLOC 1 49 | #define HAVE_REALLOC 1 50 | #define HAVE_FREE 1 51 | #define HAVE_ALLOCA 1 52 | #define HAVE_GETENV 1 53 | #define HAVE_SETENV 1 54 | #define HAVE_PUTENV 1 55 | #define HAVE_SETENV 1 56 | #define HAVE_UNSETENV 1 57 | #define HAVE_QSORT 1 58 | #define HAVE_ABS 1 59 | #define HAVE_BCOPY 1 60 | #define HAVE_MEMSET 1 61 | #define HAVE_MEMCPY 1 62 | #define HAVE_MEMMOVE 1 63 | #define HAVE_MEMCMP 1 64 | #define HAVE_STRLEN 1 65 | #define HAVE_STRLCPY 1 66 | #define HAVE_STRLCAT 1 67 | #define HAVE_STRDUP 1 68 | #define HAVE_STRCHR 1 69 | #define HAVE_STRRCHR 1 70 | #define HAVE_STRSTR 1 71 | #define HAVE_STRTOL 1 72 | #define HAVE_STRTOUL 1 73 | #define HAVE_STRTOLL 1 74 | #define HAVE_STRTOULL 1 75 | #define HAVE_STRTOD 1 76 | #define HAVE_ATOI 1 77 | #define HAVE_ATOF 1 78 | #define HAVE_STRCMP 1 79 | #define HAVE_STRNCMP 1 80 | #define HAVE_STRCASECMP 1 81 | #define HAVE_STRNCASECMP 1 82 | #define HAVE_VSSCANF 1 83 | #define HAVE_VSNPRINTF 1 84 | #define HAVE_M_PI 1 85 | #define HAVE_ATAN 1 86 | #define HAVE_ATAN2 1 87 | #define HAVE_ACOS 1 88 | #define HAVE_ASIN 1 89 | #define HAVE_CEIL 1 90 | #define HAVE_COPYSIGN 1 91 | #define HAVE_COS 1 92 | #define HAVE_COSF 1 93 | #define HAVE_FABS 1 94 | #define HAVE_FLOOR 1 95 | #define HAVE_LOG 1 96 | #define HAVE_POW 1 97 | #define HAVE_SCALBN 1 98 | #define HAVE_SIN 1 99 | #define HAVE_SINF 1 100 | #define HAVE_SQRT 1 101 | #define HAVE_SQRTF 1 102 | #define HAVE_TAN 1 103 | #define HAVE_TANF 1 104 | #define HAVE_SETJMP 1 105 | #define HAVE_NANOSLEEP 1 106 | /* #define HAVE_SYSCONF 1 */ 107 | /* #define HAVE_SIGACTION 1 */ 108 | 109 | 110 | /* PSP isn't that sophisticated */ 111 | #define LACKS_SYS_MMAN_H 1 112 | 113 | /* Enable the stub thread support (src/thread/psp/\*.c) */ 114 | #define SDL_THREAD_PSP 1 115 | 116 | /* Enable the stub timer support (src/timer/psp/\*.c) */ 117 | #define SDL_TIMERS_PSP 1 118 | 119 | /* Enable the stub joystick driver (src/joystick/psp/\*.c) */ 120 | #define SDL_JOYSTICK_PSP 1 121 | 122 | /* Enable the stub audio driver (src/audio/psp/\*.c) */ 123 | #define SDL_AUDIO_DRIVER_PSP 1 124 | 125 | /* PSP video dirver */ 126 | #define SDL_VIDEO_DRIVER_PSP 1 127 | 128 | /* PSP render dirver */ 129 | #define SDL_VIDEO_RENDER_PSP 1 130 | 131 | #define SDL_POWER_PSP 1 132 | 133 | /* !!! FIXME: what does PSP do for filesystem stuff? */ 134 | #define SDL_FILESYSTEM_DUMMY 1 135 | 136 | /* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */ 137 | #define SDL_HAPTIC_DISABLED 1 138 | 139 | /* PSP can't load shared object (src/loadso/dummy/\*.c) */ 140 | #define SDL_LOADSO_DISABLED 1 141 | 142 | 143 | #endif /* _SDL_config_psp_h */ 144 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_config_wiz.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2015 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_config_h 23 | #define _SDL_config_h 24 | 25 | /* This is a set of defines to configure the SDL features */ 26 | 27 | /* General platform specific identifiers */ 28 | #include "SDL_platform.h" 29 | 30 | #define SDL_BYTEORDER 1234 31 | 32 | #define HAVE_ALLOCA_H 1 33 | #define HAVE_SYS_TYPES_H 1 34 | #define HAVE_STDIO_H 1 35 | #define STDC_HEADERS 1 36 | #define HAVE_STDLIB_H 1 37 | #define HAVE_STDARG_H 1 38 | #define HAVE_MALLOC_H 1 39 | #define HAVE_MEMORY_H 1 40 | #define HAVE_STRING_H 1 41 | #define HAVE_STRINGS_H 1 42 | #define HAVE_INTTYPES_H 1 43 | #define HAVE_STDINT_H 1 44 | #define HAVE_CTYPE_H 1 45 | #define HAVE_MATH_H 1 46 | #define HAVE_ICONV_H 1 47 | #define HAVE_SIGNAL_H 1 48 | #define HAVE_MALLOC 1 49 | #define HAVE_CALLOC 1 50 | #define HAVE_REALLOC 1 51 | #define HAVE_FREE 1 52 | #define HAVE_ALLOCA 1 53 | #define HAVE_GETENV 1 54 | #define HAVE_SETENV 1 55 | #define HAVE_PUTENV 1 56 | #define HAVE_UNSETENV 1 57 | #define HAVE_QSORT 1 58 | #define HAVE_ABS 1 59 | #define HAVE_BCOPY 1 60 | #define HAVE_MEMSET 1 61 | #define HAVE_MEMCPY 1 62 | #define HAVE_MEMMOVE 1 63 | #define HAVE_STRLEN 1 64 | #define HAVE_STRDUP 1 65 | #define HAVE_STRCHR 1 66 | #define HAVE_STRRCHR 1 67 | #define HAVE_STRSTR 1 68 | #define HAVE_STRTOL 1 69 | #define HAVE_STRTOUL 1 70 | #define HAVE_STRTOLL 1 71 | #define HAVE_STRTOULL 1 72 | #define HAVE_ATOI 1 73 | #define HAVE_ATOF 1 74 | #define HAVE_STRCMP 1 75 | #define HAVE_STRNCMP 1 76 | #define HAVE_STRCASECMP 1 77 | #define HAVE_STRNCASECMP 1 78 | #define HAVE_VSSCANF 1 79 | #define HAVE_VSNPRINTF 1 80 | #define HAVE_M_PI 1 81 | #define HAVE_CEIL 1 82 | #define HAVE_COPYSIGN 1 83 | #define HAVE_COS 1 84 | #define HAVE_COSF 1 85 | #define HAVE_FABS 1 86 | #define HAVE_FLOOR 1 87 | #define HAVE_LOG 1 88 | #define HAVE_SCALBN 1 89 | #define HAVE_SIN 1 90 | #define HAVE_SINF 1 91 | #define HAVE_SQRT 1 92 | #define HAVE_SQRTF 1 93 | #define HAVE_TAN 1 94 | #define HAVE_TANF 1 95 | #define HAVE_SIGACTION 1 96 | #define HAVE_SETJMP 1 97 | #define HAVE_NANOSLEEP 1 98 | #define HAVE_POW 1 99 | 100 | #define SDL_CDROM_DISABLED 1 101 | #define SDL_AUDIO_DRIVER_DUMMY 1 102 | #define SDL_AUDIO_DRIVER_OSS 1 103 | 104 | #define SDL_INPUT_LINUXEV 1 105 | #define SDL_INPUT_TSLIB 1 106 | #define SDL_JOYSTICK_LINUX 1 107 | #define SDL_HAPTIC_LINUX 1 108 | 109 | #define SDL_LOADSO_DLOPEN 1 110 | 111 | #define SDL_THREAD_PTHREAD 1 112 | #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 113 | 114 | #define SDL_TIMER_UNIX 1 115 | 116 | #define SDL_VIDEO_DRIVER_DUMMY 1 117 | #define SDL_VIDEO_DRIVER_PANDORA 1 118 | #define SDL_VIDEO_RENDER_OGL_ES 1 119 | #define SDL_VIDEO_OPENGL_ES 1 120 | 121 | #endif /* _SDL_config_h */ 122 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2015 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_cpuinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_cpuinfo.h 24 | * 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 | /* Need to do this here because intrin.h has C++ code in it */ 34 | /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ 35 | #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64)) 36 | #include 37 | #ifndef _WIN64 38 | #define __MMX__ 39 | #define __3dNOW__ 40 | #endif 41 | #define __SSE__ 42 | #define __SSE2__ 43 | #elif defined(__MINGW64_VERSION_MAJOR) 44 | #include 45 | #else 46 | #ifdef __ALTIVEC__ 47 | #if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) 48 | #include 49 | #undef pixel 50 | #endif 51 | #endif 52 | #ifdef __MMX__ 53 | #include 54 | #endif 55 | #ifdef __3dNOW__ 56 | #include 57 | #endif 58 | #ifdef __SSE__ 59 | #include 60 | #endif 61 | #ifdef __SSE2__ 62 | #include 63 | #endif 64 | #endif 65 | 66 | #include "begin_code.h" 67 | /* Set up for C function definitions, even when using C++ */ 68 | #ifdef __cplusplus 69 | extern "C" { 70 | #endif 71 | 72 | /* This is a guess for the cacheline size used for padding. 73 | * Most x86 processors have a 64 byte cache line. 74 | * The 64-bit PowerPC processors have a 128 byte cache line. 75 | * We'll use the larger value to be generally safe. 76 | */ 77 | #define SDL_CACHELINE_SIZE 128 78 | 79 | /** 80 | * This function returns the number of CPU cores available. 81 | */ 82 | extern DECLSPEC int SDLCALL SDL_GetCPUCount(void); 83 | 84 | /** 85 | * This function returns the L1 cache line size of the CPU 86 | * 87 | * This is useful for determining multi-threaded structure padding 88 | * or SIMD prefetch sizes. 89 | */ 90 | extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); 91 | 92 | /** 93 | * This function returns true if the CPU has the RDTSC instruction. 94 | */ 95 | extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); 96 | 97 | /** 98 | * This function returns true if the CPU has AltiVec features. 99 | */ 100 | extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); 101 | 102 | /** 103 | * This function returns true if the CPU has MMX features. 104 | */ 105 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); 106 | 107 | /** 108 | * This function returns true if the CPU has 3DNow! features. 109 | */ 110 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); 111 | 112 | /** 113 | * This function returns true if the CPU has SSE features. 114 | */ 115 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); 116 | 117 | /** 118 | * This function returns true if the CPU has SSE2 features. 119 | */ 120 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); 121 | 122 | /** 123 | * This function returns true if the CPU has SSE3 features. 124 | */ 125 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void); 126 | 127 | /** 128 | * This function returns true if the CPU has SSE4.1 features. 129 | */ 130 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void); 131 | 132 | /** 133 | * This function returns true if the CPU has SSE4.2 features. 134 | */ 135 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void); 136 | 137 | /** 138 | * This function returns true if the CPU has AVX features. 139 | */ 140 | extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); 141 | 142 | /** 143 | * This function returns true if the CPU has AVX2 features. 144 | */ 145 | extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); 146 | 147 | /** 148 | * This function returns the amount of RAM configured in the system, in MB. 149 | */ 150 | extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); 151 | 152 | 153 | /* Ends C function definitions when using C++ */ 154 | #ifdef __cplusplus 155 | } 156 | #endif 157 | #include "close_code.h" 158 | 159 | #endif /* _SDL_cpuinfo_h */ 160 | 161 | /* vi: set ts=4 sw=4 expandtab: */ 162 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_error.h 24 | * 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 | /* Public functions */ 40 | /* SDL_SetError() unconditionally returns -1. */ 41 | extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 42 | extern DECLSPEC const char *SDLCALL SDL_GetError(void); 43 | extern DECLSPEC void SDLCALL SDL_ClearError(void); 44 | 45 | /** 46 | * \name Internal error functions 47 | * 48 | * \internal 49 | * Private error reporting function - used internally. 50 | */ 51 | /* @{ */ 52 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) 53 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) 54 | #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) 55 | typedef enum 56 | { 57 | SDL_ENOMEM, 58 | SDL_EFREAD, 59 | SDL_EFWRITE, 60 | SDL_EFSEEK, 61 | SDL_UNSUPPORTED, 62 | SDL_LASTERROR 63 | } SDL_errorcode; 64 | /* SDL_Error() unconditionally returns -1. */ 65 | extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); 66 | /* @} *//* Internal error functions */ 67 | 68 | /* Ends C function definitions when using C++ */ 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | #include "close_code.h" 73 | 74 | #endif /* _SDL_error_h */ 75 | 76 | /* vi: set ts=4 sw=4 expandtab: */ 77 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_filesystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_filesystem.h 24 | * 25 | * \brief Include file for filesystem SDL API functions 26 | */ 27 | 28 | #ifndef _SDL_filesystem_h 29 | #define _SDL_filesystem_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * \brief Get the path where the application resides. 42 | * 43 | * Get the "base path". This is the directory where the application was run 44 | * from, which is probably the installation directory, and may or may not 45 | * be the process's current working directory. 46 | * 47 | * This returns an absolute path in UTF-8 encoding, and is guaranteed to 48 | * end with a path separator ('\\' on Windows, '/' most other places). 49 | * 50 | * The pointer returned by this function is owned by you. Please call 51 | * SDL_free() on the pointer when you are done with it, or it will be a 52 | * memory leak. This is not necessarily a fast call, though, so you should 53 | * call this once near startup and save the string if you need it. 54 | * 55 | * Some platforms can't determine the application's path, and on other 56 | * platforms, this might be meaningless. In such cases, this function will 57 | * return NULL. 58 | * 59 | * \return String of base dir in UTF-8 encoding, or NULL on error. 60 | * 61 | * \sa SDL_GetPrefPath 62 | */ 63 | extern DECLSPEC char *SDLCALL SDL_GetBasePath(void); 64 | 65 | /** 66 | * \brief Get the user-and-app-specific path where files can be written. 67 | * 68 | * Get the "pref dir". This is meant to be where users can write personal 69 | * files (preferences and save games, etc) that are specific to your 70 | * application. This directory is unique per user, per application. 71 | * 72 | * This function will decide the appropriate location in the native filesystem, 73 | * create the directory if necessary, and return a string of the absolute 74 | * path to the directory in UTF-8 encoding. 75 | * 76 | * On Windows, the string might look like: 77 | * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\" 78 | * 79 | * On Linux, the string might look like: 80 | * "/home/bob/.local/share/My Program Name/" 81 | * 82 | * On Mac OS X, the string might look like: 83 | * "/Users/bob/Library/Application Support/My Program Name/" 84 | * 85 | * (etc.) 86 | * 87 | * You specify the name of your organization (if it's not a real organization, 88 | * your name or an Internet domain you own might do) and the name of your 89 | * application. These should be untranslated proper names. 90 | * 91 | * Both the org and app strings may become part of a directory name, so 92 | * please follow these rules: 93 | * 94 | * - Try to use the same org string (including case-sensitivity) for 95 | * all your applications that use this function. 96 | * - Always use a unique app string for each one, and make sure it never 97 | * changes for an app once you've decided on it. 98 | * - Unicode characters are legal, as long as it's UTF-8 encoded, but... 99 | * - ...only use letters, numbers, and spaces. Avoid punctuation like 100 | * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. 101 | * 102 | * This returns an absolute path in UTF-8 encoding, and is guaranteed to 103 | * end with a path separator ('\\' on Windows, '/' most other places). 104 | * 105 | * The pointer returned by this function is owned by you. Please call 106 | * SDL_free() on the pointer when you are done with it, or it will be a 107 | * memory leak. This is not necessarily a fast call, though, so you should 108 | * call this once near startup and save the string if you need it. 109 | * 110 | * You should assume the path returned by this function is the only safe 111 | * place to write files (and that SDL_GetBasePath(), while it might be 112 | * writable, or even the parent of the returned path, aren't where you 113 | * should be writing things). 114 | * 115 | * Some platforms can't determine the pref path, and on other 116 | * platforms, this might be meaningless. In such cases, this function will 117 | * return NULL. 118 | * 119 | * \param org The name of your organization. 120 | * \param app The name of your application. 121 | * \return UTF-8 string of user dir in platform-dependent notation. NULL 122 | * if there's a problem (creating directory failed, etc). 123 | * 124 | * \sa SDL_GetBasePath 125 | */ 126 | extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); 127 | 128 | /* Ends C function definitions when using C++ */ 129 | #ifdef __cplusplus 130 | } 131 | #endif 132 | #include "close_code.h" 133 | 134 | #endif /* _SDL_filesystem_h */ 135 | 136 | /* vi: set ts=4 sw=4 expandtab: */ 137 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_gesture.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_gesture.h 24 | * 25 | * Include file for SDL gesture event handling. 26 | */ 27 | 28 | #ifndef _SDL_gesture_h 29 | #define _SDL_gesture_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_video.h" 34 | 35 | #include "SDL_touch.h" 36 | 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 | typedef Sint64 SDL_GestureID; 45 | 46 | /* Function prototypes */ 47 | 48 | /** 49 | * \brief Begin Recording a gesture on the specified touch, or all touches (-1) 50 | * 51 | * 52 | */ 53 | extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); 54 | 55 | 56 | /** 57 | * \brief Save all currently loaded Dollar Gesture templates 58 | * 59 | * 60 | */ 61 | extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); 62 | 63 | /** 64 | * \brief Save a currently loaded Dollar Gesture template 65 | * 66 | * 67 | */ 68 | extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); 69 | 70 | 71 | /** 72 | * \brief Load Dollar Gesture templates from a file 73 | * 74 | * 75 | */ 76 | extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); 77 | 78 | 79 | /* Ends C function definitions when using C++ */ 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #include "close_code.h" 84 | 85 | #endif /* _SDL_gesture_h */ 86 | 87 | /* vi: set ts=4 sw=4 expandtab: */ 88 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_loadso.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_loadso.h 24 | * 25 | * System dependent library loading routines 26 | * 27 | * Some things to keep in mind: 28 | * \li These functions only work on C function names. Other languages may 29 | * have name mangling and intrinsic language support that varies from 30 | * compiler to compiler. 31 | * \li Make sure you declare your function pointers with the same calling 32 | * convention as the actual library function. Your code will crash 33 | * mysteriously if you do not do this. 34 | * \li Avoid namespace collisions. If you load a symbol from the library, 35 | * it is not defined whether or not it goes into the global symbol 36 | * namespace for the application. If it does and it conflicts with 37 | * symbols in your code or other shared libraries, you will not get 38 | * the results you expect. :) 39 | */ 40 | 41 | #ifndef _SDL_loadso_h 42 | #define _SDL_loadso_h 43 | 44 | #include "SDL_stdinc.h" 45 | #include "SDL_error.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /** 54 | * This function dynamically loads a shared object and returns a pointer 55 | * to the object handle (or NULL if there was an error). 56 | * The 'sofile' parameter is a system dependent name of the object file. 57 | */ 58 | extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile); 59 | 60 | /** 61 | * Given an object handle, this function looks up the address of the 62 | * named function in the shared object and returns it. This address 63 | * is no longer valid after calling SDL_UnloadObject(). 64 | */ 65 | extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, 66 | const char *name); 67 | 68 | /** 69 | * Unload a shared object from memory. 70 | */ 71 | extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); 72 | 73 | /* Ends C function definitions when using C++ */ 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | #include "close_code.h" 78 | 79 | #endif /* _SDL_loadso_h */ 80 | 81 | /* vi: set ts=4 sw=4 expandtab: */ 82 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_main.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_main_h 23 | #define _SDL_main_h 24 | 25 | #include "SDL_stdinc.h" 26 | 27 | /** 28 | * \file SDL_main.h 29 | * 30 | * Redefine main() on some platforms so that it is called by SDL. 31 | */ 32 | 33 | #ifndef SDL_MAIN_HANDLED 34 | #if defined(__WIN32__) 35 | /* On Windows SDL provides WinMain(), which parses the command line and passes 36 | the arguments to your main function. 37 | 38 | If you provide your own WinMain(), you may define SDL_MAIN_HANDLED 39 | */ 40 | #define SDL_MAIN_AVAILABLE 41 | 42 | #elif defined(__WINRT__) 43 | /* On WinRT, SDL provides a main function that initializes CoreApplication, 44 | creating an instance of IFrameworkView in the process. 45 | 46 | Please note that #include'ing SDL_main.h is not enough to get a main() 47 | function working. In non-XAML apps, the file, 48 | src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled 49 | into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be 50 | called, with a pointer to the Direct3D-hosted XAML control passed in. 51 | */ 52 | #define SDL_MAIN_NEEDED 53 | 54 | #elif defined(__IPHONEOS__) 55 | /* On iOS SDL provides a main function that creates an application delegate 56 | and starts the iOS application run loop. 57 | 58 | See src/video/uikit/SDL_uikitappdelegate.m for more details. 59 | */ 60 | #define SDL_MAIN_NEEDED 61 | 62 | #elif defined(__ANDROID__) 63 | /* On Android SDL provides a Java class in SDLActivity.java that is the 64 | main activity entry point. 65 | 66 | See README-android.md for more details on extending that class. 67 | */ 68 | #define SDL_MAIN_NEEDED 69 | 70 | #elif defined(__NACL__) 71 | /* On NACL we use ppapi_simple to set up the application helper code, 72 | then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before 73 | starting the user main function. 74 | All user code is run in a separate thread by ppapi_simple, thus 75 | allowing for blocking io to take place via nacl_io 76 | */ 77 | #define SDL_MAIN_NEEDED 78 | 79 | #endif 80 | #endif /* SDL_MAIN_HANDLED */ 81 | 82 | #ifdef __cplusplus 83 | #define C_LINKAGE "C" 84 | #else 85 | #define C_LINKAGE 86 | #endif /* __cplusplus */ 87 | 88 | /** 89 | * \file SDL_main.h 90 | * 91 | * The application's main() function must be called with C linkage, 92 | * and should be declared like this: 93 | * \code 94 | * #ifdef __cplusplus 95 | * extern "C" 96 | * #endif 97 | * int main(int argc, char *argv[]) 98 | * { 99 | * } 100 | * \endcode 101 | */ 102 | 103 | #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) 104 | #define main SDL_main 105 | #endif 106 | 107 | /** 108 | * The prototype for the application's main() function 109 | */ 110 | extern C_LINKAGE int SDL_main(int argc, char *argv[]); 111 | 112 | 113 | #include "begin_code.h" 114 | #ifdef __cplusplus 115 | extern "C" { 116 | #endif 117 | 118 | /** 119 | * This is called by the real SDL main function to let the rest of the 120 | * library know that initialization was done properly. 121 | * 122 | * Calling this yourself without knowing what you're doing can cause 123 | * crashes and hard to diagnose problems with your application. 124 | */ 125 | extern DECLSPEC void SDLCALL SDL_SetMainReady(void); 126 | 127 | #ifdef __WIN32__ 128 | 129 | /** 130 | * This can be called to set the application class at startup 131 | */ 132 | extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, 133 | void *hInst); 134 | extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); 135 | 136 | #endif /* __WIN32__ */ 137 | 138 | 139 | #ifdef __WINRT__ 140 | 141 | /** 142 | * \brief Initializes and launches an SDL/WinRT application. 143 | * 144 | * \param mainFunction The SDL app's C-style main(). 145 | * \param reserved Reserved for future use; should be NULL 146 | * \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more 147 | * information on the failure. 148 | */ 149 | extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved); 150 | 151 | #endif /* __WINRT__ */ 152 | 153 | 154 | #ifdef __cplusplus 155 | } 156 | #endif 157 | #include "close_code.h" 158 | 159 | #endif /* _SDL_main_h */ 160 | 161 | /* vi: set ts=4 sw=4 expandtab: */ 162 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_messagebox.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_messagebox_h 23 | #define _SDL_messagebox_h 24 | 25 | #include "SDL_stdinc.h" 26 | #include "SDL_video.h" /* For SDL_Window */ 27 | 28 | #include "begin_code.h" 29 | /* Set up for C function definitions, even when using C++ */ 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /** 35 | * \brief SDL_MessageBox flags. If supported will display warning icon, etc. 36 | */ 37 | typedef enum 38 | { 39 | SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ 40 | SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ 41 | SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */ 42 | } SDL_MessageBoxFlags; 43 | 44 | /** 45 | * \brief Flags for SDL_MessageBoxButtonData. 46 | */ 47 | typedef enum 48 | { 49 | SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ 50 | SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ 51 | } SDL_MessageBoxButtonFlags; 52 | 53 | /** 54 | * \brief Individual button data. 55 | */ 56 | typedef struct 57 | { 58 | Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ 59 | int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ 60 | const char * text; /**< The UTF-8 button text */ 61 | } SDL_MessageBoxButtonData; 62 | 63 | /** 64 | * \brief RGB value used in a message box color scheme 65 | */ 66 | typedef struct 67 | { 68 | Uint8 r, g, b; 69 | } SDL_MessageBoxColor; 70 | 71 | typedef enum 72 | { 73 | SDL_MESSAGEBOX_COLOR_BACKGROUND, 74 | SDL_MESSAGEBOX_COLOR_TEXT, 75 | SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, 76 | SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, 77 | SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, 78 | SDL_MESSAGEBOX_COLOR_MAX 79 | } SDL_MessageBoxColorType; 80 | 81 | /** 82 | * \brief A set of colors to use for message box dialogs 83 | */ 84 | typedef struct 85 | { 86 | SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; 87 | } SDL_MessageBoxColorScheme; 88 | 89 | /** 90 | * \brief MessageBox structure containing title, text, window, etc. 91 | */ 92 | typedef struct 93 | { 94 | Uint32 flags; /**< ::SDL_MessageBoxFlags */ 95 | SDL_Window *window; /**< Parent window, can be NULL */ 96 | const char *title; /**< UTF-8 title */ 97 | const char *message; /**< UTF-8 message text */ 98 | 99 | int numbuttons; 100 | const SDL_MessageBoxButtonData *buttons; 101 | 102 | const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */ 103 | } SDL_MessageBoxData; 104 | 105 | /** 106 | * \brief Create a modal message box. 107 | * 108 | * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc. 109 | * \param buttonid The pointer to which user id of hit button should be copied. 110 | * 111 | * \return -1 on error, otherwise 0 and buttonid contains user id of button 112 | * hit or -1 if dialog was closed. 113 | * 114 | * \note This function should be called on the thread that created the parent 115 | * window, or on the main thread if the messagebox has no parent. It will 116 | * block execution of that thread until the user clicks a button or 117 | * closes the messagebox. 118 | */ 119 | extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); 120 | 121 | /** 122 | * \brief Create a simple modal message box 123 | * 124 | * \param flags ::SDL_MessageBoxFlags 125 | * \param title UTF-8 title text 126 | * \param message UTF-8 message text 127 | * \param window The parent window, or NULL for no parent 128 | * 129 | * \return 0 on success, -1 on error 130 | * 131 | * \sa SDL_ShowMessageBox 132 | */ 133 | extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); 134 | 135 | 136 | /* Ends C function definitions when using C++ */ 137 | #ifdef __cplusplus 138 | } 139 | #endif 140 | #include "close_code.h" 141 | 142 | #endif /* _SDL_messagebox_h */ 143 | 144 | /* vi: set ts=4 sw=4 expandtab: */ 145 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDLname_h_ 23 | #define _SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* _SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef APIENTRY 38 | #define APIENTRY 39 | #endif 40 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifndef _MSC_VER 30 | 31 | #ifdef __IPHONEOS__ 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #include 38 | #endif 39 | 40 | #else /* _MSC_VER */ 41 | 42 | /* OpenGL ES2 headers for Visual Studio */ 43 | #include "SDL_opengles2_khrplatform.h" 44 | #include "SDL_opengles2_gl2platform.h" 45 | #include "SDL_opengles2_gl2.h" 46 | #include "SDL_opengles2_gl2ext.h" 47 | 48 | #endif /* _MSC_VER */ 49 | 50 | #ifndef APIENTRY 51 | #define APIENTRY GL_APIENTRY 52 | #endif 53 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | /*#include */ 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_platform.h 24 | * 25 | * Try to get a standard set of platform defines. 26 | */ 27 | 28 | #ifndef _SDL_platform_h 29 | #define _SDL_platform_h 30 | 31 | #if defined(_AIX) 32 | #undef __AIX__ 33 | #define __AIX__ 1 34 | #endif 35 | #if defined(__HAIKU__) 36 | #undef __HAIKU__ 37 | #define __HAIKU__ 1 38 | #endif 39 | #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) 40 | #undef __BSDI__ 41 | #define __BSDI__ 1 42 | #endif 43 | #if defined(_arch_dreamcast) 44 | #undef __DREAMCAST__ 45 | #define __DREAMCAST__ 1 46 | #endif 47 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 48 | #undef __FREEBSD__ 49 | #define __FREEBSD__ 1 50 | #endif 51 | #if defined(hpux) || defined(__hpux) || defined(__hpux__) 52 | #undef __HPUX__ 53 | #define __HPUX__ 1 54 | #endif 55 | #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) 56 | #undef __IRIX__ 57 | #define __IRIX__ 1 58 | #endif 59 | #if (defined(linux) || defined(__linux) || defined(__linux__)) 60 | #undef __LINUX__ 61 | #define __LINUX__ 1 62 | #endif 63 | #if defined(ANDROID) || defined(__ANDROID__) 64 | #undef __ANDROID__ 65 | #undef __LINUX__ /* do we need to do this? */ 66 | #define __ANDROID__ 1 67 | #endif 68 | 69 | #if defined(__APPLE__) 70 | /* lets us know what version of Mac OS X we're compiling on */ 71 | #include "AvailabilityMacros.h" 72 | #include "TargetConditionals.h" 73 | #if TARGET_OS_TV 74 | #undef __TVOS__ 75 | #define __TVOS__ 1 76 | #endif 77 | #if TARGET_OS_IPHONE 78 | /* if compiling for iOS */ 79 | #undef __IPHONEOS__ 80 | #define __IPHONEOS__ 1 81 | #undef __MACOSX__ 82 | #else 83 | /* if not compiling for iOS */ 84 | #undef __MACOSX__ 85 | #define __MACOSX__ 1 86 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 87 | # error SDL for Mac OS X only supports deploying on 10.6 and above. 88 | #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ 89 | #endif /* TARGET_OS_IPHONE */ 90 | #endif /* defined(__APPLE__) */ 91 | 92 | #if defined(__NetBSD__) 93 | #undef __NETBSD__ 94 | #define __NETBSD__ 1 95 | #endif 96 | #if defined(__OpenBSD__) 97 | #undef __OPENBSD__ 98 | #define __OPENBSD__ 1 99 | #endif 100 | #if defined(__OS2__) 101 | #undef __OS2__ 102 | #define __OS2__ 1 103 | #endif 104 | #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) 105 | #undef __OSF__ 106 | #define __OSF__ 1 107 | #endif 108 | #if defined(__QNXNTO__) 109 | #undef __QNXNTO__ 110 | #define __QNXNTO__ 1 111 | #endif 112 | #if defined(riscos) || defined(__riscos) || defined(__riscos__) 113 | #undef __RISCOS__ 114 | #define __RISCOS__ 1 115 | #endif 116 | #if defined(__sun) && defined(__SVR4) 117 | #undef __SOLARIS__ 118 | #define __SOLARIS__ 1 119 | #endif 120 | 121 | #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) 122 | /* Try to find out if we're compiling for WinRT or non-WinRT */ 123 | /* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */ 124 | #if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */ 125 | #include 126 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 127 | #undef __WINDOWS__ 128 | #define __WINDOWS__ 1 129 | /* See if we're compiling for WinRT: */ 130 | #elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 131 | #undef __WINRT__ 132 | #define __WINRT__ 1 133 | #endif 134 | #else 135 | #undef __WINDOWS__ 136 | #define __WINDOWS__ 1 137 | #endif /* _MSC_VER < 1700 */ 138 | #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */ 139 | 140 | #if defined(__WINDOWS__) 141 | #undef __WIN32__ 142 | #define __WIN32__ 1 143 | #endif 144 | #if defined(__PSP__) 145 | #undef __PSP__ 146 | #define __PSP__ 1 147 | #endif 148 | 149 | /* The NACL compiler defines __native_client__ and __pnacl__ 150 | * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi 151 | */ 152 | #if defined(__native_client__) 153 | #undef __LINUX__ 154 | #undef __NACL__ 155 | #define __NACL__ 1 156 | #endif 157 | #if defined(__pnacl__) 158 | #undef __LINUX__ 159 | #undef __PNACL__ 160 | #define __PNACL__ 1 161 | /* PNACL with newlib supports static linking only */ 162 | #define __SDL_NOGETPROCADDR__ 163 | #endif 164 | 165 | 166 | #include "begin_code.h" 167 | /* Set up for C function definitions, even when using C++ */ 168 | #ifdef __cplusplus 169 | extern "C" { 170 | #endif 171 | 172 | /** 173 | * \brief Gets the name of the platform. 174 | */ 175 | extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); 176 | 177 | /* Ends C function definitions when using C++ */ 178 | #ifdef __cplusplus 179 | } 180 | #endif 181 | #include "close_code.h" 182 | 183 | #endif /* _SDL_platform_h */ 184 | 185 | /* vi: set ts=4 sw=4 expandtab: */ 186 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_power.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_power_h 23 | #define _SDL_power_h 24 | 25 | /** 26 | * \file SDL_power.h 27 | * 28 | * Header for the SDL power management routines. 29 | */ 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 | * \brief The basic state for the system's power supply. 41 | */ 42 | typedef enum 43 | { 44 | SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ 45 | SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ 46 | SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ 47 | SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ 48 | SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ 49 | } SDL_PowerState; 50 | 51 | 52 | /** 53 | * \brief Get the current power supply details. 54 | * 55 | * \param secs Seconds of battery life left. You can pass a NULL here if 56 | * you don't care. Will return -1 if we can't determine a 57 | * value, or we're not running on a battery. 58 | * 59 | * \param pct Percentage of battery life left, between 0 and 100. You can 60 | * pass a NULL here if you don't care. Will return -1 if we 61 | * can't determine a value, or we're not running on a battery. 62 | * 63 | * \return The state of the battery (if any). 64 | */ 65 | extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); 66 | 67 | /* Ends C function definitions when using C++ */ 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | #include "close_code.h" 72 | 73 | #endif /* _SDL_power_h */ 74 | 75 | /* vi: set ts=4 sw=4 expandtab: */ 76 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_quit.h 24 | * 25 | * Include file for SDL quit event handling. 26 | */ 27 | 28 | #ifndef _SDL_quit_h 29 | #define _SDL_quit_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | /** 35 | * \file SDL_quit.h 36 | * 37 | * An ::SDL_QUIT event is generated when the user tries to close the application 38 | * window. If it is ignored or filtered out, the window will remain open. 39 | * If it is not ignored or filtered, it is queued normally and the window 40 | * is allowed to close. When the window is closed, screen updates will 41 | * complete, but have no effect. 42 | * 43 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 44 | * and SIGTERM (system termination request), if handlers do not already 45 | * exist, that generate ::SDL_QUIT events as well. There is no way 46 | * to determine the cause of an ::SDL_QUIT event, but setting a signal 47 | * handler in your application will override the default generation of 48 | * quit events for that signal. 49 | * 50 | * \sa SDL_Quit() 51 | */ 52 | 53 | /* There are no functions directly affecting the quit event */ 54 | 55 | #define SDL_QuitRequested() \ 56 | (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) 57 | 58 | #endif /* _SDL_quit_h */ 59 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_rect.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_rect.h 24 | * 25 | * Header file for SDL_rect definition and management functions. 26 | */ 27 | 28 | #ifndef _SDL_rect_h 29 | #define _SDL_rect_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_pixels.h" 34 | #include "SDL_rwops.h" 35 | 36 | #include "begin_code.h" 37 | /* Set up for C function definitions, even when using C++ */ 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /** 43 | * \brief The structure that defines a point 44 | * 45 | * \sa SDL_EnclosePoints 46 | * \sa SDL_PointInRect 47 | */ 48 | typedef struct SDL_Point 49 | { 50 | int x; 51 | int y; 52 | } SDL_Point; 53 | 54 | /** 55 | * \brief A rectangle, with the origin at the upper left. 56 | * 57 | * \sa SDL_RectEmpty 58 | * \sa SDL_RectEquals 59 | * \sa SDL_HasIntersection 60 | * \sa SDL_IntersectRect 61 | * \sa SDL_UnionRect 62 | * \sa SDL_EnclosePoints 63 | */ 64 | typedef struct SDL_Rect 65 | { 66 | int x, y; 67 | int w, h; 68 | } SDL_Rect; 69 | 70 | /** 71 | * \brief Returns true if point resides inside a rectangle. 72 | */ 73 | SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) 74 | { 75 | return ( (p->x >= r->x) && (p->x < (r->x + r->w)) && 76 | (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; 77 | } 78 | 79 | /** 80 | * \brief Returns true if the rectangle has no area. 81 | */ 82 | SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) 83 | { 84 | return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE; 85 | } 86 | 87 | /** 88 | * \brief Returns true if the two rectangles are equal. 89 | */ 90 | SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b) 91 | { 92 | return (a && b && (a->x == b->x) && (a->y == b->y) && 93 | (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE; 94 | } 95 | 96 | /** 97 | * \brief Determine whether two rectangles intersect. 98 | * 99 | * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. 100 | */ 101 | extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, 102 | const SDL_Rect * B); 103 | 104 | /** 105 | * \brief Calculate the intersection of two rectangles. 106 | * 107 | * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. 108 | */ 109 | extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, 110 | const SDL_Rect * B, 111 | SDL_Rect * result); 112 | 113 | /** 114 | * \brief Calculate the union of two rectangles. 115 | */ 116 | extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, 117 | const SDL_Rect * B, 118 | SDL_Rect * result); 119 | 120 | /** 121 | * \brief Calculate a minimal rectangle enclosing a set of points 122 | * 123 | * \return SDL_TRUE if any points were within the clipping rect 124 | */ 125 | extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, 126 | int count, 127 | const SDL_Rect * clip, 128 | SDL_Rect * result); 129 | 130 | /** 131 | * \brief Calculate the intersection of a rectangle and line segment. 132 | * 133 | * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. 134 | */ 135 | extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * 136 | rect, int *X1, 137 | int *Y1, int *X2, 138 | int *Y2); 139 | 140 | /* Ends C function definitions when using C++ */ 141 | #ifdef __cplusplus 142 | } 143 | #endif 144 | #include "close_code.h" 145 | 146 | #endif /* _SDL_rect_h */ 147 | 148 | /* vi: set ts=4 sw=4 expandtab: */ 149 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_revision.h: -------------------------------------------------------------------------------- 1 | #define SDL_REVISION "hg-10556:007dfe83abf8" 2 | #define SDL_REVISION_NUMBER 10556 3 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef _SDL_test_h 31 | #define _SDL_test_h 32 | 33 | #include "SDL.h" 34 | #include "SDL_test_common.h" 35 | #include "SDL_test_font.h" 36 | #include "SDL_test_random.h" 37 | #include "SDL_test_fuzzer.h" 38 | #include "SDL_test_crc32.h" 39 | #include "SDL_test_md5.h" 40 | #include "SDL_test_log.h" 41 | #include "SDL_test_assert.h" 42 | #include "SDL_test_harness.h" 43 | #include "SDL_test_images.h" 44 | #include "SDL_test_compare.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 | /* Global definitions */ 53 | 54 | /* 55 | * Note: Maximum size of SDLTest log message is less than SDL's limit 56 | * to ensure we can fit additional information such as the timestamp. 57 | */ 58 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 59 | 60 | /* Ends C function definitions when using C++ */ 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | #include "close_code.h" 65 | 66 | #endif /* _SDL_test_h */ 67 | 68 | /* vi: set ts=4 sw=4 expandtab: */ 69 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_test_assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_assert.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Assert API for test code and test cases 33 | * 34 | */ 35 | 36 | #ifndef _SDL_test_assert_h 37 | #define _SDL_test_assert_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 | /** 46 | * \brief Fails the assert. 47 | */ 48 | #define ASSERT_FAIL 0 49 | 50 | /** 51 | * \brief Passes the assert. 52 | */ 53 | #define ASSERT_PASS 1 54 | 55 | /** 56 | * \brief Assert that logs and break execution flow on failures. 57 | * 58 | * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). 59 | * \param assertDescription Message to log with the assert describing it. 60 | */ 61 | void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); 62 | 63 | /** 64 | * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. 65 | * 66 | * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). 67 | * \param assertDescription Message to log with the assert describing it. 68 | * 69 | * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired. 70 | */ 71 | int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); 72 | 73 | /** 74 | * \brief Explicitly pass without checking an assertion condition. Updates assertion counter. 75 | * 76 | * \param assertDescription Message to log with the assert describing it. 77 | */ 78 | void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1); 79 | 80 | /** 81 | * \brief Resets the assert summary counters to zero. 82 | */ 83 | void SDLTest_ResetAssertSummary(); 84 | 85 | /** 86 | * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. 87 | */ 88 | void SDLTest_LogAssertSummary(); 89 | 90 | 91 | /** 92 | * \brief Converts the current assert summary state to a test result. 93 | * 94 | * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT 95 | */ 96 | int SDLTest_AssertSummaryToTestResult(); 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | #include "close_code.h" 102 | 103 | #endif /* _SDL_test_assert_h */ 104 | 105 | /* vi: set ts=4 sw=4 expandtab: */ 106 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_test_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_common.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* Ported from original test\common.h file. */ 31 | 32 | #ifndef _SDL_test_common_h 33 | #define _SDL_test_common_h 34 | 35 | #include "SDL.h" 36 | 37 | #if defined(__PSP__) 38 | #define DEFAULT_WINDOW_WIDTH 480 39 | #define DEFAULT_WINDOW_HEIGHT 272 40 | #else 41 | #define DEFAULT_WINDOW_WIDTH 640 42 | #define DEFAULT_WINDOW_HEIGHT 480 43 | #endif 44 | 45 | #define VERBOSE_VIDEO 0x00000001 46 | #define VERBOSE_MODES 0x00000002 47 | #define VERBOSE_RENDER 0x00000004 48 | #define VERBOSE_EVENT 0x00000008 49 | #define VERBOSE_AUDIO 0x00000010 50 | 51 | typedef struct 52 | { 53 | /* SDL init flags */ 54 | char **argv; 55 | Uint32 flags; 56 | Uint32 verbose; 57 | 58 | /* Video info */ 59 | const char *videodriver; 60 | int display; 61 | const char *window_title; 62 | const char *window_icon; 63 | Uint32 window_flags; 64 | int window_x; 65 | int window_y; 66 | int window_w; 67 | int window_h; 68 | int window_minW; 69 | int window_minH; 70 | int window_maxW; 71 | int window_maxH; 72 | int logical_w; 73 | int logical_h; 74 | float scale; 75 | int depth; 76 | int refresh_rate; 77 | int num_windows; 78 | SDL_Window **windows; 79 | 80 | /* Renderer info */ 81 | const char *renderdriver; 82 | Uint32 render_flags; 83 | SDL_bool skip_renderer; 84 | SDL_Renderer **renderers; 85 | SDL_Texture **targets; 86 | 87 | /* Audio info */ 88 | const char *audiodriver; 89 | SDL_AudioSpec audiospec; 90 | 91 | /* GL settings */ 92 | int gl_red_size; 93 | int gl_green_size; 94 | int gl_blue_size; 95 | int gl_alpha_size; 96 | int gl_buffer_size; 97 | int gl_depth_size; 98 | int gl_stencil_size; 99 | int gl_double_buffer; 100 | int gl_accum_red_size; 101 | int gl_accum_green_size; 102 | int gl_accum_blue_size; 103 | int gl_accum_alpha_size; 104 | int gl_stereo; 105 | int gl_multisamplebuffers; 106 | int gl_multisamplesamples; 107 | int gl_retained_backing; 108 | int gl_accelerated; 109 | int gl_major_version; 110 | int gl_minor_version; 111 | int gl_debug; 112 | int gl_profile_mask; 113 | } SDLTest_CommonState; 114 | 115 | #include "begin_code.h" 116 | /* Set up for C function definitions, even when using C++ */ 117 | #ifdef __cplusplus 118 | extern "C" { 119 | #endif 120 | 121 | /* Function prototypes */ 122 | 123 | /** 124 | * \brief Parse command line parameters and create common state. 125 | * 126 | * \param argv Array of command line parameters 127 | * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO) 128 | * 129 | * \returns Returns a newly allocated common state object. 130 | */ 131 | SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags); 132 | 133 | /** 134 | * \brief Process one common argument. 135 | * 136 | * \param state The common state describing the test window to create. 137 | * \param index The index of the argument to process in argv[]. 138 | * 139 | * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error. 140 | */ 141 | int SDLTest_CommonArg(SDLTest_CommonState * state, int index); 142 | 143 | /** 144 | * \brief Returns common usage information 145 | * 146 | * \param state The common state describing the test window to create. 147 | * 148 | * \returns String with usage information 149 | */ 150 | const char *SDLTest_CommonUsage(SDLTest_CommonState * state); 151 | 152 | /** 153 | * \brief Open test window. 154 | * 155 | * \param state The common state describing the test window to create. 156 | * 157 | * \returns True if initialization succeeded, false otherwise 158 | */ 159 | SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state); 160 | 161 | /** 162 | * \brief Common event handler for test windows. 163 | * 164 | * \param state The common state used to create test window. 165 | * \param event The event to handle. 166 | * \param done Flag indicating we are done. 167 | * 168 | */ 169 | void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done); 170 | 171 | /** 172 | * \brief Close test window. 173 | * 174 | * \param state The common state used to create test window. 175 | * 176 | */ 177 | void SDLTest_CommonQuit(SDLTest_CommonState * state); 178 | 179 | 180 | /* Ends C function definitions when using C++ */ 181 | #ifdef __cplusplus 182 | } 183 | #endif 184 | #include "close_code.h" 185 | 186 | #endif /* _SDL_test_common_h */ 187 | 188 | /* vi: set ts=4 sw=4 expandtab: */ 189 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_test_compare.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_compare.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines comparison functions (i.e. for surfaces). 33 | 34 | */ 35 | 36 | #ifndef _SDL_test_compare_h 37 | #define _SDL_test_compare_h 38 | 39 | #include "SDL.h" 40 | 41 | #include "SDL_test_images.h" 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * \brief Compares a surface and with reference image data for equality 51 | * 52 | * \param surface Surface used in comparison 53 | * \param referenceSurface Test Surface used in comparison 54 | * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. 55 | * 56 | * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. 57 | */ 58 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); 59 | 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* _SDL_test_compare_h */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_test_crc32.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_crc32.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Implements CRC32 calculations (default output is Perl String::CRC32 compatible). 33 | 34 | */ 35 | 36 | #ifndef _SDL_test_crc32_h 37 | #define _SDL_test_crc32_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 | 46 | /* ------------ Definitions --------- */ 47 | 48 | /* Definition shared by all CRC routines */ 49 | 50 | #ifndef CrcUint32 51 | #define CrcUint32 unsigned int 52 | #endif 53 | #ifndef CrcUint8 54 | #define CrcUint8 unsigned char 55 | #endif 56 | 57 | #ifdef ORIGINAL_METHOD 58 | #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */ 59 | #else 60 | #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */ 61 | #endif 62 | 63 | /** 64 | * Data structure for CRC32 (checksum) computation 65 | */ 66 | typedef struct { 67 | CrcUint32 crc32_table[256]; /* CRC table */ 68 | } SDLTest_Crc32Context; 69 | 70 | /* ---------- Function Prototypes ------------- */ 71 | 72 | /** 73 | * \brief Initialize the CRC context 74 | * 75 | * Note: The function initializes the crc table required for all crc calculations. 76 | * 77 | * \param crcContext pointer to context variable 78 | * 79 | * \returns 0 for OK, -1 on error 80 | * 81 | */ 82 | int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext); 83 | 84 | 85 | /** 86 | * \brief calculate a crc32 from a data block 87 | * 88 | * \param crcContext pointer to context variable 89 | * \param inBuf input buffer to checksum 90 | * \param inLen length of input buffer 91 | * \param crc32 pointer to Uint32 to store the final CRC into 92 | * 93 | * \returns 0 for OK, -1 on error 94 | * 95 | */ 96 | int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); 97 | 98 | /* Same routine broken down into three steps */ 99 | int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); 100 | int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); 101 | int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); 102 | 103 | 104 | /** 105 | * \brief clean up CRC context 106 | * 107 | * \param crcContext pointer to context variable 108 | * 109 | * \returns 0 for OK, -1 on error 110 | * 111 | */ 112 | 113 | int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); 114 | 115 | 116 | /* Ends C function definitions when using C++ */ 117 | #ifdef __cplusplus 118 | } 119 | #endif 120 | #include "close_code.h" 121 | 122 | #endif /* _SDL_test_crc32_h */ 123 | 124 | /* vi: set ts=4 sw=4 expandtab: */ 125 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_test_font.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_font.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef _SDL_test_font_h 31 | #define _SDL_test_font_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 | /* Function prototypes */ 40 | 41 | #define FONT_CHARACTER_SIZE 8 42 | 43 | /** 44 | * \brief Draw a string in the currently set font. 45 | * 46 | * \param renderer The renderer to draw on. 47 | * \param x The X coordinate of the upper left corner of the character. 48 | * \param y The Y coordinate of the upper left corner of the character. 49 | * \param c The character to draw. 50 | * 51 | * \returns Returns 0 on success, -1 on failure. 52 | */ 53 | int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c ); 54 | 55 | /** 56 | * \brief Draw a string in the currently set font. 57 | * 58 | * \param renderer The renderer to draw on. 59 | * \param x The X coordinate of the upper left corner of the string. 60 | * \param y The Y coordinate of the upper left corner of the string. 61 | * \param s The string to draw. 62 | * 63 | * \returns Returns 0 on success, -1 on failure. 64 | */ 65 | int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s ); 66 | 67 | 68 | /* Ends C function definitions when using C++ */ 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | #include "close_code.h" 73 | 74 | #endif /* _SDL_test_font_h */ 75 | 76 | /* vi: set ts=4 sw=4 expandtab: */ 77 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_test_harness.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_harness.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | Defines types for test case definitions and the test execution harness API. 32 | 33 | Based on original GSOC code by Markus Kauppila 34 | */ 35 | 36 | #ifndef _SDL_test_harness_h 37 | #define _SDL_test_harness_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 | 46 | /* ! Definitions for test case structures */ 47 | #define TEST_ENABLED 1 48 | #define TEST_DISABLED 0 49 | 50 | /* ! Definition of all the possible test return values of the test case method */ 51 | #define TEST_ABORTED -1 52 | #define TEST_STARTED 0 53 | #define TEST_COMPLETED 1 54 | #define TEST_SKIPPED 2 55 | 56 | /* ! Definition of all the possible test results for the harness */ 57 | #define TEST_RESULT_PASSED 0 58 | #define TEST_RESULT_FAILED 1 59 | #define TEST_RESULT_NO_ASSERT 2 60 | #define TEST_RESULT_SKIPPED 3 61 | #define TEST_RESULT_SETUP_FAILURE 4 62 | 63 | /* !< Function pointer to a test case setup function (run before every test) */ 64 | typedef void (*SDLTest_TestCaseSetUpFp)(void *arg); 65 | 66 | /* !< Function pointer to a test case function */ 67 | typedef int (*SDLTest_TestCaseFp)(void *arg); 68 | 69 | /* !< Function pointer to a test case teardown function (run after every test) */ 70 | typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); 71 | 72 | /** 73 | * Holds information about a single test case. 74 | */ 75 | typedef struct SDLTest_TestCaseReference { 76 | /* !< Func2Stress */ 77 | SDLTest_TestCaseFp testCase; 78 | /* !< Short name (or function name) "Func2Stress" */ 79 | char *name; 80 | /* !< Long name or full description "This test pushes func2() to the limit." */ 81 | char *description; 82 | /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */ 83 | int enabled; 84 | } SDLTest_TestCaseReference; 85 | 86 | /** 87 | * Holds information about a test suite (multiple test cases). 88 | */ 89 | typedef struct SDLTest_TestSuiteReference { 90 | /* !< "PlatformSuite" */ 91 | char *name; 92 | /* !< The function that is run before each test. NULL skips. */ 93 | SDLTest_TestCaseSetUpFp testSetUp; 94 | /* !< The test cases that are run as part of the suite. Last item should be NULL. */ 95 | const SDLTest_TestCaseReference **testCases; 96 | /* !< The function that is run after each test. NULL skips. */ 97 | SDLTest_TestCaseTearDownFp testTearDown; 98 | } SDLTest_TestSuiteReference; 99 | 100 | 101 | /** 102 | * \brief Execute a test suite using the given run seed and execution key. 103 | * 104 | * \param testSuites Suites containing the test case. 105 | * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one. 106 | * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. 107 | * \param filter Filter specification. NULL disables. Case sensitive. 108 | * \param testIterations Number of iterations to run each test case. 109 | * 110 | * \returns Test run result; 0 when all tests passed, 1 if any tests failed. 111 | */ 112 | int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations); 113 | 114 | 115 | /* Ends C function definitions when using C++ */ 116 | #ifdef __cplusplus 117 | } 118 | #endif 119 | #include "close_code.h" 120 | 121 | #endif /* _SDL_test_harness_h */ 122 | 123 | /* vi: set ts=4 sw=4 expandtab: */ 124 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_test_images.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_images.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines some images for tests. 33 | 34 | */ 35 | 36 | #ifndef _SDL_test_images_h 37 | #define _SDL_test_images_h 38 | 39 | #include "SDL.h" 40 | 41 | #include "begin_code.h" 42 | /* Set up for C function definitions, even when using C++ */ 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /** 48 | *Type for test images. 49 | */ 50 | typedef struct SDLTest_SurfaceImage_s { 51 | int width; 52 | int height; 53 | unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ 54 | const char *pixel_data; 55 | } SDLTest_SurfaceImage_t; 56 | 57 | /* Test images */ 58 | SDL_Surface *SDLTest_ImageBlit(); 59 | SDL_Surface *SDLTest_ImageBlitColor(); 60 | SDL_Surface *SDLTest_ImageBlitAlpha(); 61 | SDL_Surface *SDLTest_ImageBlitBlendAdd(); 62 | SDL_Surface *SDLTest_ImageBlitBlend(); 63 | SDL_Surface *SDLTest_ImageBlitBlendMod(); 64 | SDL_Surface *SDLTest_ImageBlitBlendNone(); 65 | SDL_Surface *SDLTest_ImageBlitBlendAll(); 66 | SDL_Surface *SDLTest_ImageFace(); 67 | SDL_Surface *SDLTest_ImagePrimitives(); 68 | SDL_Surface *SDLTest_ImagePrimitivesBlend(); 69 | 70 | /* Ends C function definitions when using C++ */ 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | #include "close_code.h" 75 | 76 | #endif /* _SDL_test_images_h */ 77 | 78 | /* vi: set ts=4 sw=4 expandtab: */ 79 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_test_log.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_log.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Wrapper to log in the TEST category 33 | * 34 | */ 35 | 36 | #ifndef _SDL_test_log_h 37 | #define _SDL_test_log_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 | /** 46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority. 47 | * 48 | * \param fmt Message to be logged 49 | */ 50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 51 | 52 | /** 53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. 54 | * 55 | * \param fmt Message to be logged 56 | */ 57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 58 | 59 | /* Ends C function definitions when using C++ */ 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #include "close_code.h" 64 | 65 | #endif /* _SDL_test_log_h */ 66 | 67 | /* vi: set ts=4 sw=4 expandtab: */ 68 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_test_md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_md5.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | *********************************************************************** 32 | ** Header file for implementation of MD5 ** 33 | ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** 34 | ** Created: 2/17/90 RLR ** 35 | ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** 36 | ** Revised (for MD5): RLR 4/27/91 ** 37 | ** -- G modified to have y&~z instead of y&z ** 38 | ** -- FF, GG, HH modified to add in last register done ** 39 | ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** 40 | ** -- distinct additive constant for each step ** 41 | ** -- round 4 added, working mod 7 ** 42 | *********************************************************************** 43 | */ 44 | 45 | /* 46 | *********************************************************************** 47 | ** Message-digest routines: ** 48 | ** To form the message digest for a message M ** 49 | ** (1) Initialize a context buffer mdContext using MD5Init ** 50 | ** (2) Call MD5Update on mdContext and M ** 51 | ** (3) Call MD5Final on mdContext ** 52 | ** The message digest is now in mdContext->digest[0...15] ** 53 | *********************************************************************** 54 | */ 55 | 56 | #ifndef _SDL_test_md5_h 57 | #define _SDL_test_md5_h 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 | /* ------------ Definitions --------- */ 66 | 67 | /* typedef a 32-bit type */ 68 | typedef unsigned long int MD5UINT4; 69 | 70 | /* Data structure for MD5 (Message-Digest) computation */ 71 | typedef struct { 72 | MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ 73 | MD5UINT4 buf[4]; /* scratch buffer */ 74 | unsigned char in[64]; /* input buffer */ 75 | unsigned char digest[16]; /* actual digest after Md5Final call */ 76 | } SDLTest_Md5Context; 77 | 78 | /* ---------- Function Prototypes ------------- */ 79 | 80 | /** 81 | * \brief initialize the context 82 | * 83 | * \param mdContext pointer to context variable 84 | * 85 | * Note: The function initializes the message-digest context 86 | * mdContext. Call before each new use of the context - 87 | * all fields are set to zero. 88 | */ 89 | void SDLTest_Md5Init(SDLTest_Md5Context * mdContext); 90 | 91 | 92 | /** 93 | * \brief update digest from variable length data 94 | * 95 | * \param mdContext pointer to context variable 96 | * \param inBuf pointer to data array/string 97 | * \param inLen length of data array/string 98 | * 99 | * Note: The function updates the message-digest context to account 100 | * for the presence of each of the characters inBuf[0..inLen-1] 101 | * in the message whose digest is being computed. 102 | */ 103 | 104 | void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf, 105 | unsigned int inLen); 106 | 107 | 108 | /** 109 | * \brief complete digest computation 110 | * 111 | * \param mdContext pointer to context variable 112 | * 113 | * Note: The function terminates the message-digest computation and 114 | * ends with the desired message digest in mdContext.digest[0..15]. 115 | * Always call before using the digest[] variable. 116 | */ 117 | 118 | void SDLTest_Md5Final(SDLTest_Md5Context * mdContext); 119 | 120 | 121 | /* Ends C function definitions when using C++ */ 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | #include "close_code.h" 126 | 127 | #endif /* _SDL_test_md5_h */ 128 | 129 | /* vi: set ts=4 sw=4 expandtab: */ 130 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_test_random.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_random.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | A "32-bit Multiply with carry random number generator. Very fast. 33 | Includes a list of recommended multipliers. 34 | 35 | multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32. 36 | period: (a*2^31)-1 37 | 38 | */ 39 | 40 | #ifndef _SDL_test_random_h 41 | #define _SDL_test_random_h 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /* --- Definitions */ 50 | 51 | /* 52 | * Macros that return a random number in a specific format. 53 | */ 54 | #define SDLTest_RandomInt(c) ((int)SDLTest_Random(c)) 55 | 56 | /* 57 | * Context structure for the random number generator state. 58 | */ 59 | typedef struct { 60 | unsigned int a; 61 | unsigned int x; 62 | unsigned int c; 63 | unsigned int ah; 64 | unsigned int al; 65 | } SDLTest_RandomContext; 66 | 67 | 68 | /* --- Function prototypes */ 69 | 70 | /** 71 | * \brief Initialize random number generator with two integers. 72 | * 73 | * Note: The random sequence of numbers returned by ...Random() is the 74 | * same for the same two integers and has a period of 2^31. 75 | * 76 | * \param rndContext pointer to context structure 77 | * \param xi integer that defines the random sequence 78 | * \param ci integer that defines the random sequence 79 | * 80 | */ 81 | void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, 82 | unsigned int ci); 83 | 84 | /** 85 | * \brief Initialize random number generator based on current system time. 86 | * 87 | * \param rndContext pointer to context structure 88 | * 89 | */ 90 | void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext); 91 | 92 | 93 | /** 94 | * \brief Initialize random number generator based on current system time. 95 | * 96 | * Note: ...RandomInit() or ...RandomInitTime() must have been called 97 | * before using this function. 98 | * 99 | * \param rndContext pointer to context structure 100 | * 101 | * \returns A random number (32bit unsigned integer) 102 | * 103 | */ 104 | unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext); 105 | 106 | 107 | /* Ends C function definitions when using C++ */ 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | #include "close_code.h" 112 | 113 | #endif /* _SDL_test_random_h */ 114 | 115 | /* vi: set ts=4 sw=4 expandtab: */ 116 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_timer_h 23 | #define _SDL_timer_h 24 | 25 | /** 26 | * \file SDL_timer.h 27 | * 28 | * Header for the SDL time management routines. 29 | */ 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 | * \brief Get the number of milliseconds since the SDL library initialization. 42 | * 43 | * \note This value wraps if the program runs for more than ~49 days. 44 | */ 45 | extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); 46 | 47 | /** 48 | * \brief Compare SDL ticks values, and return true if A has passed B 49 | * 50 | * e.g. if you want to wait 100 ms, you could do this: 51 | * Uint32 timeout = SDL_GetTicks() + 100; 52 | * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { 53 | * ... do work until timeout has elapsed 54 | * } 55 | */ 56 | #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) 57 | 58 | /** 59 | * \brief Get the current value of the high resolution counter 60 | */ 61 | extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void); 62 | 63 | /** 64 | * \brief Get the count per second of the high resolution counter 65 | */ 66 | extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void); 67 | 68 | /** 69 | * \brief Wait a specified number of milliseconds before returning. 70 | */ 71 | extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); 72 | 73 | /** 74 | * Function prototype for the timer callback function. 75 | * 76 | * The callback function is passed the current timer interval and returns 77 | * the next timer interval. If the returned value is the same as the one 78 | * passed in, the periodic alarm continues, otherwise a new alarm is 79 | * scheduled. If the callback returns 0, the periodic alarm is cancelled. 80 | */ 81 | typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param); 82 | 83 | /** 84 | * Definition of the timer ID type. 85 | */ 86 | typedef int SDL_TimerID; 87 | 88 | /** 89 | * \brief Add a new timer to the pool of timers already running. 90 | * 91 | * \return A timer ID, or 0 when an error occurs. 92 | */ 93 | extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, 94 | SDL_TimerCallback callback, 95 | void *param); 96 | 97 | /** 98 | * \brief Remove a timer knowing its ID. 99 | * 100 | * \return A boolean value indicating success or failure. 101 | * 102 | * \warning It is not safe to remove a timer multiple times. 103 | */ 104 | extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); 105 | 106 | 107 | /* Ends C function definitions when using C++ */ 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | #include "close_code.h" 112 | 113 | #endif /* _SDL_timer_h */ 114 | 115 | /* vi: set ts=4 sw=4 expandtab: */ 116 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_touch.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_touch.h 24 | * 25 | * Include file for SDL touch event handling. 26 | */ 27 | 28 | #ifndef _SDL_touch_h 29 | #define _SDL_touch_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_video.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 | typedef Sint64 SDL_TouchID; 42 | typedef Sint64 SDL_FingerID; 43 | 44 | typedef struct SDL_Finger 45 | { 46 | SDL_FingerID id; 47 | float x; 48 | float y; 49 | float pressure; 50 | } SDL_Finger; 51 | 52 | /* Used as the device ID for mouse events simulated with touch input */ 53 | #define SDL_TOUCH_MOUSEID ((Uint32)-1) 54 | 55 | 56 | /* Function prototypes */ 57 | 58 | /** 59 | * \brief Get the number of registered touch devices. 60 | */ 61 | extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void); 62 | 63 | /** 64 | * \brief Get the touch ID with the given index, or 0 if the index is invalid. 65 | */ 66 | extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); 67 | 68 | /** 69 | * \brief Get the number of active fingers for a given touch device. 70 | */ 71 | extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID); 72 | 73 | /** 74 | * \brief Get the finger object of the given touch, with the given index. 75 | */ 76 | extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index); 77 | 78 | /* Ends C function definitions when using C++ */ 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | #include "close_code.h" 83 | 84 | #endif /* _SDL_touch_h */ 85 | 86 | /* vi: set ts=4 sw=4 expandtab: */ 87 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /Castenstein/SDL/SDL_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_version.h 24 | * 25 | * This header defines the current SDL version. 26 | */ 27 | 28 | #ifndef _SDL_version_h 29 | #define _SDL_version_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 | * \brief Information the version of SDL in use. 41 | * 42 | * Represents the library's version as three levels: major revision 43 | * (increments with massive changes, additions, and enhancements), 44 | * minor revision (increments with backwards-compatible changes to the 45 | * major revision), and patchlevel (increments with fixes to the minor 46 | * revision). 47 | * 48 | * \sa SDL_VERSION 49 | * \sa SDL_GetVersion 50 | */ 51 | typedef struct SDL_version 52 | { 53 | Uint8 major; /**< major version */ 54 | Uint8 minor; /**< minor version */ 55 | Uint8 patch; /**< update version */ 56 | } SDL_version; 57 | 58 | /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL 59 | */ 60 | #define SDL_MAJOR_VERSION 2 61 | #define SDL_MINOR_VERSION 0 62 | #define SDL_PATCHLEVEL 5 63 | 64 | /** 65 | * \brief Macro to determine SDL version program was compiled against. 66 | * 67 | * This macro fills in a SDL_version structure with the version of the 68 | * library you compiled against. This is determined by what header the 69 | * compiler uses. Note that if you dynamically linked the library, you might 70 | * have a slightly newer or older version at runtime. That version can be 71 | * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), 72 | * is not a macro. 73 | * 74 | * \param x A pointer to a SDL_version struct to initialize. 75 | * 76 | * \sa SDL_version 77 | * \sa SDL_GetVersion 78 | */ 79 | #define SDL_VERSION(x) \ 80 | { \ 81 | (x)->major = SDL_MAJOR_VERSION; \ 82 | (x)->minor = SDL_MINOR_VERSION; \ 83 | (x)->patch = SDL_PATCHLEVEL; \ 84 | } 85 | 86 | /** 87 | * This macro turns the version numbers into a numeric value: 88 | * \verbatim 89 | (1,2,3) -> (1203) 90 | \endverbatim 91 | * 92 | * This assumes that there will never be more than 100 patchlevels. 93 | */ 94 | #define SDL_VERSIONNUM(X, Y, Z) \ 95 | ((X)*1000 + (Y)*100 + (Z)) 96 | 97 | /** 98 | * This is the version number macro for the current SDL version. 99 | */ 100 | #define SDL_COMPILEDVERSION \ 101 | SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) 102 | 103 | /** 104 | * This macro will evaluate to true if compiled with SDL at least X.Y.Z. 105 | */ 106 | #define SDL_VERSION_ATLEAST(X, Y, Z) \ 107 | (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) 108 | 109 | /** 110 | * \brief Get the version of SDL that is linked against your program. 111 | * 112 | * If you are linking to SDL dynamically, then it is possible that the 113 | * current version will be different than the version you compiled against. 114 | * This function returns the current version, while SDL_VERSION() is a 115 | * macro that tells you what version you compiled with. 116 | * 117 | * \code 118 | * SDL_version compiled; 119 | * SDL_version linked; 120 | * 121 | * SDL_VERSION(&compiled); 122 | * SDL_GetVersion(&linked); 123 | * printf("We compiled against SDL version %d.%d.%d ...\n", 124 | * compiled.major, compiled.minor, compiled.patch); 125 | * printf("But we linked against SDL version %d.%d.%d.\n", 126 | * linked.major, linked.minor, linked.patch); 127 | * \endcode 128 | * 129 | * This function may be called safely at any time, even before SDL_Init(). 130 | * 131 | * \sa SDL_VERSION 132 | */ 133 | extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); 134 | 135 | /** 136 | * \brief Get the code revision of SDL that is linked against your program. 137 | * 138 | * Returns an arbitrary string (a hash value) uniquely identifying the 139 | * exact revision of the SDL library in use, and is only useful in comparing 140 | * against other revisions. It is NOT an incrementing number. 141 | */ 142 | extern DECLSPEC const char *SDLCALL SDL_GetRevision(void); 143 | 144 | /** 145 | * \brief Get the revision number of SDL that is linked against your program. 146 | * 147 | * Returns a number uniquely identifying the exact revision of the SDL 148 | * library in use. It is an incrementing number based on commits to 149 | * hg.libsdl.org. 150 | */ 151 | extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); 152 | 153 | 154 | /* Ends C function definitions when using C++ */ 155 | #ifdef __cplusplus 156 | } 157 | #endif 158 | #include "close_code.h" 159 | 160 | #endif /* _SDL_version_h */ 161 | 162 | /* vi: set ts=4 sw=4 expandtab: */ 163 | -------------------------------------------------------------------------------- /Castenstein/SDL/begin_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file begin_code.h 24 | * 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 | /* This shouldn't be nested -- included it around code only. */ 31 | #ifdef _begin_code_h 32 | #error Nested inclusion of begin_code.h 33 | #endif 34 | #define _begin_code_h 35 | 36 | #ifndef SDL_DEPRECATED 37 | # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ 38 | # define SDL_DEPRECATED __attribute__((deprecated)) 39 | # else 40 | # define SDL_DEPRECATED 41 | # endif 42 | #endif 43 | 44 | #ifndef SDL_UNUSED 45 | # ifdef __GNUC__ 46 | # define SDL_UNUSED __attribute__((unused)) 47 | # else 48 | # define SDL_UNUSED 49 | # endif 50 | #endif 51 | 52 | /* Some compilers use a special export keyword */ 53 | #ifndef DECLSPEC 54 | # if defined(__WIN32__) || defined(__WINRT__) 55 | # ifdef __BORLANDC__ 56 | # ifdef BUILD_SDL 57 | # define DECLSPEC 58 | # else 59 | # define DECLSPEC __declspec(dllimport) 60 | # endif 61 | # else 62 | # define DECLSPEC __declspec(dllexport) 63 | # endif 64 | # else 65 | # if defined(__GNUC__) && __GNUC__ >= 4 66 | # define DECLSPEC __attribute__ ((visibility("default"))) 67 | # else 68 | # define DECLSPEC 69 | # endif 70 | # endif 71 | #endif 72 | 73 | /* By default SDL uses the C calling convention */ 74 | #ifndef SDLCALL 75 | #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) 76 | #define SDLCALL __cdecl 77 | #else 78 | #define SDLCALL 79 | #endif 80 | #endif /* SDLCALL */ 81 | 82 | /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ 83 | #ifdef __SYMBIAN32__ 84 | #undef DECLSPEC 85 | #define DECLSPEC 86 | #endif /* __SYMBIAN32__ */ 87 | 88 | /* Force structure packing at 4 byte alignment. 89 | This is necessary if the header is included in code which has structure 90 | packing set to an alternate value, say for loading structures from disk. 91 | The packing is reset to the previous value in close_code.h 92 | */ 93 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 94 | #ifdef _MSC_VER 95 | #pragma warning(disable: 4103) 96 | #endif 97 | #ifdef __BORLANDC__ 98 | #pragma nopackwarning 99 | #endif 100 | #ifdef _M_X64 101 | /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ 102 | #pragma pack(push,8) 103 | #else 104 | #pragma pack(push,4) 105 | #endif 106 | #endif /* Compiler needs structure packing set */ 107 | 108 | #ifndef SDL_INLINE 109 | #if defined(__GNUC__) 110 | #define SDL_INLINE __inline__ 111 | #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ 112 | defined(__DMC__) || defined(__SC__) || \ 113 | defined(__WATCOMC__) || defined(__LCC__) || \ 114 | defined(__DECC) 115 | #define SDL_INLINE __inline 116 | #ifndef __inline__ 117 | #define __inline__ __inline 118 | #endif 119 | #else 120 | #define SDL_INLINE inline 121 | #ifndef __inline__ 122 | #define __inline__ inline 123 | #endif 124 | #endif 125 | #endif /* SDL_INLINE not defined */ 126 | 127 | #ifndef SDL_FORCE_INLINE 128 | #if defined(_MSC_VER) 129 | #define SDL_FORCE_INLINE __forceinline 130 | #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) 131 | #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ 132 | #else 133 | #define SDL_FORCE_INLINE static SDL_INLINE 134 | #endif 135 | #endif /* SDL_FORCE_INLINE not defined */ 136 | 137 | /* Apparently this is needed by several Windows compilers */ 138 | #if !defined(__MACH__) 139 | #ifndef NULL 140 | #ifdef __cplusplus 141 | #define NULL 0 142 | #else 143 | #define NULL ((void *)0) 144 | #endif 145 | #endif /* NULL */ 146 | #endif /* ! Mac OS X - breaks precompiled headers */ 147 | -------------------------------------------------------------------------------- /Castenstein/SDL/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #undef _begin_code_h 30 | 31 | /* Reset structure packing at previous byte alignment */ 32 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) 33 | #ifdef __BORLANDC__ 34 | #pragma nopackwarning 35 | #endif 36 | #pragma pack(pop) 37 | #endif /* Compiler needs structure packing set */ 38 | -------------------------------------------------------------------------------- /Castenstein/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/SDL2.dll -------------------------------------------------------------------------------- /Castenstein/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/SDL2.lib -------------------------------------------------------------------------------- /Castenstein/SDL2_image.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/SDL2_image.dll -------------------------------------------------------------------------------- /Castenstein/SDL2_image.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/SDL2_image.lib -------------------------------------------------------------------------------- /Castenstein/SDL2main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/SDL2main.lib -------------------------------------------------------------------------------- /Castenstein/SDLUtility.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/SDLUtility.h -------------------------------------------------------------------------------- /Castenstein/Sky.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | Sky::Sky() 4 | { 5 | } 6 | Sky::Sky(string path) 7 | { 8 | SDL_Surface *surface = Engine::LoadSDLSurface(path); 9 | if ((surface->w & (surface->w - 1)) || (surface->h & (surface->h - 1))) throw; 10 | Width = surface->w; 11 | Height = surface->h; 12 | WidthExponent = int(log2(Width)); 13 | Buffer = new int[Width * Height]; 14 | memcpy(Buffer, surface->pixels, Width * Height * 4); 15 | SDL_FreeSurface(surface); 16 | } 17 | Sky::~Sky() 18 | { 19 | delete[] Buffer; 20 | } 21 | 22 | Sky* Sky::CreateDummySky() 23 | { 24 | Sky *sky = new Sky(); 25 | sky->Width = 1; 26 | sky->Height = 1; 27 | sky->WidthExponent = 0; 28 | sky->Buffer = new int[0]; 29 | sky->Buffer[0] = 0xffffff; 30 | return sky; 31 | } -------------------------------------------------------------------------------- /Castenstein/Sky.h: -------------------------------------------------------------------------------- 1 | class Sky 2 | { 3 | private: 4 | int Width; 5 | int Height; 6 | int WidthExponent; 7 | int *Buffer; 8 | 9 | Sky(); 10 | public: 11 | Sky(string path); 12 | ~Sky(); 13 | 14 | static Sky* CreateDummySky(); 15 | 16 | friend class Engine; 17 | }; -------------------------------------------------------------------------------- /Castenstein/Sprite.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | Sprite::Sprite(float x, float y, Texture *texture) 4 | { 5 | X = x; 6 | Y = y; 7 | Rotation = 0; 8 | SpriteTexture = new AnimatedTexture(texture); 9 | } 10 | Sprite::Sprite(float x, float y, AnimatedTexture *texture, float rotation) 11 | { 12 | X = x; 13 | Y = y; 14 | Rotation = rotation; 15 | SpriteTexture = texture; 16 | } -------------------------------------------------------------------------------- /Castenstein/Sprite.h: -------------------------------------------------------------------------------- 1 | class Sprite 2 | { 3 | private: 4 | float Depth; 5 | 6 | bool Render; 7 | Texture *RenderTexture; 8 | int RenderStartX; 9 | int RenderEndX; 10 | int RenderStartY; 11 | int RenderEndY; 12 | int RenderShadowLevel; 13 | int RenderFogLevel; 14 | float RenderU; 15 | float RenderV; 16 | float RenderStepUV; 17 | public: 18 | float X, Y, Rotation; 19 | AnimatedTexture *SpriteTexture; 20 | 21 | Sprite(float x, float y, Texture *texture); 22 | Sprite(float x, float y, AnimatedTexture *texture, float rotation); 23 | 24 | friend class Engine; 25 | }; -------------------------------------------------------------------------------- /Castenstein/Texture.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | 3 | Texture::Texture() 4 | { 5 | } 6 | Texture::Texture(string path, Color fogColor, float ambientBrightness) 7 | { 8 | SDL_Surface *surface = Engine::LoadSDLSurface(path); 9 | if (surface->w != surface->h || (surface->w & (surface->w - 1))) throw; 10 | Size = surface->w; 11 | SizeExponent = int(log2(Size)); 12 | Buffer = new int**[2]; 13 | for (int i = 0; i < 2; i++) Buffer[i] = new int*[FogLevels]; 14 | 15 | LoadFromSDLSurface(surface, 0, 1, fogColor, ambientBrightness); 16 | SDL_FreeSurface(surface); 17 | } 18 | Texture::~Texture() 19 | { 20 | delete[] Buffer; 21 | } 22 | 23 | void Texture::LoadFromSDLSurface(SDL_Surface *surface, int frame, int frameCount, Color fogColor, float ambientBrightness) 24 | { 25 | int avgR = 0, avgG = 0, avgB = 0; 26 | 27 | for (int i = 0; i < FogLevels; i++) 28 | { 29 | for (int j = 0; j < 2; j++) Buffer[j][i] = new int[Size * Size]; 30 | for (int y = 0, *buffer2a = Buffer[0][i], *buffer2b = Buffer[1][i]; y < Size; y++) 31 | { 32 | for (int x = 0, *buffer = &((int*)surface->pixels)[y + frame * Size]; x < Size; x++) 33 | { 34 | if (i == FogLevels - 1) 35 | { 36 | avgR += (*buffer & 0xff0000) >> 16; 37 | avgG += (*buffer & 0xff00) >> 8; 38 | avgB += *buffer & 0xff; 39 | } 40 | 41 | if (*buffer == 0xff00ff) 42 | { 43 | *buffer2a++ = *buffer2b++ = 0xff00ff; 44 | } 45 | else 46 | { 47 | int r = (*buffer & 0xff0000) >> 16; 48 | int g = (*buffer & 0xff00) >> 8; 49 | int b = *buffer & 0xff; 50 | int fogR = fogColor.R * (FogLevels - 1 - i) >> FogDetail; 51 | int fogG = fogColor.G * (FogLevels - 1 - i) >> FogDetail; 52 | int fogB = fogColor.B * (FogLevels - 1 - i) >> FogDetail; 53 | 54 | int r1 = (r * i >> FogDetail) + fogR; 55 | int g1 = (g * i >> FogDetail) + fogG; 56 | int b1 = (b * i >> FogDetail) + fogB; 57 | *buffer2a++ = r1 << 16 | g1 << 8 | b1; 58 | int r2 = (int(r * ambientBrightness) * i >> FogDetail) + fogR; 59 | int g2 = (int(g * ambientBrightness) * i >> FogDetail) + fogG; 60 | int b2 = (int(b * ambientBrightness) * i >> FogDetail) + fogB; 61 | *buffer2b++ = r2 << 16 | g2 << 8 | b2; 62 | } 63 | 64 | buffer += Size * frameCount; 65 | } 66 | } 67 | } 68 | 69 | avgR /= Size * Size; 70 | avgG /= Size * Size; 71 | avgB /= Size * Size; 72 | AverageColor = Color(avgR, avgG, avgB); 73 | } -------------------------------------------------------------------------------- /Castenstein/Texture.h: -------------------------------------------------------------------------------- 1 | class Texture 2 | { 3 | private: 4 | int Size; 5 | int SizeExponent; 6 | int ***Buffer; 7 | Color AverageColor; 8 | 9 | Texture(); 10 | 11 | void LoadFromSDLSurface(SDL_Surface *surface, int frame, int frameCount, Color fogColor, float ambientBrightness); 12 | public: 13 | Texture(string path, Color fogColor, float ambientBrightness); 14 | ~Texture(); 15 | 16 | friend class Engine; 17 | friend class Graphics; 18 | friend class AnimatedTexture; 19 | }; -------------------------------------------------------------------------------- /Castenstein/libjpeg-9.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/libjpeg-9.dll -------------------------------------------------------------------------------- /Castenstein/libpng16-16.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/libpng16-16.dll -------------------------------------------------------------------------------- /Castenstein/libtiff-5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/libtiff-5.dll -------------------------------------------------------------------------------- /Castenstein/libwebp-4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/libwebp-4.dll -------------------------------------------------------------------------------- /Castenstein/main.cpp: -------------------------------------------------------------------------------- 1 | #include "Castenstein.h" 2 | #include 3 | 4 | string IntToString(int value) 5 | { 6 | ostringstream ss; 7 | ss << value; 8 | return ss.str(); 9 | } 10 | string FloatToString(float value, int digits) 11 | { 12 | ostringstream ss; 13 | ss << round(value * pow(10, digits)) / pow(10, digits); 14 | return ss.str(); 15 | } 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | const int screenWidth = 1280; 20 | const int screenHeight = 720; 21 | const int minimapSize = screenWidth / 10; 22 | Engine::Initialize(screenWidth, screenHeight); 23 | Engine::setIcon("Media\\Images\\Icon.png"); 24 | 25 | FPSCounter *fpsCounter = new FPSCounter(500); 26 | Font *font = new Font("Media\\Images\\Font.png"); 27 | Map *map = new Map("Media\\Maps\\Map.txt"); 28 | Player *player = new Player(map->getSpawnX(), map->getSpawnY(), map->getSpawnRotation()); 29 | 30 | Engine::setMap(map); 31 | Engine::setPlayer(player); 32 | Input::setMousePosition(Engine::getWidth() / 2, Engine::getHeight() / 2, false); 33 | 34 | while (!Input::getQuit() && !Input::getKeyDown(SDLK_ESCAPE)) 35 | { 36 | fpsCounter->Frame(); 37 | player->UpdateInput(.0002f * max(fpsCounter->getFrameTime(), 1), .05f, .94f, .94f, .25f); 38 | 39 | Engine::Render(); 40 | Graphics::FillRectangle(10, 10, 100, 36, Color(0, 0, 0), .5f); 41 | Graphics::FillRectangle(120, 10, 130, 88, Color(0, 0, 0), .5f); 42 | Graphics::DrawString(20, 20, "FPS: " + IntToString(fpsCounter->getFPS()), font); 43 | Graphics::DrawString(130, 20, "WASD: Move", font); 44 | Graphics::DrawString(130, 46, "LShift: Sprint", font); 45 | Graphics::DrawString(130, 72, "Mouse: Rotate", font); 46 | 47 | Graphics::FillRectangle(screenWidth - minimapSize / 2 - 60, 15 + minimapSize, 100, 26, Color(0, 0, 0), .5f); 48 | Graphics::DrawMinimap(screenWidth - minimapSize - 10, 10, minimapSize, .05f, .75f, .6f); 49 | Graphics::DrawString(screenWidth - minimapSize / 2 - 40, 20 + minimapSize, FloatToString(player->getX(), 1), font); 50 | Graphics::DrawString(screenWidth - minimapSize / 2 - 5, 20 + minimapSize, FloatToString(player->getY(), 1), font); 51 | 52 | Engine::Present(); 53 | Input::Update(); 54 | Input::setMousePosition(Engine::getWidth() / 2, Engine::getHeight() / 2, true); 55 | } 56 | 57 | Engine::Destroy(); 58 | return 0; 59 | } -------------------------------------------------------------------------------- /Castenstein/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/resource.h -------------------------------------------------------------------------------- /Castenstein/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytecode77/castenstein/3906a08a317f05fa7b6b1cfde1169ad74321c0fe/Castenstein/zlib1.dll -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, bytecode77 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, this 11 | list of conditions and the following disclaimer in the documentation and/or 12 | other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Castenstein 2 | 3 | ## Raycaster 4 | 5 | Castenstein is a raycaster. The name derives from Wolfenstein 3D, a game from the 90's. Raycasting is a commonly used rendering technique, in a time where computers weren't powerful enough to handle polygonal software rendering. Instead of rendering triangles, a raycaster renders a grid of blocks on a 2D basis, displayed in 3D. That's why raycasters are often referred to as "2.5D engines" - they look 3D, but they're very much two dimensional in terms of math. 6 | 7 | [![](/.github/screenshots/001.thumb.jpg)](/.github/screenshots/001.jpg) 8 | [![](/.github/screenshots/002.thumb.jpg)](/.github/screenshots/002.jpg) 9 | [![](/.github/screenshots/003.thumb.jpg)](/.github/screenshots/003.jpg) 10 | [![](/.github/screenshots/004.thumb.jpg)](/.github/screenshots/004.jpg) 11 | [![](/.github/screenshots/005.thumb.jpg)](/.github/screenshots/005.jpg) 12 | [![](/.github/screenshots/006.thumb.jpg)](/.github/screenshots/006.jpg) 13 | 14 | Raycasters are considerably faster than polygonal software rasterizers due to the computational simplicity. In exchange, raycasting has limitations. For example, tilting up and down is not possible. It's actually implemented by vertical shifting of the screen, which results in a skewed image. 15 | 16 | It's possible, however, to do some moving up/down and tilting as well as rendering sprites in addition to walls. For different brightness and fog levels, pre-calculated texture images are used, resulting in negligible performance impact. Castenstein also supports multi-threaded rendering, because raycasting is a task that can be very easily parallelized. 17 | 18 | Raycasting in this form doesn't have any particular use nowadays. It has gone obsolete with polygonal renderers becoming the default. This is a tech-demo. 19 | 20 | ## Features 21 | 22 | - Textured walls, floors and ceilings 23 | - Sprites 24 | - Sky 25 | - Lighting & Fog 26 | - Drop-down shadows from ceilings 27 | - Collision detection 28 | - Moving up/down & tilting up/down 29 | - Minimap overlay 30 | - Multi-threaded rendering 31 | 32 | ## Downloads 33 | 34 | [![](http://bytecode77.com/public/fileicons/zip.png) Castenstein 1.0.3.zip](/.github/downloads/Castenstein%201.0.3.zip) --------------------------------------------------------------------------------