├── make ├── del.bat ├── sample.bmp ├── Adv_engine_0_0_0.bmp ├── tcc3.bat ├── VC6_Build_EXE.bat ├── OpenWatcomWin16.bat ├── VC6_Build_Arcanum.bat ├── VC6_Build_DLL.bat ├── msvc.bat └── BuildExamples.bat ├── sample.bmp ├── sample24.bmp ├── sample8.bmp ├── Adv_engine.bmp ├── screenshots ├── Rects.jpg ├── Textures.jpg ├── Triangle.jpg ├── Tetrahedron.jpg ├── Textures1.jpg ├── SDL_Renderer.jpg └── examples_renderer_textures.jpg ├── license.txt ├── .vscode └── settings.json ├── src └── SDL3 │ ├── Dos16 │ ├── Timer.cpp │ ├── Accel.cpp │ ├── Accel.hpp │ ├── Library.cpp │ ├── Library.hpp │ ├── SoftWin.hpp │ ├── MainWin.hpp │ ├── GLWin.hpp │ └── MainWin.cpp │ ├── GLCntxt.hpp │ ├── Errors.hpp │ ├── Unix │ ├── Accel.cpp │ ├── Accel.hpp │ ├── Timer.cpp │ ├── Library.hpp │ ├── Library.cpp │ ├── SoftWin.hpp │ └── GLWin.hpp │ ├── Pixels.hpp │ ├── Events.hpp │ ├── Bmp.hpp │ ├── Accel.hpp │ ├── GLWin.hpp │ ├── Palette.hpp │ ├── Library.hpp │ ├── MainWin.hpp │ ├── SoftWin.hpp │ ├── Color.hpp │ ├── Win32 │ ├── Timer.cpp │ ├── WinError.hpp │ ├── Accel.cpp │ ├── Accel.hpp │ ├── Library.hpp │ ├── WinError.cpp │ ├── Library.cpp │ ├── SoftWin.hpp │ ├── Win32.hpp │ └── GLWin.hpp │ ├── New.hpp │ ├── StdStr.cpp │ ├── Color.cpp │ ├── Errors.cpp │ ├── Log.cpp │ ├── Palette.cpp │ ├── Texture.hpp │ ├── New.cpp │ ├── PixCopy.hpp │ ├── Result.hpp │ ├── SObject.hpp │ ├── PixPaint.hpp │ ├── Rect2f.hpp │ ├── Events.cpp │ ├── EventH.hpp │ ├── AppMeta.hpp │ ├── Vec2i.hpp │ ├── Init.cpp │ ├── BaseWin.hpp │ ├── BmpLoad.hpp │ ├── AppMeta.cpp │ ├── Result.cpp │ ├── StdMath.cpp │ ├── EventH.cpp │ ├── MemMngr.hpp │ ├── OpenGL │ └── GLUtils.hpp │ ├── BaseWin.cpp │ ├── SurfRndr.hpp │ ├── Vec2i.cpp │ ├── SoftRndr.hpp │ ├── Renders │ └── OpenGL1 │ │ ├── GL1Tex.hpp │ │ └── GL1Rndr.hpp │ ├── SoftTex.cpp │ ├── Surface.hpp │ ├── SoftTex.hpp │ ├── Renderer.hpp │ ├── SObject.cpp │ ├── SurfRndr.cpp │ ├── App.hpp │ ├── Window.hpp │ ├── Rect2f.cpp │ ├── Bmp.cpp │ ├── GLAttr.hpp │ ├── MemMngr.cpp │ └── App.cpp ├── Arcanum └── Arcanum │ ├── main.cpp │ ├── FpsCounter.hpp │ ├── Convert.hpp │ ├── SpriteManager.hpp │ ├── Engine.hpp │ ├── FpsCounter.cpp │ └── SpriteManager.cpp ├── include └── SDL3 │ ├── FileSys.h │ ├── Error.h │ ├── Timer.h │ ├── StdInc.h │ ├── Log.h │ ├── StdStr.h │ ├── SDL.h │ ├── Loadso.h │ ├── StdMath.h │ ├── Rect.h │ ├── Mouse.h │ ├── StdMem.h │ └── SDL_main.h ├── CMakeSettings.json └── Window.c /make/del.bat: -------------------------------------------------------------------------------- 1 | 2 | del *.obj *.dll *.lib *.exe *.exp *.err 3 | -------------------------------------------------------------------------------- /sample.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/sample.bmp -------------------------------------------------------------------------------- /sample24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/sample24.bmp -------------------------------------------------------------------------------- /sample8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/sample8.bmp -------------------------------------------------------------------------------- /Adv_engine.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/Adv_engine.bmp -------------------------------------------------------------------------------- /make/sample.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/make/sample.bmp -------------------------------------------------------------------------------- /screenshots/Rects.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/screenshots/Rects.jpg -------------------------------------------------------------------------------- /screenshots/Textures.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/screenshots/Textures.jpg -------------------------------------------------------------------------------- /screenshots/Triangle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/screenshots/Triangle.jpg -------------------------------------------------------------------------------- /make/Adv_engine_0_0_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/make/Adv_engine_0_0_0.bmp -------------------------------------------------------------------------------- /screenshots/Tetrahedron.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/screenshots/Tetrahedron.jpg -------------------------------------------------------------------------------- /screenshots/Textures1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/screenshots/Textures1.jpg -------------------------------------------------------------------------------- /screenshots/SDL_Renderer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/screenshots/SDL_Renderer.jpg -------------------------------------------------------------------------------- /screenshots/examples_renderer_textures.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JordanCpp/SDL3Lite/HEAD/screenshots/examples_renderer_textures.jpg -------------------------------------------------------------------------------- /make/tcc3.bat: -------------------------------------------------------------------------------- 1 | 2 | set PATH=TC\BIN\ 3 | 4 | tcc -emain -ml -P -O2 -IC:\SDL3\include\ -IC:\SDL3\src\ C:\SDL3\src\SDL3\*.cpp C:\SDL3\src\SDL3\DOS16\*.cpp C:\SDL3\main.c 5 | -------------------------------------------------------------------------------- /make/VC6_Build_EXE.bat: -------------------------------------------------------------------------------- 1 | 2 | call "C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT" 3 | 4 | cl /O2 -FeVC6_%1.exe -GX /I..\include /I..\dependencies %2%1 /link SDL3.lib opengl32.lib 5 | 6 | del %1.obj 7 | -------------------------------------------------------------------------------- /make/OpenWatcomWin16.bat: -------------------------------------------------------------------------------- 1 | 2 | del *.err *.obj 3 | 4 | wcl -xs -D_WIN16 -Ic:\WATCOM\h\ -Ic:\WATCOM\h\win\ -I..\LDL\include ..\LDL_Pal.cpp ..\LDL\source\*.cpp ..\LDL\source\Renders\*.cpp ..\LDL\source\Win16\*.cpp /link windows.lib 5 | 6 | pause 7 | -------------------------------------------------------------------------------- /make/VC6_Build_Arcanum.bat: -------------------------------------------------------------------------------- 1 | 2 | call "C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT" 3 | 4 | cl /O2 -FeVC6_Arcanum.exe -GX /I..\include /I..\Arcanum ..\Arcanum\Arcanum\*.cpp /link SDL3.lib opengl32.lib 5 | 6 | del *.obj 7 | 8 | pause 9 | -------------------------------------------------------------------------------- /make/VC6_Build_DLL.bat: -------------------------------------------------------------------------------- 1 | 2 | call "C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT" 3 | 4 | CL /O2 -GX /FeSDL3.dll -LD -DSDL3LITE_SHARED ^ 5 | /I..\dependencies ^ 6 | /I..\include\ ^ 7 | /I..\src\ ^ 8 | ..\src\SDL3\OpenGL\*.cpp ^ 9 | ..\src\SDL3\Win32\*.cpp ^ 10 | ..\src\SDL3\Renders\OpenGL1\*.cpp ^ 11 | ..\src\SDL3\*.cpp ^ 12 | gdi32.lib ^ 13 | opengl32.lib ^ 14 | winmm.lib ^ 15 | user32.lib 16 | 17 | del *.obj 18 | 19 | pause 20 | -------------------------------------------------------------------------------- /make/msvc.bat: -------------------------------------------------------------------------------- 1 | 2 | call "E:\Programs\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" 3 | 4 | CL /O2 -EHsc /FeSDL3.dll -LD ^ 5 | /I..\dependencies ^ 6 | /I..\include\ ^ 7 | /I..\source\include\ ^ 8 | ..\source\OpenGL\*.cpp ^ 9 | ..\source\Platforms\Win32\*.cpp ^ 10 | ..\source\Renders\OpenGL1\*.cpp ^ 11 | ..\source\Renders\Software\*.cpp ^ 12 | ..\source\SDL3\*.cpp ^ 13 | ..\source\Shared\*.cpp ^ 14 | gdi32.lib ^ 15 | opengl32.lib ^ 16 | winmm.lib ^ 17 | user32.lib 18 | 19 | pause 20 | -------------------------------------------------------------------------------- /make/BuildExamples.bat: -------------------------------------------------------------------------------- 1 | 2 | call VC6_Build_EXE App.c ..\ 3 | call VC6_Build_EXE clear.c ..\ 4 | call VC6_Build_EXE lines.c ..\ 5 | call VC6_Build_EXE primitives.c ..\ 6 | call VC6_Build_EXE rectangles.c ..\ 7 | call VC6_Build_EXE textures2.c ..\ 8 | call VC6_Build_EXE GL1_Tetrahedron.c ..\ 9 | call VC6_Build_EXE GL1_Triangle.c ..\ 10 | call VC6_Build_EXE GL3_Triangle.cpp ..\ 11 | call VC6_Build_EXE OpenGL1.c ..\ 12 | call VC6_Build_EXE Rects.c ..\ 13 | call VC6_Build_EXE Renderer.c ..\ 14 | call VC6_Build_EXE Textures.c ..\ 15 | call VC6_Build_EXE Window.c ..\ 16 | call VC6_Build_EXE Multiple.c ..\ 17 | call VC6_Build_EXE Software.c ..\ 18 | 19 | pause 20 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "cstdlib": "cpp", 4 | "algorithm": "cpp", 5 | "array": "cpp", 6 | "atomic": "cpp", 7 | "bit": "cpp", 8 | "*.tcc": "cpp", 9 | "cctype": "cpp", 10 | "cerrno": "cpp", 11 | "climits": "cpp", 12 | "clocale": "cpp", 13 | "cmath": "cpp", 14 | "compare": "cpp", 15 | "concepts": "cpp", 16 | "cstdarg": "cpp", 17 | "cstddef": "cpp", 18 | "cstdint": "cpp", 19 | "cstdio": "cpp", 20 | "cwchar": "cpp", 21 | "cwctype": "cpp", 22 | "deque": "cpp", 23 | "string": "cpp", 24 | "unordered_map": "cpp", 25 | "vector": "cpp", 26 | "exception": "cpp", 27 | "functional": "cpp", 28 | "iterator": "cpp", 29 | "memory": "cpp", 30 | "memory_resource": "cpp", 31 | "numeric": "cpp", 32 | "optional": "cpp", 33 | "random": "cpp", 34 | "string_view": "cpp", 35 | "system_error": "cpp", 36 | "tuple": "cpp", 37 | "type_traits": "cpp", 38 | "utility": "cpp", 39 | "initializer_list": "cpp", 40 | "ios": "cpp", 41 | "iosfwd": "cpp", 42 | "limits": "cpp", 43 | "new": "cpp", 44 | "numbers": "cpp", 45 | "ostream": "cpp", 46 | "queue": "cpp", 47 | "stdexcept": "cpp", 48 | "streambuf": "cpp", 49 | "cstdbool": "cpp", 50 | "typeinfo": "cpp" 51 | } 52 | } -------------------------------------------------------------------------------- /src/SDL3/Dos16/Timer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | Uint64 SDL_GetTicks(void) 30 | { 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /src/SDL3/GLCntxt.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_GLCntxt_hpp 28 | #define SDL3Lite_GLCntxt_hpp 29 | 30 | #include 31 | 32 | struct SDL_GLContext 33 | { 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Arcanum/Arcanum/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | using namespace Arcanum; 30 | 31 | int main() 32 | { 33 | Engine engine; 34 | engine.Run(); 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /src/SDL3/Errors.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Errors_hpp 28 | #define SDL3Lite_Errors_hpp 29 | 30 | #include 31 | 32 | const char* SDL_GetErrorImplementation(Application& application); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/SDL3/Unix/Accel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | SupportedAccelerator::SupportedAccelerator() 30 | { 31 | } 32 | 33 | bool SupportedAccelerator::IsOpenGL1_2() 34 | { 35 | return true; 36 | } 37 | -------------------------------------------------------------------------------- /src/SDL3/Pixels.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Pixels_hpp 28 | #define SDL3Lite_Pixels_hpp 29 | 30 | #include 31 | 32 | int PixelFormatToBytesPerPixels(const SDL_PixelFormat pixelFormat); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/SDL3/Events.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Events_hpp 28 | #define SDL3Lite_Events_hpp 29 | 30 | #include 31 | 32 | int SDL_PollEventInmplementation(Application& application, SDL_Event* dest); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/SDL3/Bmp.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Bmp_hpp 28 | #define SDL3Lite_Bmp_hpp 29 | 30 | #include 31 | #include 32 | 33 | SDL_Surface* SDL_LoadBMPImplementation(Result& result, const char* file); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/SDL3/Dos16/Accel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | SupportedAccelerator::SupportedAccelerator() : 30 | _openGL32(_result) 31 | { 32 | } 33 | 34 | bool SupportedAccelerator::IsOpenGL1_2() 35 | { 36 | return false; 37 | } 38 | -------------------------------------------------------------------------------- /src/SDL3/Accel.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Accel_hpp 28 | #define SDL3Lite_Accel_hpp 29 | 30 | #if defined(_WIN32) 31 | #include 32 | #elif defined (__unix__) 33 | #include 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/SDL3/GLWin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_GLWin_hpp 28 | #define SDL3Lite_GLWin_hpp 29 | 30 | #if defined(_WIN32) 31 | #include 32 | #elif defined (__unix__) 33 | #include 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/SDL3/Palette.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Palette_hpp 28 | #define SDL3Lite_Palette_hpp 29 | 30 | #include 31 | 32 | class Palette : public SDL_Palette 33 | { 34 | public: 35 | Palette(int ncolors); 36 | ~Palette(); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/SDL3/Unix/Accel.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Unix_Accel_hpp 28 | #define SDL3Lite_Unix_Accel_hpp 29 | 30 | class SupportedAccelerator 31 | { 32 | public: 33 | SupportedAccelerator(); 34 | bool IsOpenGL1_2(); 35 | private: 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /include/SDL3/FileSys.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_FileSys_h 28 | #define SDL3Lite_FileSys_h 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/SDL3/Library.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Library_hpp 28 | #define SDL3Lite_Library_hpp 29 | 30 | #if defined(_WIN32) 31 | #include 32 | #elif defined (__unix__) 33 | #include 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/SDL3/MainWin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_MainWin_hpp 28 | #define SDL3Lite_MainWin_hpp 29 | 30 | #if defined(_WIN32) 31 | #include 32 | #elif defined (__unix__) 33 | #include 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/SDL3/SoftWin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_SoftWin_hpp 28 | #define SDL3Lite_SoftWin_hpp 29 | 30 | #if defined(_WIN32) 31 | #include 32 | #elif defined (__unix__) 33 | #include 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/SDL3/Color.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Color_hpp 28 | #define SDL3Lite_Color_hpp 29 | 30 | #include 31 | 32 | class Color : public SDL_Color 33 | { 34 | public: 35 | Color(); 36 | Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a = 255); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/SDL3/Win32/Timer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | 30 | Uint64 SDL_GetTicks(void) 31 | { 32 | 33 | #if defined(_WIN64) 34 | return GetTickCount64(); 35 | #elif defined(_WIN32) 36 | return GetTickCount(); 37 | #endif 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/SDL3/Unix/Timer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | Uint64 SDL_GetTicks(void) 32 | { 33 | struct timeval tv; 34 | 35 | gettimeofday(&tv, NULL); 36 | 37 | return (tv.tv_sec * 1000) + (tv.tv_usec / 1000); 38 | } 39 | -------------------------------------------------------------------------------- /src/SDL3/New.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_New_hpp 28 | #define SDL3Lite_New_hpp 29 | 30 | #include 31 | 32 | void* operator new(size_t size); 33 | void operator delete(void* ptr); 34 | 35 | void* operator new[](size_t size); 36 | void operator delete[](void* ptr); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/SDL3/StdStr.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | size_t SDL_strlen(const char* source) 32 | { 33 | return strlen(source); 34 | } 35 | 36 | int SDL_strcmp(const char* str1, const char* str2) 37 | { 38 | return strcmp(str1, str2); 39 | } 40 | -------------------------------------------------------------------------------- /src/SDL3/Win32/WinError.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Win32_WinError_hpp 28 | #define SDL3Lite_Win32_WinError_hpp 29 | 30 | #include 31 | 32 | class WindowError 33 | { 34 | public: 35 | const String& GetErrorMessage(); 36 | private: 37 | String _message; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /include/SDL3/Error.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Error_h 28 | #define SDL3Lite_Error_h 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | extern SDL_DECLSPEC const char* SDLCALL SDL_GetError(); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /include/SDL3/Timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Timer_h 28 | #define SDL3Lite_Timer_h 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetTicks(void); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "x64-Debug", 5 | "generator": "Ninja", 6 | "configurationType": "Debug", 7 | "inheritEnvironments": [ "msvc_x64_x64" ], 8 | "buildRoot": "${projectDir}\\out\\build\\${name}", 9 | "installRoot": "${projectDir}\\out\\install\\${name}", 10 | "cmakeCommandArgs": "", 11 | "buildCommandArgs": "", 12 | "ctestCommandArgs": "" 13 | }, 14 | { 15 | "name": "x86-Debug", 16 | "generator": "Ninja", 17 | "configurationType": "Debug", 18 | "buildRoot": "${projectDir}\\out\\build\\${name}", 19 | "installRoot": "${projectDir}\\out\\install\\${name}", 20 | "cmakeCommandArgs": "", 21 | "buildCommandArgs": "", 22 | "ctestCommandArgs": "", 23 | "inheritEnvironments": [ "msvc_x86" ] 24 | }, 25 | { 26 | "name": "x64-Release", 27 | "generator": "Ninja", 28 | "configurationType": "RelWithDebInfo", 29 | "buildRoot": "${projectDir}\\out\\build\\${name}", 30 | "installRoot": "${projectDir}\\out\\install\\${name}", 31 | "cmakeCommandArgs": "", 32 | "buildCommandArgs": "", 33 | "ctestCommandArgs": "", 34 | "inheritEnvironments": [ "msvc_x64_x64" ], 35 | "variables": [] 36 | }, 37 | { 38 | "name": "x86-Release", 39 | "generator": "Ninja", 40 | "configurationType": "RelWithDebInfo", 41 | "buildRoot": "${projectDir}\\out\\build\\${name}", 42 | "installRoot": "${projectDir}\\out\\install\\${name}", 43 | "cmakeCommandArgs": "", 44 | "buildCommandArgs": "", 45 | "ctestCommandArgs": "", 46 | "inheritEnvironments": [ "msvc_x86" ], 47 | "variables": [] 48 | } 49 | ] 50 | } -------------------------------------------------------------------------------- /src/SDL3/Color.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | Color::Color() 30 | { 31 | r = 0; 32 | g = 0; 33 | b = 0; 34 | a = 255; 35 | } 36 | 37 | Color::Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a) 38 | { 39 | this->r = r; 40 | this->g = g; 41 | this->b = b; 42 | this->a = a; 43 | } 44 | -------------------------------------------------------------------------------- /src/SDL3/Win32/Accel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | SupportedAccelerator::SupportedAccelerator() : 30 | _openGL32(_result) 31 | { 32 | } 33 | 34 | bool SupportedAccelerator::IsOpenGL1_2() 35 | { 36 | if (_openGL32.Open("opengl32.dll")) 37 | { 38 | return true; 39 | } 40 | 41 | return false; 42 | } 43 | -------------------------------------------------------------------------------- /src/SDL3/Errors.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | 30 | const char* SDL_GetErrorImplementation(Application& application) 31 | { 32 | return application.GetResult().Message().c_str(); 33 | } 34 | 35 | const char* SDL_GetError() 36 | { 37 | return SDL_GetErrorImplementation(GetApplication()); 38 | } 39 | -------------------------------------------------------------------------------- /src/SDL3/Win32/Accel.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Win32_Accel_hpp 28 | #define SDL3Lite_Win32_Accel_hpp 29 | 30 | #include 31 | 32 | class SupportedAccelerator 33 | { 34 | public: 35 | SupportedAccelerator(); 36 | bool IsOpenGL1_2(); 37 | private: 38 | Result _result; 39 | Library _openGL32; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/SDL3/Dos16/Accel.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Dos16_Accel_hpp 28 | #define SDL3Lite_Dos16_Accel_hpp 29 | 30 | #include 31 | 32 | class SupportedAccelerator 33 | { 34 | public: 35 | SupportedAccelerator(); 36 | bool IsOpenGL1_2(); 37 | private: 38 | Result _result; 39 | Library _openGL32; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/SDL3/Log.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | void SDL_Log(const char* fmt, ...) 32 | { 33 | va_list args; 34 | va_start(args, fmt); 35 | 36 | vprintf(fmt, args); 37 | 38 | va_end(args); 39 | } 40 | 41 | void SDL_LogError(int category, const char* fmt, ...) 42 | { 43 | SDL_Log(fmt); 44 | } 45 | -------------------------------------------------------------------------------- /src/SDL3/Palette.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | Palette::Palette(int ncolors) 32 | { 33 | this->ncolors = ncolors; 34 | colors = new Color[ncolors]; 35 | version = 0; 36 | refcount = 0; 37 | } 38 | 39 | Palette::~Palette() 40 | { 41 | delete colors; 42 | } 43 | -------------------------------------------------------------------------------- /include/SDL3/StdInc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_StdInc_h 28 | #define SDL3Lite_StdInc_h 29 | 30 | #include 31 | #include 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | typedef Uint32 SDL_DisplayID; 38 | 39 | #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /include/SDL3/Log.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Log_h 28 | #define SDL3Lite_Log_h 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | extern SDL_DECLSPEC void SDLCALL SDL_Log(const char* fmt, ...); 37 | extern SDL_DECLSPEC void SDLCALL SDL_LogError(int category, const char* fmt, ...); 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/SDL3/Texture.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Texture_hpp 28 | #define SDL3Lite_Texture_hpp 29 | 30 | #include 31 | #include 32 | 33 | struct SDL_Texture 34 | { 35 | public: 36 | virtual ~SDL_Texture() {}; 37 | virtual const Vec2i& GetSize() = 0; 38 | virtual bool Update(const Vec2i& pos, const Vec2i& size, Uint8* pixels, int bpp) = 0; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/SDL3/StdStr.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_StdStr_h 28 | #define SDL3Lite_StdStr_h 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | extern SDL_DECLSPEC size_t SDLCALL SDL_strlen(const char* source); 37 | extern SDL_DECLSPEC int SDLCALL SDL_strcmp(const char* str1, const char* str2); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /include/SDL3/SDL.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_SDL_h 28 | #define SDL3Lite_SDL_h 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/SDL3/New.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | 30 | void* operator new(size_t size) 31 | { 32 | return SDL_malloc(size); 33 | } 34 | 35 | void operator delete(void* ptr) 36 | { 37 | SDL_free(ptr); 38 | } 39 | 40 | void* operator new[](size_t size) 41 | { 42 | return SDL_malloc(size); 43 | } 44 | 45 | void operator delete[](void* ptr) 46 | { 47 | SDL_free(ptr); 48 | } 49 | -------------------------------------------------------------------------------- /src/SDL3/PixCopy.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_PixCopy_hpp 28 | #define SDL3Lite_PixCopy_hpp 29 | 30 | #include 31 | 32 | class PixelCopier 33 | { 34 | public: 35 | void Copy(Uint8* dstPixels, int dstBpp, const Vec2i& dstArea, const Vec2i& dstPos, const Vec2i& dstSize, Uint8* srcPixels, int srcBpp, const Vec2i& srcArea, const Vec2i& srcPos, const Vec2i& srcSize); 36 | private: 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/SDL3/Dos16/Library.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | Library::Library(Result& result) : 30 | _result(result) 31 | { 32 | } 33 | 34 | Library::~Library() 35 | { 36 | Close(); 37 | } 38 | 39 | bool Library::Open(const String& path) 40 | { 41 | return NULL; 42 | } 43 | 44 | void Library::Close() 45 | { 46 | } 47 | 48 | SDL_FunctionPointer Library::Load(const String& name) 49 | { 50 | return NULL; 51 | } 52 | -------------------------------------------------------------------------------- /src/SDL3/Result.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Result_hpp 28 | #define SDL3Lite_Result_hpp 29 | 30 | #include 31 | 32 | class Result 33 | { 34 | public: 35 | Result(); 36 | bool Ok(); 37 | const String& Message(); 38 | void Message(const String& message); 39 | void Message(const String& message, const String& detail); 40 | void Clear(); 41 | private: 42 | bool _ok; 43 | String _message; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Arcanum/Arcanum/FpsCounter.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef Arcanum_FpsCounter_hpp 28 | #define Arcanum_FpsCounter_hpp 29 | 30 | #include 31 | 32 | namespace Arcanum 33 | { 34 | class FpsCounter 35 | { 36 | public: 37 | FpsCounter(); 38 | void Start(); 39 | bool Calc(); 40 | Uint64 Fps(); 41 | void Clear(); 42 | private: 43 | Uint64 _current; 44 | Uint64 _delta; 45 | Uint64 _old; 46 | Uint64 _fps; 47 | }; 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/SDL3/Dos16/Library.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Dos16_Library_hpp 28 | #define SDL3Lite_Dos16_Library_hpp 29 | 30 | #include 31 | #include 32 | 33 | class Library : public SDL_SharedObject 34 | { 35 | public: 36 | Library(Result& result); 37 | ~Library(); 38 | bool Open(const String& path); 39 | void Close(); 40 | SDL_FunctionPointer Load(const String& name); 41 | private: 42 | Result& _result; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/SDL3/SObject.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_SObject_hpp 28 | #define SDL3Lite_SObject_hpp 29 | 30 | #include 31 | 32 | struct SDL_SharedObject 33 | { 34 | public: 35 | virtual ~SDL_SharedObject() {}; 36 | virtual bool Open(const String& path) = 0; 37 | virtual void Close() = 0; 38 | virtual SDL_FunctionPointer Load(const String& path) = 0; 39 | }; 40 | 41 | SDL_SharedObject* SDL_LoadObjectImplementation(Result& result, const char* sofile); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/SDL3/PixPaint.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_PixPaint_hpp 28 | #define SDL3Lite_PixPaint_hpp 29 | 30 | #include 31 | #include 32 | 33 | class PixelPainter 34 | { 35 | public: 36 | void Clear(Surface* dest, const Color& color); 37 | void FillRect(Surface* dest, const Vec2f& pos, const Vec2f& size, const Color& color); 38 | void Line(Surface* dest, const Vec2f& first, const Vec2f& last, const Color& color); 39 | private: 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/SDL3/Rect2f.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Rect2f_hpp 28 | #define SDL3Lite_Rect2f_hpp 29 | 30 | #include 31 | 32 | class Rect2f : public SDL_FRect 33 | { 34 | public: 35 | Rect2f(); 36 | Rect2f(float x, float y, float w, float h); 37 | Rect2f(const SDL_FRect& rect); 38 | const Rect2f& operator=(Rect2f& v); 39 | const Rect2f& operator=(const Rect2f& v); 40 | const Rect2f& operator=(SDL_FRect* v); 41 | const Rect2f& operator=(const SDL_FRect* v); 42 | }; 43 | 44 | #endif -------------------------------------------------------------------------------- /Arcanum/Arcanum/Convert.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef Arcanum_Convert_hpp 28 | #define Arcanum_Convert_hpp 29 | 30 | #include 31 | 32 | namespace Arcanum 33 | { 34 | class Convert 35 | { 36 | public: 37 | Convert(); 38 | const char* ToChars(int num, Uint8 base = 10); 39 | private: 40 | enum 41 | { 42 | Max = 32 43 | }; 44 | void Swap(char& t1, char& t2); 45 | void Reverse(char* str, size_t length); 46 | int _result; 47 | char _buffer[32]; 48 | }; 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /Arcanum/Arcanum/SpriteManager.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef Arcanum_SpriteManager_hpp 28 | #define Arcanum_SpriteManager_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | namespace Arcanum 35 | { 36 | class SpriteManager 37 | { 38 | public: 39 | SpriteManager(SDL_Renderer* renderer); 40 | SDL_Texture* GetImage(const std::string& path); 41 | private: 42 | SDL_Renderer* _renderer; 43 | std::map _textures; 44 | }; 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/SDL3/Events.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | 30 | int SDL_PollEventImplementation(Application& application, SDL_Event* dest) 31 | { 32 | SDL_Event event; 33 | 34 | if (application.PollEvent(event)) 35 | { 36 | SDL_memcpy(dest, &event, sizeof(SDL_Event)); 37 | 38 | return 1; 39 | } 40 | 41 | application.PollEvents(); 42 | 43 | return 0; 44 | } 45 | 46 | int SDL_PollEvent(SDL_Event* dest) 47 | { 48 | return SDL_PollEventImplementation(GetApplication(), dest); 49 | } 50 | -------------------------------------------------------------------------------- /src/SDL3/EventH.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_EventH_hpp 28 | #define SDL3Lite_EventH_hpp 29 | 30 | #include 31 | #include 32 | 33 | class EventHandler 34 | { 35 | public: 36 | enum 37 | { 38 | Max = 256 39 | }; 40 | 41 | EventHandler(); 42 | void Push(SDL_Event& event); 43 | bool Pop(SDL_Event& event); 44 | bool Running(); 45 | void Stop(); 46 | bool Empty(); 47 | private: 48 | bool _running; 49 | RingBuffer _queue; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/SDL3/Unix/Library.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Unix_Library_hpp 28 | #define SDL3Lite_Unix_Library_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | class Library : public SDL_SharedObject 35 | { 36 | public: 37 | Library(Result& result); 38 | ~Library(); 39 | bool Open(const String& path); 40 | void Close(); 41 | SDL_FunctionPointer Load(const String& name); 42 | private: 43 | Result& _result; 44 | void* _library; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/SDL3/Win32/Library.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Win32_Library_hpp 28 | #define SDL3Lite_Win32_Library_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | class Library : public SDL_SharedObject 35 | { 36 | public: 37 | Library(Result& result); 38 | ~Library(); 39 | bool Open(const String& path); 40 | void Close(); 41 | SDL_FunctionPointer Load(const String& name); 42 | private: 43 | Result& _result; 44 | HMODULE _module; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/SDL3/AppMeta.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_AppMeta_hpp 28 | #define SDL3Lite_AppMeta_hpp 29 | 30 | #include 31 | 32 | class AppMetaData 33 | { 34 | public: 35 | const String& GetName(); 36 | void SetName(const String& name); 37 | 38 | const String& GetVersion(); 39 | void SetVersion(const String& version); 40 | 41 | const String& GetIdentifier(); 42 | void SetIdentifier(const String& identifier); 43 | private: 44 | String _name; 45 | String _version; 46 | String _identifier; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/SDL3/Vec2i.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Vec2i_hpp 28 | #define SDL3Lite_Vec2i_hpp 29 | 30 | #include 31 | 32 | class Vec2i : public SDL_Point 33 | { 34 | public: 35 | Vec2i(); 36 | Vec2i(int x, int y); 37 | const Vec2i& operator=(Vec2i& v); 38 | const Vec2i& operator=(const Vec2i& v); 39 | }; 40 | 41 | class Vec2f : public SDL_FPoint 42 | { 43 | public: 44 | Vec2f(); 45 | Vec2f(float x, float y); 46 | const Vec2f& operator=(Vec2f& v); 47 | const Vec2f& operator=(const Vec2f& v); 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/SDL3/Init.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | 30 | bool SDL_SetAppMetadata(const char* appname, const char* appversion, const char* appidentifier) 31 | { 32 | GetApplication().GetAppMetaData().SetName(appname); 33 | GetApplication().GetAppMetaData().SetVersion(appversion); 34 | GetApplication().GetAppMetaData().SetIdentifier(appidentifier); 35 | 36 | return true; 37 | } 38 | 39 | int SDL_Init(SDL_InitFlags flags) 40 | { 41 | assert(flags > 0); 42 | 43 | return 1; 44 | } 45 | 46 | void SDL_Quit() 47 | { 48 | } 49 | -------------------------------------------------------------------------------- /src/SDL3/Unix/Library.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | Library::Library(Result& result) : 30 | _result(result), 31 | _library(NULL) 32 | { 33 | } 34 | 35 | Library::~Library() 36 | { 37 | Close(); 38 | } 39 | 40 | bool Library::Open(const String& path) 41 | { 42 | return false; 43 | } 44 | 45 | void Library::Close() 46 | { 47 | if (_library != NULL) 48 | { 49 | dlclose(_library); 50 | } 51 | } 52 | 53 | SDL_FunctionPointer Library::Load(const String& name) 54 | { 55 | return (SDL_FunctionPointer)dlsym(_library, name.c_str()); 56 | } 57 | -------------------------------------------------------------------------------- /src/SDL3/BaseWin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_BaseWin_hpp 28 | #define SDL3Lite_BaseWin_hpp 29 | 30 | #include 31 | #include 32 | 33 | class BaseWindow 34 | { 35 | public: 36 | BaseWindow(const Vec2i& pos, const Vec2i& size, const String& title); 37 | const Vec2i& GetPos(); 38 | void SetPos(const Vec2i& pos); 39 | const Vec2i& GetSize(); 40 | void SetSize(const Vec2i& size); 41 | const String& GetTitle(); 42 | void SetTitle(const String& title); 43 | private: 44 | Vec2i _pos; 45 | Vec2i _size; 46 | String _title; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/SDL3/BmpLoad.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_BmpLoad_hpp 28 | #define SDL3Lite_BmpLoad_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | class BmpLoader 36 | { 37 | public: 38 | BmpLoader(Result& result); 39 | ~BmpLoader(); 40 | bool Reset(const String& path); 41 | const Vec2i& GetSize(); 42 | int GetBpp(); 43 | Uint8* GetPixels(); 44 | private: 45 | void Clear(); 46 | int _bpp; 47 | Vec2i _size; 48 | Result& _result; 49 | Vector _pixels; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/SDL3/AppMeta.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | const String& AppMetaData::GetName() 30 | { 31 | return _name; 32 | } 33 | 34 | void AppMetaData::SetName(const String& name) 35 | { 36 | _name = name; 37 | } 38 | 39 | const String& AppMetaData::GetVersion() 40 | { 41 | return _version; 42 | } 43 | 44 | void AppMetaData::SetVersion(const String& version) 45 | { 46 | _version = version; 47 | } 48 | 49 | const String& AppMetaData::GetIdentifier() 50 | { 51 | return _identifier; 52 | } 53 | 54 | void AppMetaData::SetIdentifier(const String& identifier) 55 | { 56 | _identifier = identifier; 57 | } 58 | -------------------------------------------------------------------------------- /src/SDL3/Result.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | Result::Result() : 30 | _ok(true) 31 | { 32 | } 33 | 34 | bool Result::Ok() 35 | { 36 | return _ok; 37 | } 38 | 39 | const String& Result::Message() 40 | { 41 | return _message; 42 | } 43 | 44 | void Result::Message(const String& message) 45 | { 46 | _ok = false; 47 | 48 | _message = message; 49 | } 50 | 51 | void Result::Message(const String& message, const String& detail) 52 | { 53 | _ok = false; 54 | 55 | _message = message; 56 | _message += detail; 57 | } 58 | 59 | void Result::Clear() 60 | { 61 | _ok = true; 62 | _message = ""; 63 | } 64 | -------------------------------------------------------------------------------- /src/SDL3/Win32/WinError.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | const String& WindowError::GetErrorMessage() 32 | { 33 | DWORD ident = GetLastError(); 34 | assert(ident != 0); 35 | 36 | LPSTR buffer = NULL; 37 | 38 | size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, ident, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&buffer, 0, NULL); 39 | 40 | _message.append(buffer, size); 41 | 42 | LocalFree(buffer); 43 | 44 | return _message; 45 | } 46 | -------------------------------------------------------------------------------- /Arcanum/Arcanum/Engine.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef Arcanum_Engine_hpp 28 | #define Arcanum_Engine_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | namespace Arcanum 36 | { 37 | class Engine 38 | { 39 | public: 40 | Engine(); 41 | ~Engine(); 42 | void Run(); 43 | private: 44 | void Draw(); 45 | bool _running; 46 | SDL_Window* _window; 47 | SDL_Renderer* _renderer; 48 | FpsCounter _fpsCounter; 49 | Convert _convert; 50 | SpriteManager* _spriteManager; 51 | }; 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/SDL3/StdMath.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | double SDL_sin(double x) 34 | { 35 | return sin(x); 36 | } 37 | 38 | float SDL_sinf(float x) 39 | { 40 | return (float)sin((double)(x)); 41 | } 42 | 43 | float SDL_cosf(float x) 44 | { 45 | return (float)cos((double)(x)); 46 | } 47 | 48 | float SDL_randf(void) 49 | { 50 | return (float)(rand()) / (float)(RAND_MAX); 51 | } 52 | 53 | Sint32 SDL_rand(Sint32 n) 54 | { 55 | return 0 + rand() % (n - 0); 56 | } 57 | 58 | int SDL_abs(int x) 59 | { 60 | return abs(x); 61 | } 62 | -------------------------------------------------------------------------------- /src/SDL3/EventH.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | EventHandler::EventHandler() : 30 | _running(true) 31 | { 32 | } 33 | 34 | void EventHandler::Push(SDL_Event& event) 35 | { 36 | _queue.Enqueue(event); 37 | } 38 | 39 | bool EventHandler::Pop(SDL_Event& event) 40 | { 41 | if (!_queue.IsEmpty()) 42 | { 43 | _queue.Dequeue(event); 44 | 45 | return true; 46 | } 47 | 48 | return false; 49 | } 50 | 51 | bool EventHandler::Running() 52 | { 53 | return _running; 54 | } 55 | 56 | void EventHandler::Stop() 57 | { 58 | _running = false; 59 | } 60 | 61 | bool EventHandler::Empty() 62 | { 63 | return _queue.IsEmpty(); 64 | } 65 | -------------------------------------------------------------------------------- /include/SDL3/Loadso.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Loadso_h 28 | #define SDL3Lite_Loadso_h 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | typedef void (*SDL_FunctionPointer)(void); 37 | typedef struct SDL_SharedObject SDL_SharedObject; 38 | 39 | extern SDL_DECLSPEC SDL_SharedObject* SDLCALL SDL_LoadObject(const char* sofile); 40 | extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_LoadFunction(SDL_SharedObject* handle, const char* name); 41 | extern SDL_DECLSPEC void SDLCALL SDL_UnloadObject(SDL_SharedObject* handle); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/SDL3/StdMath.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_StdMath_h 28 | #define SDL3Lite_StdMath_h 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #define SDL_PI_D (3.141592653589793238462643383279502884) 37 | 38 | extern SDL_DECLSPEC double SDLCALL SDL_sin(double x); 39 | extern SDL_DECLSPEC float SDLCALL SDL_sinf(float x); 40 | extern SDL_DECLSPEC float SDLCALL SDL_cosf(float x); 41 | extern SDL_DECLSPEC float SDLCALL SDL_randf(void); 42 | extern SDL_DECLSPEC Sint32 SDLCALL SDL_rand(Sint32 n); 43 | extern SDL_DECLSPEC int SDLCALL SDL_abs(int x); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /include/SDL3/Rect.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Rect_h 28 | #define SDL3Lite_Rect_h 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct SDL_Point 37 | { 38 | int x; 39 | int y; 40 | } SDL_Point; 41 | 42 | 43 | typedef struct SDL_FPoint 44 | { 45 | float x; 46 | float y; 47 | } SDL_FPoint; 48 | 49 | typedef struct SDL_FRect 50 | { 51 | float x, y; 52 | float w, h; 53 | } SDL_FRect; 54 | 55 | typedef struct SDL_Rect 56 | { 57 | int x, y; 58 | int w, h; 59 | } SDL_Rect; 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /Arcanum/Arcanum/FpsCounter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | using namespace Arcanum; 30 | 31 | FpsCounter::FpsCounter() : 32 | _current(0), 33 | _delta(0), 34 | _old(0), 35 | _fps(0) 36 | { 37 | } 38 | 39 | void FpsCounter::Start() 40 | { 41 | _current = SDL_GetTicks(); 42 | } 43 | 44 | bool FpsCounter::Calc() 45 | { 46 | _fps++; 47 | 48 | _delta = SDL_GetTicks() - _current; 49 | 50 | _old += _delta; 51 | 52 | if (_old >= 1000) 53 | { 54 | return true; 55 | } 56 | 57 | return false; 58 | } 59 | 60 | Uint64 FpsCounter::Fps() 61 | { 62 | return _fps; 63 | } 64 | 65 | void FpsCounter::Clear() 66 | { 67 | _fps = 0; 68 | _old = 0; 69 | } 70 | -------------------------------------------------------------------------------- /src/SDL3/MemMngr.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_MemMngr_hpp 28 | #define SDL3Lite_MemMngr_hpp 29 | 30 | #include 31 | 32 | class MemoryManager 33 | { 34 | public: 35 | MemoryManager(); 36 | ~MemoryManager(); 37 | bool SetMemoryFunctions(SDL_malloc_func malloc_func, SDL_calloc_func calloc_func, SDL_realloc_func realloc_func, SDL_free_func free_func); 38 | SDL_malloc_func GetMalloc(); 39 | SDL_calloc_func GetCalloc(); 40 | SDL_realloc_func GetRealloc(); 41 | SDL_free_func GetFree(); 42 | private: 43 | SDL_malloc_func _mallocFunc; 44 | SDL_calloc_func _callocFunc; 45 | SDL_realloc_func _reallocFunc; 46 | SDL_free_func _freeFunc; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/SDL3/OpenGL/GLUtils.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_OpenGL_GLUtils_hpp 28 | #define SDL3Lite_OpenGL_GLUtils_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | int SelectTextureSize(const Vec2i& size); 36 | void Normalize(const Color& color, GLclampf& r, GLclampf& g, GLclampf& b); 37 | GLuint CreateTexture(GLsizei width, GLsizei heigth, GLint format); 38 | void DestroyTexture(GLint id); 39 | GLint BppToFormat(int bpp); 40 | void CopyTexture(GLuint id, const Vec2i& dstPos, const Vec2i& srcSize, Uint8* pixels, int bpp); 41 | void DrawTexture(const Rect2f& dst, const Rect2f& src, size_t textureSize); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/SDL3/BaseWin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | BaseWindow::BaseWindow(const Vec2i& pos, const Vec2i& size, const String& title) : 30 | _pos(pos), 31 | _size(size), 32 | _title(title) 33 | { 34 | } 35 | 36 | const Vec2i& BaseWindow::GetPos() 37 | { 38 | return _pos; 39 | } 40 | 41 | void BaseWindow::SetPos(const Vec2i& pos) 42 | { 43 | _pos = pos; 44 | } 45 | 46 | const Vec2i& BaseWindow::GetSize() 47 | { 48 | return _size; 49 | } 50 | 51 | void BaseWindow::SetSize(const Vec2i& size) 52 | { 53 | _size = size; 54 | } 55 | 56 | const String& BaseWindow::GetTitle() 57 | { 58 | return _title; 59 | } 60 | 61 | void BaseWindow::SetTitle(const String& title) 62 | { 63 | _title = title; 64 | } 65 | -------------------------------------------------------------------------------- /src/SDL3/SurfRndr.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Renders_Software_SurfRndr_hpp 28 | #define SDL3Lite_Renders_Software_SurfRndr_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | class SurfaceRender : public SDL_Renderer 35 | { 36 | public: 37 | SurfaceRender(Surface* surface); 38 | SDL_WindowFlags GetFlags(); 39 | const Vec2i& GetSize(); 40 | void Present(); 41 | void SetColor(const Color& color); 42 | void Clear(); 43 | void FillRect(const Vec2f& pos, const Vec2f& size); 44 | void Line(const Vec2f& first, const Vec2f& last); 45 | void Draw(SDL_Texture* texture, const Rect2f& dst, const Rect2f& src); 46 | private: 47 | PixelPainter _pixelPainter; 48 | Color _color; 49 | Surface* _surface; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/SDL3/Dos16/SoftWin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Dos16_SoftWin_hpp 28 | #define SDL3Lite_Dos16_SoftWin_hpp 29 | 30 | #include 31 | #include 32 | 33 | class SoftwareWindow : public SDL_Window 34 | { 35 | public: 36 | SoftwareWindow(Result& result, EventHandler& eventHandler, const Vec2i& pos, const Vec2i& size, const String& title, SDL_WindowFlags mode); 37 | Surface* GetSurface(); 38 | const Vec2i& GetPos(); 39 | void SetPos(const Vec2i& pos); 40 | const Vec2i& GetSize(); 41 | void SetSize(const Vec2i& size); 42 | const String& GetTitle(); 43 | void SetTitle(const String& title); 44 | SDL_WindowFlags GetFlags(); 45 | bool Present(); 46 | void PollEvents(); 47 | private: 48 | MainWindow _mainWindow; 49 | Surface _surface; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/SDL3/Win32/Library.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | Library::Library(Result& result) : 30 | _result(result), 31 | _module(NULL) 32 | { 33 | } 34 | 35 | Library::~Library() 36 | { 37 | Close(); 38 | } 39 | 40 | bool Library::Open(const String& path) 41 | { 42 | _module = LoadLibrary(path.c_str()); 43 | 44 | return (_module != NULL); 45 | } 46 | 47 | void Library::Close() 48 | { 49 | if (_module != NULL) 50 | { 51 | FreeLibrary(_module); 52 | _module = NULL; 53 | } 54 | } 55 | 56 | SDL_FunctionPointer Library::Load(const String& name) 57 | { 58 | SDL_FunctionPointer result = (SDL_FunctionPointer)GetProcAddress(_module, name.c_str()); 59 | 60 | if (result == NULL) 61 | { 62 | _result.Message("Could not load library: " + String(name)); 63 | } 64 | 65 | return result; 66 | } 67 | -------------------------------------------------------------------------------- /src/SDL3/Vec2i.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | Vec2i::Vec2i() 30 | { 31 | x = 0; 32 | y = 0; 33 | } 34 | 35 | Vec2i::Vec2i(int x, int y) 36 | { 37 | this->x = x; 38 | this->y = y; 39 | } 40 | 41 | const Vec2i& Vec2i::operator=(Vec2i& v) 42 | { 43 | x = v.x; 44 | y = v.y; 45 | 46 | return *this; 47 | } 48 | 49 | const Vec2i& Vec2i::operator=(const Vec2i& v) 50 | { 51 | x = v.x; 52 | y = v.y; 53 | 54 | return *this; 55 | } 56 | 57 | Vec2f::Vec2f() 58 | { 59 | x = 0; 60 | y = 0; 61 | } 62 | 63 | Vec2f::Vec2f(float x, float y) 64 | { 65 | this->x = x; 66 | this->y = y; 67 | } 68 | 69 | const Vec2f& Vec2f::operator=(Vec2f& v) 70 | { 71 | x = v.x; 72 | y = v.y; 73 | 74 | return *this; 75 | } 76 | 77 | const Vec2f& Vec2f::operator=(const Vec2f& v) 78 | { 79 | x = v.x; 80 | y = v.y; 81 | 82 | return *this; 83 | } 84 | -------------------------------------------------------------------------------- /src/SDL3/Unix/SoftWin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Unix_SoftWin_hpp 28 | #define SDL3Lite_Unix_SoftWin_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | class SoftwareWindow : public SDL_Window 35 | { 36 | public: 37 | SoftwareWindow(Result& result, EventHandler& eventHandler, const Vec2i& pos, const Vec2i& size, const String& title, SDL_WindowFlags mode); 38 | Surface* GetSurface(); 39 | const Vec2i& GetPos(); 40 | void SetPos(const Vec2i& pos); 41 | const Vec2i& GetSize(); 42 | void SetSize(const Vec2i& size); 43 | const String& GetTitle(); 44 | void SetTitle(const String& title); 45 | bool Present(); 46 | void PollEvents(); 47 | SDL_WindowFlags GetFlags(); 48 | private: 49 | MainWindow _mainWindow; 50 | Surface _surface; 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/SDL3/SoftRndr.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Renders_Software_SoftRndr_hpp 28 | #define SDL3Lite_Renders_Software_SoftRndr_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | class SoftwareRender : public SDL_Renderer 36 | { 37 | public: 38 | SoftwareRender(SDL_Window* window); 39 | SDL_WindowFlags GetFlags(); 40 | const Vec2i& GetSize(); 41 | void Present(); 42 | void SetColor(const Color& color); 43 | void Clear(); 44 | void FillRect(const Vec2f& pos, const Vec2f& size); 45 | void Line(const Vec2f& first, const Vec2f& last); 46 | void Draw(SDL_Texture* texture, const Rect2f& dst, const Rect2f& src); 47 | private: 48 | PixelPainter _pixelPainter; 49 | PixelCopier _pixelCopier; 50 | Color _color; 51 | SDL_Window* _window; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/SDL3/Win32/SoftWin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Win32_SoftWin_hpp 28 | #define SDL3Lite_Win32_SoftWin_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | class SoftwareWindow : public SDL_Window 35 | { 36 | public: 37 | SoftwareWindow(Result& result, EventHandler& eventHandler, const Vec2i& pos, const Vec2i& size, const String& title, SDL_WindowFlags mode); 38 | Surface* GetSurface(); 39 | const Vec2i& GetPos(); 40 | void SetPos(const Vec2i& pos); 41 | const Vec2i& GetSize(); 42 | void SetSize(const Vec2i& size); 43 | const String& GetTitle(); 44 | void SetTitle(const String& title); 45 | SDL_WindowFlags GetFlags(); 46 | bool Present(); 47 | void PollEvents(); 48 | private: 49 | MainWindow _mainWindow; 50 | Surface _surface; 51 | BITMAPINFO _bitmapInfo; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/SDL3/Mouse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Mouse_h 28 | #define SDL3Lite_Mouse_h 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | typedef Uint32 SDL_MouseID; 37 | typedef Uint32 SDL_MouseButtonFlags; 38 | 39 | #define SDL_BUTTON_LEFT (1) 40 | #define SDL_BUTTON_MIDDLE (2) 41 | #define SDL_BUTTON_RIGHT (3) 42 | #define SDL_BUTTON_X1 (4) 43 | #define SDL_BUTTON_X2 (5) 44 | 45 | #define SDL_BUTTON_MASK(X) (1u << ((X)-1)) 46 | #define SDL_BUTTON_LMASK SDL_BUTTON_MASK(SDL_BUTTON_LEFT) 47 | #define SDL_BUTTON_MMASK SDL_BUTTON_MASK(SDL_BUTTON_MIDDLE) 48 | #define SDL_BUTTON_RMASK SDL_BUTTON_MASK(SDL_BUTTON_RIGHT) 49 | #define SDL_BUTTON_X1MASK SDL_BUTTON_MASK(SDL_BUTTON_X1) 50 | #define SDL_BUTTON_X2MASK SDL_BUTTON_MASK(SDL_BUTTON_X2) 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /include/SDL3/StdMem.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_StdMem_h 28 | #define SDL3Lite_StdMem_h 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | typedef void* (SDLCALL* SDL_malloc_func) (size_t size); 37 | typedef void* (SDLCALL* SDL_calloc_func) (size_t nmemb, size_t size); 38 | typedef void* (SDLCALL* SDL_realloc_func)(void* mem, size_t size); 39 | typedef void (SDLCALL* SDL_free_func) (void* mem); 40 | 41 | extern SDL_DECLSPEC void* SDLCALL SDL_malloc(size_t size); 42 | extern SDL_DECLSPEC void* SDLCALL SDL_calloc(size_t nmemb, size_t size); 43 | extern SDL_DECLSPEC void* SDLCALL SDL_realloc(void* mem, size_t size); 44 | extern SDL_DECLSPEC void SDLCALL SDL_free(void* mem); 45 | extern SDL_DECLSPEC void* SDLCALL SDL_memcpy(void* dst, const void* src, size_t len); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/SDL3/Dos16/MainWin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Dos16_MainWin_hpp 28 | #define SDL3Lite_Dos16_MainWin_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | class MainWindow 36 | { 37 | public: 38 | MainWindow(Result& result, EventHandler& eventHandler, const Vec2i& pos, const Vec2i& size, const String& title, SDL_WindowFlags mode); 39 | ~MainWindow(); 40 | const Vec2i& GetPos(); 41 | void SetPos(const Vec2i& pos); 42 | const Vec2i& GetSize(); 43 | void SetSize(const Vec2i& size); 44 | const String& GetTitle(); 45 | void SetTitle(const String& title); 46 | SDL_WindowFlags GetFlags(); 47 | void PollEvents(); 48 | private: 49 | Result* _result; 50 | EventHandler* _eventHandler; 51 | BaseWindow _baseWindow; 52 | SDL_WindowFlags _WindowFlags; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/SDL3/Renders/OpenGL1/GL1Tex.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Renders_OpenGL1_GL1Tex_hpp 28 | #define SDL3Lite_Renders_OpenGL1_GL1Tex_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | class OpenGL1Render; 37 | 38 | class OpenGL1Texture : public SDL_Texture 39 | { 40 | public: 41 | ~OpenGL1Texture(); 42 | OpenGL1Texture(SDL_Renderer* render, const Vec2i& size, int bpp); 43 | OpenGL1Texture(SDL_Renderer* render, const Vec2i& size, int bpp, Uint8* pixels); 44 | const Vec2i& GetSize(); 45 | const Vec2i& GetQuad(); 46 | bool Update(const Vec2i& pos, const Vec2i& size, Uint8* pixels, int bpp); 47 | public: 48 | GLuint GetTexture(); 49 | private: 50 | SDL_Renderer* _render; 51 | GLuint _texture; 52 | Vec2i _size; 53 | Vec2i _quad; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/SDL3/SoftTex.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | SoftwareTexture::~SoftwareTexture() 30 | { 31 | } 32 | 33 | SoftwareTexture::SoftwareTexture(SDL_Renderer* render, const Vec2i& size, int bpp) : 34 | _render(render), 35 | _size(size), 36 | _surface(size) 37 | { 38 | } 39 | 40 | SoftwareTexture::SoftwareTexture(SDL_Renderer* render, const Vec2i& size, int bpp, Uint8* pixels) : 41 | _render(render), 42 | _size(size), 43 | _surface(size) 44 | { 45 | } 46 | 47 | const Vec2i& SoftwareTexture::GetSize() 48 | { 49 | return _size; 50 | } 51 | 52 | bool SoftwareTexture::Update(const Vec2i& pos, const Vec2i& size, Uint8* pixels, int bpp) 53 | { 54 | _pixelCopier.Copy(_surface.GetPixels(), _surface.GetBpp(), _surface.GetSize(), pos, size, pixels, bpp, size, pos, size); 55 | 56 | return true; 57 | } 58 | 59 | Surface* SoftwareTexture::GetSurface() 60 | { 61 | return &_surface; 62 | } 63 | -------------------------------------------------------------------------------- /src/SDL3/Surface.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Surface_hpp 28 | #define SDL3Lite_Surface_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | class Surface : public SDL_Surface 35 | { 36 | public: 37 | Surface(const Vec2i& size, SDL_PixelFormat pixelFormat = SDL_PIXELFORMAT_RGB24); 38 | ~Surface(); 39 | bool IsColorKey(); 40 | void SetColorKey(bool enabled); 41 | Uint32 GetColorKey(); 42 | void SetColorKey(Uint32 colorKey); 43 | int GetBpp(); 44 | int GetPitch(); 45 | SDL_PixelFormat GetPixelFormat(); 46 | const Vec2i& GetSize(); 47 | Uint8* GetPixels(); 48 | private: 49 | bool _colorKeyEnabled; 50 | Uint8 _bpp; 51 | Uint32 _colorKey; 52 | Vec2i _size; 53 | Vector _pixels; 54 | }; 55 | 56 | SDL_Surface* SDL_CreateSurfaceImplementation(int width, int height, SDL_PixelFormat format); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/SDL3/SoftTex.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Renders_Software_SoftTex_hpp 28 | #define SDL3Lite_Renders_Software_SoftTex_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | class SoftwareRender; 38 | 39 | class SoftwareTexture : public SDL_Texture 40 | { 41 | public: 42 | ~SoftwareTexture(); 43 | SoftwareTexture(SDL_Renderer* render, const Vec2i& size, int bpp); 44 | SoftwareTexture(SDL_Renderer* render, const Vec2i& size, int bpp, Uint8* pixels); 45 | const Vec2i& GetSize(); 46 | bool Update(const Vec2i& pos, const Vec2i& size, Uint8* pixels, int bpp); 47 | public: 48 | Surface* GetSurface(); 49 | private: 50 | PixelCopier _pixelCopier; 51 | SDL_Renderer* _render; 52 | Vec2i _size; 53 | Surface _surface; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/SDL3/Renderer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Renderer_hpp 28 | #define SDL3Lite_Renderer_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | struct SDL_Renderer 38 | { 39 | public: 40 | virtual ~SDL_Renderer() {}; 41 | virtual SDL_WindowFlags GetFlags() = 0; 42 | virtual const Vec2i& GetSize() = 0; 43 | virtual void Present() = 0; 44 | virtual void SetColor(const Color& color) = 0; 45 | virtual void Clear() = 0; 46 | virtual void FillRect(const Vec2f& pos, const Vec2f& size) = 0; 47 | virtual void Line(const Vec2f& first, const Vec2f& last) = 0; 48 | virtual void Draw(SDL_Texture* texture, const Rect2f& dst, const Rect2f& src) = 0; 49 | }; 50 | 51 | SDL_Renderer* SDL_CreateRendererImplementation(Result& result, SDL_Window* window, const char* name); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/SDL3/SObject.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | SDL_SharedObject* SDL_LoadObjectImplementation(Result& result, const char* sofile) 34 | { 35 | SDL_SharedObject* sharedObject = new Library(result); 36 | 37 | if (sharedObject->Open(sofile)) 38 | { 39 | return sharedObject; 40 | } 41 | 42 | return NULL; 43 | } 44 | 45 | SDL_SharedObject* SDL_LoadObject(const char* sofile) 46 | { 47 | return SDL_LoadObjectImplementation(GetApplication().GetResult(), sofile); 48 | } 49 | 50 | void SDL_UnloadObject(SDL_SharedObject* handle) 51 | { 52 | assert(handle); 53 | 54 | handle->Close(); 55 | 56 | delete handle; 57 | } 58 | 59 | SDL_FunctionPointer SDL_LoadFunction(SDL_SharedObject* handle, const char* name) 60 | { 61 | assert(handle); 62 | assert(name); 63 | 64 | return handle->Load(name); 65 | } 66 | -------------------------------------------------------------------------------- /Window.c: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | #define WINDOW_WIDTH (640) 30 | #define WINDOW_HEIGTH (480) 31 | 32 | int main() 33 | { 34 | SDL_Window* window = NULL; 35 | bool done = false; 36 | 37 | if (!SDL_Init(SDL_INIT_VIDEO)) 38 | { 39 | SDL_Log("Init error: %s\n", SDL_GetError()); 40 | return 1; 41 | } 42 | 43 | window = SDL_CreateWindow("Window", WINDOW_WIDTH, WINDOW_HEIGTH, 0); 44 | if (window == NULL) 45 | { 46 | SDL_Log("Create window error: %s\n", SDL_GetError()); 47 | return 1; 48 | } 49 | 50 | while (!done) 51 | { 52 | SDL_Event event; 53 | 54 | while (SDL_PollEvent(&event)) 55 | { 56 | if (event.type == SDL_EVENT_QUIT) 57 | { 58 | done = true; 59 | } 60 | } 61 | } 62 | 63 | SDL_DestroyWindow(window); 64 | SDL_Quit(); 65 | 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /src/SDL3/Dos16/GLWin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Dos16_GLWin_hpp 28 | #define SDL3Lite_Dos16_GLWin_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | class OpenGLWindow : public SDL_Window 35 | { 36 | public: 37 | OpenGLWindow(OpenGLAttributes& openGLAttributes, Result& result, EventHandler& eventHandler, const Vec2i& pos, const Vec2i& size, const String& title, SDL_WindowFlags mode); 38 | ~OpenGLWindow(); 39 | Surface* GetSurface(); 40 | const Vec2i& GetPos(); 41 | void SetPos(const Vec2i& pos); 42 | const Vec2i& GetSize(); 43 | void SetSize(const Vec2i& size); 44 | const String& GetTitle(); 45 | void SetTitle(const String& title); 46 | SDL_WindowFlags GetFlags(); 47 | bool Present(); 48 | void PollEvents(); 49 | private: 50 | OpenGLAttributes& _openGLAttributes; 51 | Result* _result; 52 | MainWindow _mainWindow; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/SDL3/SurfRndr.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | SurfaceRender::SurfaceRender(Surface* surface) : 30 | _surface(surface) 31 | { 32 | } 33 | 34 | SDL_WindowFlags SurfaceRender::GetFlags() 35 | { 36 | return 0; 37 | } 38 | 39 | const Vec2i& SurfaceRender::GetSize() 40 | { 41 | return _surface->GetSize(); 42 | } 43 | 44 | void SurfaceRender::Present() 45 | { 46 | } 47 | 48 | void SurfaceRender::SetColor(const Color& color) 49 | { 50 | _color = color; 51 | } 52 | 53 | void SurfaceRender::Clear() 54 | { 55 | _pixelPainter.Clear(_surface, _color); 56 | } 57 | 58 | void SurfaceRender::FillRect(const Vec2f& pos, const Vec2f& size) 59 | { 60 | _pixelPainter.FillRect(_surface, pos, size, _color); 61 | } 62 | 63 | void SurfaceRender::Line(const Vec2f& first, const Vec2f& last) 64 | { 65 | _pixelPainter.Line(_surface, first, last, _color); 66 | } 67 | 68 | void SurfaceRender::Draw(SDL_Texture* texture, const Rect2f& dst, const Rect2f& src) 69 | { 70 | } 71 | -------------------------------------------------------------------------------- /src/SDL3/Renders/OpenGL1/GL1Rndr.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Renders_OpenGL1_GL1Rndr_hpp 28 | #define SDL3Lite_Renders_OpenGL1_GL1Rndr_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | class OpenGL1Texture; 37 | 38 | class OpenGL1Render : public SDL_Renderer 39 | { 40 | public: 41 | OpenGL1Render(Result& result, SDL_Window* window); 42 | SDL_WindowFlags GetFlags(); 43 | const Vec2i& GetSize(); 44 | void Present(); 45 | void SetColor(const Color& color); 46 | void Clear(); 47 | void FillRect(const Vec2f& pos, const Vec2f& size); 48 | void Line(const Vec2f& first, const Vec2f& last); 49 | void Draw(SDL_Texture* texture, const Rect2f& dst, const Rect2f& src); 50 | private: 51 | Result& _result; 52 | SDL_Window* _window; 53 | Color _color; 54 | Mat4f _projection; 55 | Mat4f _modelView; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/SDL3/Win32/Win32.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Win32_Win32_hpp 28 | #define SDL3Lite_Win32_Win32_hpp 29 | 30 | #undef UNICODE 31 | #undef _UNICODE 32 | #define NOMINMAX 33 | #define WIN32_LEAN_AND_MEAN 34 | #include 35 | 36 | typedef HGLRC(WINAPI* PFNWGLCREATECONTEXT)(HDC); 37 | typedef BOOL(WINAPI* PFNWGLMAKECURRENT)(HDC, HGLRC); 38 | typedef BOOL(WINAPI* PFNWGLDELETECONTEXT)(HGLRC); 39 | 40 | typedef HGLRC(WINAPI* PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC hDC, HGLRC hShareContext, const int* attribList); 41 | 42 | #define WGL_CONTEXT_MAJOR_VERSION_ARB (0x2091) 43 | #define WGL_CONTEXT_MINOR_VERSION_ARB (0x2092) 44 | #define WGL_CONTEXT_FLAGS_ARB (0x2094) 45 | #define WGL_CONTEXT_PROFILE_MASK_ARB (0x9126) 46 | #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB (0x00000002) 47 | #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB (0x00000001) 48 | #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB (0x00000002) 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/SDL3/Unix/GLWin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Unix_GL1Win_hpp 28 | #define SDL3Lite_Unix_GL1Win_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | class OpenGLWindow : public SDL_Window 35 | { 36 | public: 37 | OpenGLWindow(OpenGLAttributes& openGLAttributes, Result& result, EventHandler& eventHandler, const Vec2i& pos, const Vec2i& size, const String& title, SDL_WindowFlags mode); 38 | ~OpenGLWindow(); 39 | Surface* GetSurface(); 40 | const Vec2i& GetPos(); 41 | void SetPos(const Vec2i& pos); 42 | const Vec2i& GetSize(); 43 | void SetSize(const Vec2i& size); 44 | const String& GetTitle(); 45 | void SetTitle(const String& title); 46 | bool Present(); 47 | void PollEvents(); 48 | SDL_WindowFlags GetFlags(); 49 | private: 50 | OpenGLAttributes* _openGLAttributes; 51 | Result* _result; 52 | MainWindow _mainWindow; 53 | XVisualInfo* _Visual; 54 | GLXContext _Context; 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/SDL3/App.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_App_hpp 28 | #define SDL3Lite_App_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | class Application 40 | { 41 | public: 42 | Application(); 43 | ~Application(); 44 | MemoryManager& GetMemoryManager(); 45 | Vector& GetWindows(); 46 | AppMetaData& GetAppMetaData(); 47 | EventHandler& GetEventHandler(); 48 | OpenGLAttributes& GetOpenGLAttributes(); 49 | Result& GetResult(); 50 | void PollEvents(); 51 | bool PollEvent(SDL_Event& dest); 52 | private: 53 | MemoryManager _memoryManager; 54 | Vector _windows; 55 | Result _result; 56 | OpenGLAttributes _openGLAttributes; 57 | AppMetaData _appMetaData; 58 | EventHandler _eventHandler; 59 | }; 60 | 61 | Application& GetApplication(); 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/SDL3/Window.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Window_hpp 28 | #define SDL3Lite_Window_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | struct SDL_Window 39 | { 40 | public: 41 | virtual ~SDL_Window() {}; 42 | virtual Surface* GetSurface() = 0; 43 | virtual const Vec2i& GetPos() = 0; 44 | virtual void SetPos(const Vec2i& pos) = 0; 45 | virtual const Vec2i& GetSize() = 0; 46 | virtual void SetSize(const Vec2i& size) = 0; 47 | virtual const String& GetTitle() = 0; 48 | virtual void SetTitle(const String& title) = 0; 49 | virtual SDL_WindowFlags GetFlags() = 0; 50 | virtual void PollEvents() = 0; 51 | virtual bool Present() = 0; 52 | }; 53 | 54 | SDL_Window* SDL_CreateWindowImplementation(Vector& windows, OpenGLAttributes& openGLAttributes, Result& result, EventHandler& eventHandler, const char* title, int w, int h, SDL_WindowFlags flags); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/SDL3/Rect2f.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | Rect2f::Rect2f() 30 | { 31 | x = 0.0f; 32 | y = 0.0f; 33 | w = 0.0f; 34 | h = 0.0f; 35 | } 36 | 37 | Rect2f::Rect2f(float x, float y, float w, float h) 38 | { 39 | this->x = x; 40 | this->y = y; 41 | this->w = w; 42 | this->h = h; 43 | } 44 | 45 | Rect2f::Rect2f(const SDL_FRect& rect) 46 | { 47 | x = rect.x; 48 | y = rect.y; 49 | w = rect.w; 50 | h = rect.h; 51 | } 52 | 53 | const Rect2f& Rect2f::operator=(Rect2f& v) 54 | { 55 | x = v.x; 56 | y = v.y; 57 | w = v.w; 58 | h = v.h; 59 | 60 | return *this; 61 | } 62 | 63 | const Rect2f& Rect2f::operator=(const Rect2f& v) 64 | { 65 | x = v.x; 66 | y = v.y; 67 | w = v.w; 68 | h = v.h; 69 | 70 | return *this; 71 | } 72 | 73 | const Rect2f& Rect2f::operator=(SDL_FRect* v) 74 | { 75 | x = v->x; 76 | y = v->y; 77 | w = v->w; 78 | h = v->h; 79 | 80 | return *this; 81 | } 82 | 83 | const Rect2f& Rect2f::operator=(const SDL_FRect* v) 84 | { 85 | x = v->x; 86 | y = v->y; 87 | w = v->w; 88 | h = v->h; 89 | 90 | return *this; 91 | } 92 | -------------------------------------------------------------------------------- /src/SDL3/Win32/GLWin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_Win32_GLWin_hpp 28 | #define SDL3Lite_Win32_GLWin_hpp 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | class OpenGLWindow : public SDL_Window 35 | { 36 | public: 37 | OpenGLWindow(OpenGLAttributes& openGLAttributes, Result& result, EventHandler& eventHandler, const Vec2i& pos, const Vec2i& size, const String& title, SDL_WindowFlags mode); 38 | ~OpenGLWindow(); 39 | Surface* GetSurface(); 40 | const Vec2i& GetPos(); 41 | void SetPos(const Vec2i& pos); 42 | const Vec2i& GetSize(); 43 | void SetSize(const Vec2i& size); 44 | const String& GetTitle(); 45 | void SetTitle(const String& title); 46 | SDL_WindowFlags GetFlags(); 47 | bool Present(); 48 | void PollEvents(); 49 | private: 50 | OpenGLAttributes& _openGLAttributes; 51 | Result* _result; 52 | HGLRC _renderContext; 53 | PIXELFORMATDESCRIPTOR _format; 54 | MainWindow _mainWindow; 55 | WindowError _windowError; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /Arcanum/Arcanum/SpriteManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | 30 | using namespace Arcanum; 31 | 32 | SpriteManager::SpriteManager(SDL_Renderer* renderer) : 33 | _renderer(renderer) 34 | { 35 | } 36 | 37 | SDL_Texture* SpriteManager::GetImage(const std::string& path) 38 | { 39 | SDL_Texture* result = NULL; 40 | 41 | std::map::iterator i = _textures.find(path); 42 | 43 | if (i == _textures.end()) 44 | { 45 | SDL_Surface* surface = SDL_LoadBMP(path.c_str()); 46 | 47 | if (surface == NULL) 48 | { 49 | throw std::runtime_error(SDL_GetError()); 50 | } 51 | 52 | SDL_SetSurfaceColorKey(surface, true, 0); 53 | 54 | result = SDL_CreateTextureFromSurface(_renderer, surface); 55 | 56 | if (result == NULL) 57 | { 58 | throw std::runtime_error(SDL_GetError()); 59 | } 60 | 61 | SDL_DestroySurface(surface); 62 | 63 | _textures.insert(std::pair(path, result)); 64 | } 65 | else 66 | { 67 | result = i->second; 68 | } 69 | 70 | return result; 71 | } 72 | -------------------------------------------------------------------------------- /src/SDL3/Bmp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | SDL_Surface* SDL_LoadBMP(const char* file) 35 | { 36 | return SDL_LoadBMPImplementation(GetApplication().GetResult(), file); 37 | } 38 | 39 | SDL_Surface* SDL_LoadBMPImplementation(Result& result, const char* file) 40 | { 41 | SDL_Surface* surface = NULL; 42 | 43 | BmpLoader bmpLoader(result); 44 | 45 | if (bmpLoader.Reset(file)) 46 | { 47 | surface = new Surface(bmpLoader.GetSize(), SDL_PIXELFORMAT_RGB24); 48 | 49 | int width = surface->w; 50 | int height = surface->h; 51 | int bpp = PixelFormatToBytesPerPixels(surface->format); 52 | 53 | size_t bytes = width * height * bpp; 54 | Uint8* dst = (Uint8*)surface->pixels; 55 | Uint8* src = bmpLoader.GetPixels(); 56 | 57 | for (size_t i = 0; i < bytes; i += bpp) 58 | { 59 | dst[i + 0] = src[i + 0]; 60 | dst[i + 1] = src[i + 1]; 61 | dst[i + 2] = src[i + 2]; 62 | } 63 | } 64 | 65 | return surface; 66 | } 67 | -------------------------------------------------------------------------------- /src/SDL3/GLAttr.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_GLAttr_hpp 28 | #define SDL3Lite_GLAttr_hpp 29 | 30 | class OpenGLAttributes 31 | { 32 | public: 33 | OpenGLAttributes(); 34 | 35 | int GetRedSize(); 36 | void SetRedSize(int value); 37 | 38 | int GetGreenSize(); 39 | void SetGreenSize(int value); 40 | 41 | int GetBlueSize(); 42 | void SetBlueSize(int value); 43 | 44 | int GetAlphaSize(); 45 | void SetAlphaSize(int value); 46 | 47 | int GetAccumRedSize(); 48 | void SetAccumRedSize(int value); 49 | 50 | int GetAccumGreenSize(); 51 | void SetAccumGreenSize(int value); 52 | 53 | int GetAccumBlueSize(); 54 | void SetAccumBlueSize(int value); 55 | 56 | int GetAccumAlphaSize(); 57 | void SetAccumAlphaSize(int value); 58 | 59 | int GetMajor(); 60 | void SetMajor(int value); 61 | 62 | int GetMinor(); 63 | void SetMinor(int value); 64 | private: 65 | int _redSize; 66 | int _greenSize; 67 | int _blueSize; 68 | int _alphaSize; 69 | int _accumRedSize; 70 | int _accumGreenSize; 71 | int _accumBlueSize; 72 | int _accumAlphaSize; 73 | int _major; 74 | int _minor; 75 | }; 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /include/SDL3/SDL_main.h: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef SDL3Lite_SDL_main_h 28 | #define SDL3Lite_SDL_main_h 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #if defined(SDL_MAIN_USE_CALLBACKS) 37 | 38 | extern SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]); 39 | extern SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event); 40 | extern SDL_AppResult SDL_AppIterate(void* appstate); 41 | extern void SDL_AppQuit(void* appstate, SDL_AppResult result); 42 | 43 | int main(int argc, char* argv[]) 44 | { 45 | SDL_AppResult result = SDL_AppInit(NULL, argc, argv); 46 | 47 | if (result != SDL_APP_FAILURE) 48 | { 49 | SDL_Event event; 50 | 51 | while (SDL_AppEvent(NULL, &event) != SDL_APP_SUCCESS) 52 | { 53 | while (SDL_PollEvent(&event)) 54 | { 55 | } 56 | 57 | SDL_AppIterate(NULL); 58 | } 59 | 60 | SDL_AppQuit(NULL, SDL_APP_FAILURE); 61 | } 62 | 63 | return result; 64 | } 65 | 66 | #endif 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/SDL3/Dos16/MainWin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | 29 | MainWindow::MainWindow(Result& result, EventHandler& eventHandler, const Vec2i& pos, const Vec2i& size, const String& title, SDL_WindowFlags mode) : 30 | _result(&result), 31 | _eventHandler(&eventHandler), 32 | _baseWindow(pos, size, title), 33 | _WindowFlags(mode) 34 | { 35 | } 36 | 37 | MainWindow::~MainWindow() 38 | { 39 | } 40 | 41 | const Vec2i& MainWindow::GetPos() 42 | { 43 | return _baseWindow.GetPos(); 44 | } 45 | 46 | void MainWindow::SetPos(const Vec2i& pos) 47 | { 48 | _baseWindow.SetPos(pos); 49 | } 50 | 51 | const Vec2i& MainWindow::GetSize() 52 | { 53 | return _baseWindow.GetSize(); 54 | } 55 | 56 | void MainWindow::SetSize(const Vec2i& size) 57 | { 58 | _baseWindow.SetSize(size); 59 | } 60 | 61 | const String& MainWindow::GetTitle() 62 | { 63 | return _baseWindow.GetTitle(); 64 | } 65 | 66 | void MainWindow::SetTitle(const String& title) 67 | { 68 | _baseWindow.SetTitle(title); 69 | } 70 | 71 | SDL_WindowFlags MainWindow::GetFlags() 72 | { 73 | return _WindowFlags; 74 | } 75 | 76 | void MainWindow::PollEvents() 77 | { 78 | } 79 | -------------------------------------------------------------------------------- /src/SDL3/MemMngr.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | 30 | MemoryManager::MemoryManager() : 31 | _mallocFunc(NULL), 32 | _callocFunc(NULL), 33 | _reallocFunc(NULL), 34 | _freeFunc(NULL) 35 | { 36 | _mallocFunc = &malloc; 37 | _callocFunc = &calloc; 38 | _reallocFunc = &realloc; 39 | _freeFunc = &free; 40 | } 41 | 42 | MemoryManager::~MemoryManager() 43 | { 44 | _mallocFunc = NULL; 45 | _callocFunc = NULL; 46 | _reallocFunc = NULL; 47 | _freeFunc = NULL; 48 | } 49 | 50 | bool MemoryManager::SetMemoryFunctions(SDL_malloc_func malloc_func, SDL_calloc_func calloc_func, SDL_realloc_func realloc_func, SDL_free_func free_func) 51 | { 52 | _mallocFunc = malloc_func; 53 | _callocFunc = calloc_func; 54 | _reallocFunc = realloc_func; 55 | _freeFunc = free_func; 56 | 57 | return true; 58 | } 59 | 60 | SDL_malloc_func MemoryManager::GetMalloc() 61 | { 62 | return _mallocFunc; 63 | } 64 | 65 | SDL_calloc_func MemoryManager::GetCalloc() 66 | { 67 | return _callocFunc; 68 | } 69 | 70 | SDL_realloc_func MemoryManager::GetRealloc() 71 | { 72 | return _reallocFunc; 73 | } 74 | 75 | SDL_free_func MemoryManager::GetFree() 76 | { 77 | return _freeFunc; 78 | } 79 | -------------------------------------------------------------------------------- /src/SDL3/App.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Boost Software License - Version 1.0 - August 17th, 2003 3 | 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | 30 | static Application MainApplication; 31 | 32 | Application::Application() 33 | { 34 | } 35 | 36 | Application::~Application() 37 | { 38 | } 39 | 40 | MemoryManager& Application::GetMemoryManager() 41 | { 42 | return _memoryManager; 43 | } 44 | 45 | Vector& Application::GetWindows() 46 | { 47 | return _windows; 48 | } 49 | 50 | AppMetaData& Application::GetAppMetaData() 51 | { 52 | return _appMetaData; 53 | } 54 | 55 | EventHandler& Application::GetEventHandler() 56 | { 57 | return _eventHandler; 58 | } 59 | 60 | OpenGLAttributes& Application::GetOpenGLAttributes() 61 | { 62 | return _openGLAttributes; 63 | } 64 | 65 | Result& Application::GetResult() 66 | { 67 | return _result; 68 | } 69 | 70 | void Application::PollEvents() 71 | { 72 | for (size_t i = 0; i < _windows.size(); i++) 73 | { 74 | _windows[i]->PollEvents(); 75 | } 76 | } 77 | 78 | bool Application::PollEvent(SDL_Event& dest) 79 | { 80 | if (!_eventHandler.Empty()) 81 | { 82 | _eventHandler.Pop(dest); 83 | 84 | return true; 85 | } 86 | 87 | return false; 88 | } 89 | 90 | Application& GetApplication() 91 | { 92 | return MainApplication; 93 | } 94 | --------------------------------------------------------------------------------