├── LICENSE ├── README.md ├── Tutorial 001_Setup ├── Mac │ ├── SDL Tutorial.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcuserdata │ │ │ │ └── sonarsystems.xcuserdatad │ │ │ │ └── UserInterfaceState.xcuserstate │ │ └── xcuserdata │ │ │ └── sonarsystems.xcuserdatad │ │ │ └── xcschemes │ │ │ ├── SDL Tutorial.xcscheme │ │ │ └── xcschememanagement.plist │ └── SDL Tutorial │ │ └── main.cpp └── Windows │ ├── CodeBlocks │ ├── SDL2.dll │ ├── SDLTut.cbp │ ├── SDLTut.layout │ ├── bin │ │ └── Debug │ │ │ └── SDLTut.exe │ ├── main.cpp │ └── obj │ │ └── Debug │ │ └── main.o │ ├── MinGW │ ├── Makefile │ ├── SDLMain.exe │ └── main.cpp │ ├── Visual Studio Code │ └── SDLTemplate │ │ ├── .vscode │ │ └── c_cpp_properties.json │ │ ├── Makefile │ │ ├── SDL2.dll │ │ ├── main.cpp │ │ ├── main.exe │ │ └── src │ │ ├── include │ │ └── SDL2 │ │ │ ├── SDL.h │ │ │ ├── SDL_assert.h │ │ │ ├── SDL_atomic.h │ │ │ ├── SDL_audio.h │ │ │ ├── SDL_bits.h │ │ │ ├── SDL_blendmode.h │ │ │ ├── SDL_clipboard.h │ │ │ ├── SDL_config.h │ │ │ ├── SDL_cpuinfo.h │ │ │ ├── SDL_egl.h │ │ │ ├── SDL_endian.h │ │ │ ├── SDL_error.h │ │ │ ├── SDL_events.h │ │ │ ├── SDL_filesystem.h │ │ │ ├── SDL_gamecontroller.h │ │ │ ├── SDL_gesture.h │ │ │ ├── SDL_haptic.h │ │ │ ├── SDL_hidapi.h │ │ │ ├── SDL_hints.h │ │ │ ├── SDL_joystick.h │ │ │ ├── SDL_keyboard.h │ │ │ ├── SDL_keycode.h │ │ │ ├── SDL_loadso.h │ │ │ ├── SDL_locale.h │ │ │ ├── SDL_log.h │ │ │ ├── SDL_main.h │ │ │ ├── SDL_messagebox.h │ │ │ ├── SDL_metal.h │ │ │ ├── SDL_misc.h │ │ │ ├── SDL_mouse.h │ │ │ ├── SDL_mutex.h │ │ │ ├── SDL_name.h │ │ │ ├── SDL_opengl.h │ │ │ ├── SDL_opengl_glext.h │ │ │ ├── SDL_opengles.h │ │ │ ├── SDL_opengles2.h │ │ │ ├── SDL_opengles2_gl2.h │ │ │ ├── SDL_opengles2_gl2ext.h │ │ │ ├── SDL_opengles2_gl2platform.h │ │ │ ├── SDL_opengles2_khrplatform.h │ │ │ ├── SDL_pixels.h │ │ │ ├── SDL_platform.h │ │ │ ├── SDL_power.h │ │ │ ├── SDL_quit.h │ │ │ ├── SDL_rect.h │ │ │ ├── SDL_render.h │ │ │ ├── SDL_revision.h │ │ │ ├── SDL_rwops.h │ │ │ ├── SDL_scancode.h │ │ │ ├── SDL_sensor.h │ │ │ ├── SDL_shape.h │ │ │ ├── SDL_stdinc.h │ │ │ ├── SDL_surface.h │ │ │ ├── SDL_system.h │ │ │ ├── SDL_syswm.h │ │ │ ├── SDL_test.h │ │ │ ├── SDL_test_assert.h │ │ │ ├── SDL_test_common.h │ │ │ ├── SDL_test_compare.h │ │ │ ├── SDL_test_crc32.h │ │ │ ├── SDL_test_font.h │ │ │ ├── SDL_test_fuzzer.h │ │ │ ├── SDL_test_harness.h │ │ │ ├── SDL_test_images.h │ │ │ ├── SDL_test_log.h │ │ │ ├── SDL_test_md5.h │ │ │ ├── SDL_test_memory.h │ │ │ ├── SDL_test_random.h │ │ │ ├── SDL_thread.h │ │ │ ├── SDL_timer.h │ │ │ ├── SDL_touch.h │ │ │ ├── SDL_types.h │ │ │ ├── SDL_version.h │ │ │ ├── SDL_video.h │ │ │ ├── SDL_vulkan.h │ │ │ ├── begin_code.h │ │ │ └── close_code.h │ │ └── lib │ │ ├── cmake │ │ └── SDL2 │ │ │ ├── sdl2-config-version.cmake │ │ │ └── sdl2-config.cmake │ │ ├── libSDL2.a │ │ ├── libSDL2.dll.a │ │ ├── libSDL2.la │ │ ├── libSDL2_test.a │ │ ├── libSDL2_test.la │ │ ├── libSDL2main.a │ │ ├── libSDL2main.la │ │ └── pkgconfig │ │ └── sdl2.pc │ └── Visual Studio │ ├── .vs │ └── SDLTutorial │ │ └── v14 │ │ └── .suo │ ├── Debug │ ├── SDLTutorial.exe │ ├── SDLTutorial.ilk │ └── SDLTutorial.pdb │ ├── SDLTutorial.VC.db │ ├── SDLTutorial.sln │ └── SDLTutorial │ ├── Debug │ ├── SDLTutorial.log │ ├── SDLTutorial.tlog │ │ ├── CL.command.1.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── SDLTutorial.lastbuildstate │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ └── link.write.1.tlog │ ├── main.obj │ ├── vc140.idb │ └── vc140.pdb │ ├── SDL2.dll │ ├── SDLTutorial.vcxproj │ ├── SDLTutorial.vcxproj.filters │ └── main.cpp ├── Tutorial 002_Hello World └── main.cpp ├── Tutorial 003_Drawing A BMP Image ├── hello_world.bmp └── main.cpp ├── Tutorial 004_Load Image Using SDL_image ├── logo.png └── main.cpp ├── Tutorial 005_Change Background Colour └── main.cpp ├── Tutorial 006_Keyboard Events └── main.cpp └── Tutorial 007_Mouse Events └── main.cpp /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SDL 2 Tutorials 2 | 3 | SDL 2.0+ tutorials including setup for the following video series https://www.youtube.com/playlist?list=PLRtjMdoYXLf75jCBW6Ln2aS7DZoB5q2Hr 4 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Mac/SDL Tutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Mac/SDL Tutorial.xcodeproj/project.xcworkspace/xcuserdata/sonarsystems.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Mac/SDL Tutorial.xcodeproj/project.xcworkspace/xcuserdata/sonarsystems.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Tutorial 001_Setup/Mac/SDL Tutorial.xcodeproj/xcuserdata/sonarsystems.xcuserdatad/xcschemes/SDL Tutorial.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Mac/SDL Tutorial.xcodeproj/xcuserdata/sonarsystems.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SDL Tutorial.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | EEE4F9951E237BA9004AC278 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Mac/SDL Tutorial/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main( int argc, char *argv[] ) 6 | { 7 | if ( SDL_Init( SDL_INIT_EVERYTHING ) < 0 ) 8 | { 9 | std::cout << "SDL could not initialize! SDL Error: " << SDL_GetError( ) << std::endl; 10 | } 11 | 12 | return EXIT_SUCCESS; 13 | } 14 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/CodeBlocks/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/CodeBlocks/SDL2.dll -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/CodeBlocks/SDLTut.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 47 | 48 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/CodeBlocks/SDLTut.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/CodeBlocks/bin/Debug/SDLTut.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/CodeBlocks/bin/Debug/SDLTut.exe -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/CodeBlocks/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main( int argc, char *argv[] ) 6 | { 7 | if ( SDL_Init( SDL_INIT_EVERYTHING ) < 0 ) 8 | { 9 | std::cout << "SDL could not initialise! SDL Error: " << SDL_GetError( ) << std::endl; 10 | } 11 | 12 | return EXIT_SUCCESS; 13 | } 14 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/CodeBlocks/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/CodeBlocks/obj/Debug/main.o -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/MinGW/Makefile: -------------------------------------------------------------------------------- 1 | #OBJS specifies which files to compile as part of the project 2 | OBJS = main.cpp 3 | 4 | #OBJ_NAME specifies the name of our exectuable 5 | OBJ_NAME = SDLMain 6 | 7 | #This is the target that compiles our executable 8 | all : $(OBJS) 9 | g++ $(OBJS) -IC:\Development\SDL2_MinGW_32Bit\include -LC:\Development\SDL2_MinGW_32Bit\lib -w -Wl,-subsystem,windows -lmingw32 -lSDL2main -lSDL2 -o $(OBJ_NAME) 10 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/MinGW/SDLMain.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/MinGW/SDLMain.exe -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/MinGW/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main( int argc, char *argv[] ) 6 | { 7 | if ( SDL_Init( SDL_INIT_EVERYTHING ) < 0 ) 8 | { 9 | std::cout << "SDL could not initialize! SDL Error: " << SDL_GetError( ) << std::endl; 10 | } 11 | 12 | system("pause"); 13 | 14 | return EXIT_SUCCESS; 15 | } -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Win32", 5 | "includePath": [ 6 | "${workspaceFolder}/**", 7 | "${workspaceFolder}/src/include" 8 | ], 9 | "defines": [ 10 | "_DEBUG", 11 | "UNICODE", 12 | "_UNICODE" 13 | ], 14 | "windowsSdkVersion": "10.0.18362.0", 15 | "compilerPath": "D:/Software/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe", 16 | "cStandard": "c17", 17 | "cppStandard": "c++17", 18 | "intelliSenseMode": "windows-msvc-x64" 19 | } 20 | ], 21 | "version": 4 22 | } -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2 -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/SDL2.dll -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | const int WIDTH = 800, HEIGHT = 600; 5 | 6 | int main( int argc, char *argv[] ) 7 | { 8 | SDL_Init( SDL_INIT_EVERYTHING ); 9 | 10 | SDL_Window *window = SDL_CreateWindow( "Hello SDL WORLD", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_ALLOW_HIGHDPI ); 11 | 12 | if ( NULL == window ) 13 | { 14 | std::cout << "Could not create window: " << SDL_GetError( ) << std::endl; 15 | return 1; 16 | } 17 | 18 | SDL_Event windowEvent; 19 | 20 | while ( true ) 21 | { 22 | if ( SDL_PollEvent( &windowEvent ) ) 23 | { 24 | if ( SDL_QUIT == windowEvent.type ) 25 | { break; } 26 | } 27 | } 28 | 29 | SDL_DestroyWindow( window ); 30 | SDL_Quit( ); 31 | 32 | return EXIT_SUCCESS; 33 | } -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/main.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/main.exe -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_bits.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_bits.h 24 | * 25 | * Functions for fiddling with bits and bitmasks. 26 | */ 27 | 28 | #ifndef SDL_bits_h_ 29 | #define SDL_bits_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * \file SDL_bits.h 41 | */ 42 | 43 | /** 44 | * Get the index of the most significant bit. Result is undefined when called 45 | * with 0. This operation can also be stated as "count leading zeroes" and 46 | * "log base 2". 47 | * 48 | * \return the index of the most significant bit, or -1 if the value is 0. 49 | */ 50 | #if defined(__WATCOMC__) && defined(__386__) 51 | extern __inline int _SDL_bsr_watcom(Uint32); 52 | #pragma aux _SDL_bsr_watcom = \ 53 | "bsr eax, eax" \ 54 | parm [eax] nomemory \ 55 | value [eax] \ 56 | modify exact [eax] nomemory; 57 | #endif 58 | 59 | SDL_FORCE_INLINE int 60 | SDL_MostSignificantBitIndex32(Uint32 x) 61 | { 62 | #if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 63 | /* Count Leading Zeroes builtin in GCC. 64 | * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html 65 | */ 66 | if (x == 0) { 67 | return -1; 68 | } 69 | return 31 - __builtin_clz(x); 70 | #elif defined(__WATCOMC__) && defined(__386__) 71 | if (x == 0) { 72 | return -1; 73 | } 74 | return _SDL_bsr_watcom(x); 75 | #elif defined(_MSC_VER) 76 | unsigned long index; 77 | if (_BitScanReverse(&index, x)) { 78 | return index; 79 | } 80 | return -1; 81 | #else 82 | /* Based off of Bit Twiddling Hacks by Sean Eron Anderson 83 | * , released in the public domain. 84 | * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog 85 | */ 86 | const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; 87 | const int S[] = {1, 2, 4, 8, 16}; 88 | 89 | int msbIndex = 0; 90 | int i; 91 | 92 | if (x == 0) { 93 | return -1; 94 | } 95 | 96 | for (i = 4; i >= 0; i--) 97 | { 98 | if (x & b[i]) 99 | { 100 | x >>= S[i]; 101 | msbIndex |= S[i]; 102 | } 103 | } 104 | 105 | return msbIndex; 106 | #endif 107 | } 108 | 109 | SDL_FORCE_INLINE SDL_bool 110 | SDL_HasExactlyOneBitSet32(Uint32 x) 111 | { 112 | if (x && !(x & (x - 1))) { 113 | return SDL_TRUE; 114 | } 115 | return SDL_FALSE; 116 | } 117 | 118 | /* Ends C function definitions when using C++ */ 119 | #ifdef __cplusplus 120 | } 121 | #endif 122 | #include "close_code.h" 123 | 124 | #endif /* SDL_bits_h_ */ 125 | 126 | /* vi: set ts=4 sw=4 expandtab: */ 127 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_clipboard.h 24 | * 25 | * Include file for SDL clipboard handling 26 | */ 27 | 28 | #ifndef SDL_clipboard_h_ 29 | #define SDL_clipboard_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | /** 42 | * Put UTF-8 text into the clipboard. 43 | * 44 | * \param text the text to store in the clipboard 45 | * \returns 0 on success or a negative error code on failure; call 46 | * SDL_GetError() for more information. 47 | * 48 | * \since This function is available since SDL 2.0.0. 49 | * 50 | * \sa SDL_GetClipboardText 51 | * \sa SDL_HasClipboardText 52 | */ 53 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); 54 | 55 | /** 56 | * Get UTF-8 text from the clipboard, which must be freed with SDL_free(). 57 | * 58 | * This functions returns empty string if there was not enough memory left for 59 | * a copy of the clipboard's content. 60 | * 61 | * \returns the clipboard text on success or an empty string on failure; call 62 | * SDL_GetError() for more information. Caller must call SDL_free() 63 | * on the returned pointer when done with it (even if there was an 64 | * error). 65 | * 66 | * \since This function is available since SDL 2.0.0. 67 | * 68 | * \sa SDL_HasClipboardText 69 | * \sa SDL_SetClipboardText 70 | */ 71 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); 72 | 73 | /** 74 | * Query whether the clipboard exists and contains a non-empty text string. 75 | * 76 | * \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not. 77 | * 78 | * \since This function is available since SDL 2.0.0. 79 | * 80 | * \sa SDL_GetClipboardText 81 | * \sa SDL_SetClipboardText 82 | */ 83 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); 84 | 85 | 86 | /* Ends C function definitions when using C++ */ 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | #include "close_code.h" 91 | 92 | #endif /* SDL_clipboard_h_ */ 93 | 94 | /* vi: set ts=4 sw=4 expandtab: */ 95 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_error.h 24 | * 25 | * Simple error message routines for SDL. 26 | */ 27 | 28 | #ifndef SDL_error_h_ 29 | #define SDL_error_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Public functions */ 40 | 41 | 42 | /** 43 | * Set the SDL error message for the current thread. 44 | * 45 | * Calling this function will replace any previous error message that was set. 46 | * 47 | * This function always returns -1, since SDL frequently uses -1 to signify an 48 | * failing result, leading to this idiom: 49 | * 50 | * ```c 51 | * if (error_code) { 52 | * return SDL_SetError("This operation has failed: %d", error_code); 53 | * } 54 | * ``` 55 | * 56 | * \param fmt a printf()-style message format string 57 | * \param ... additional parameters matching % tokens in the `fmt` string, if 58 | * any 59 | * \returns always -1. 60 | * 61 | * \since This function is available since SDL 2.0.0. 62 | * 63 | * \sa SDL_ClearError 64 | * \sa SDL_GetError 65 | */ 66 | extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 67 | 68 | /** 69 | * Retrieve a message about the last error that occurred on the current 70 | * thread. 71 | * 72 | * It is possible for multiple errors to occur before calling SDL_GetError(). 73 | * Only the last error is returned. 74 | * 75 | * The message is only applicable when an SDL function has signaled an error. 76 | * You must check the return values of SDL function calls to determine when to 77 | * appropriately call SDL_GetError(). You should *not* use the results of 78 | * SDL_GetError() to decide if an error has occurred! Sometimes SDL will set 79 | * an error string even when reporting success. 80 | * 81 | * SDL will *not* clear the error string for successful API calls. You *must* 82 | * check return values for failure cases before you can assume the error 83 | * string applies. 84 | * 85 | * Error strings are set per-thread, so an error set in a different thread 86 | * will not interfere with the current thread's operation. 87 | * 88 | * The returned string is internally allocated and must not be freed by the 89 | * application. 90 | * 91 | * \returns a message with information about the specific error that occurred, 92 | * or an empty string if there hasn't been an error message set since 93 | * the last call to SDL_ClearError(). The message is only applicable 94 | * when an SDL function has signaled an error. You must check the 95 | * return values of SDL function calls to determine when to 96 | * appropriately call SDL_GetError(). 97 | * 98 | * \since This function is available since SDL 2.0.0. 99 | * 100 | * \sa SDL_ClearError 101 | * \sa SDL_SetError 102 | */ 103 | extern DECLSPEC const char *SDLCALL SDL_GetError(void); 104 | 105 | /** 106 | * Get the last error message that was set for the current thread. 107 | * 108 | * This allows the caller to copy the error string into a provided buffer, but 109 | * otherwise operates exactly the same as SDL_GetError(). 110 | * 111 | * \param errstr A buffer to fill with the last error message that was set for 112 | * the current thread 113 | * \param maxlen The size of the buffer pointed to by the errstr parameter 114 | * \returns the pointer passed in as the `errstr` parameter. 115 | * 116 | * \since This function is available since SDL 2.0.14. 117 | * 118 | * \sa SDL_GetError 119 | */ 120 | extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen); 121 | 122 | /** 123 | * Clear any previous error message for this thread. 124 | * 125 | * \since This function is available since SDL 2.0.0. 126 | * 127 | * \sa SDL_GetError 128 | * \sa SDL_SetError 129 | */ 130 | extern DECLSPEC void SDLCALL SDL_ClearError(void); 131 | 132 | /** 133 | * \name Internal error functions 134 | * 135 | * \internal 136 | * Private error reporting function - used internally. 137 | */ 138 | /* @{ */ 139 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) 140 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) 141 | #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) 142 | typedef enum 143 | { 144 | SDL_ENOMEM, 145 | SDL_EFREAD, 146 | SDL_EFWRITE, 147 | SDL_EFSEEK, 148 | SDL_UNSUPPORTED, 149 | SDL_LASTERROR 150 | } SDL_errorcode; 151 | /* SDL_Error() unconditionally returns -1. */ 152 | extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); 153 | /* @} *//* Internal error functions */ 154 | 155 | /* Ends C function definitions when using C++ */ 156 | #ifdef __cplusplus 157 | } 158 | #endif 159 | #include "close_code.h" 160 | 161 | #endif /* SDL_error_h_ */ 162 | 163 | /* vi: set ts=4 sw=4 expandtab: */ 164 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_filesystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_filesystem.h 24 | * 25 | * \brief Include file for filesystem SDL API functions 26 | */ 27 | 28 | #ifndef SDL_filesystem_h_ 29 | #define SDL_filesystem_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * Get the directory where the application was run from. 42 | * 43 | * This is not necessarily a fast call, so you should call this once near 44 | * startup and save the string if you need it. 45 | * 46 | * **Mac OS X and iOS Specific Functionality**: If the application is in a 47 | * ".app" bundle, this function returns the Resource directory (e.g. 48 | * MyApp.app/Contents/Resources/). This behaviour can be overridden by adding 49 | * a property to the Info.plist file. Adding a string key with the name 50 | * SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the 51 | * behaviour. 52 | * 53 | * Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an 54 | * application in /Applications/SDLApp/MyApp.app): 55 | * 56 | * - `resource`: bundle resource directory (the default). For example: 57 | * `/Applications/SDLApp/MyApp.app/Contents/Resources` 58 | * - `bundle`: the Bundle directory. For example: 59 | * `/Applications/SDLApp/MyApp.app/` 60 | * - `parent`: the containing directory of the bundle. For example: 61 | * `/Applications/SDLApp/` 62 | * 63 | * The returned path is guaranteed to end with a path separator ('\' on 64 | * Windows, '/' on most other platforms). 65 | * 66 | * The pointer returned is owned by the caller. Please call SDL_free() on the 67 | * pointer when done with it. 68 | * 69 | * \returns an absolute path in UTF-8 encoding to the application data 70 | * directory. NULL will be returned on error or when the platform 71 | * doesn't implement this functionality, call SDL_GetError() for more 72 | * information. 73 | * 74 | * \since This function is available since SDL 2.0.1. 75 | * 76 | * \sa SDL_GetPrefPath 77 | */ 78 | extern DECLSPEC char *SDLCALL SDL_GetBasePath(void); 79 | 80 | /** 81 | * Get the user-and-app-specific path where files can be written. 82 | * 83 | * Get the "pref dir". This is meant to be where users can write personal 84 | * files (preferences and save games, etc) that are specific to your 85 | * application. This directory is unique per user, per application. 86 | * 87 | * This function will decide the appropriate location in the native 88 | * filesystem, create the directory if necessary, and return a string of the 89 | * absolute path to the directory in UTF-8 encoding. 90 | * 91 | * On Windows, the string might look like: 92 | * 93 | * `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\` 94 | * 95 | * On Linux, the string might look like" 96 | * 97 | * `/home/bob/.local/share/My Program Name/` 98 | * 99 | * On Mac OS X, the string might look like: 100 | * 101 | * `/Users/bob/Library/Application Support/My Program Name/` 102 | * 103 | * You should assume the path returned by this function is the only safe place 104 | * to write files (and that SDL_GetBasePath(), while it might be writable, or 105 | * even the parent of the returned path, isn't where you should be writing 106 | * things). 107 | * 108 | * Both the org and app strings may become part of a directory name, so please 109 | * follow these rules: 110 | * 111 | * - Try to use the same org string (_including case-sensitivity_) for all 112 | * your applications that use this function. 113 | * - Always use a unique app string for each one, and make sure it never 114 | * changes for an app once you've decided on it. 115 | * - Unicode characters are legal, as long as it's UTF-8 encoded, but... 116 | * - ...only use letters, numbers, and spaces. Avoid punctuation like "Game 117 | * Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. 118 | * 119 | * The returned path is guaranteed to end with a path separator ('\' on 120 | * Windows, '/' on most other platforms). 121 | * 122 | * The pointer returned is owned by the caller. Please call SDL_free() on the 123 | * pointer when done with it. 124 | * 125 | * \param org the name of your organization 126 | * \param app the name of your application 127 | * \returns a UTF-8 string of the user directory in platform-dependent 128 | * notation. NULL if there's a problem (creating directory failed, 129 | * etc.). 130 | * 131 | * \since This function is available since SDL 2.0.1. 132 | * 133 | * \sa SDL_GetBasePath 134 | */ 135 | extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); 136 | 137 | /* Ends C function definitions when using C++ */ 138 | #ifdef __cplusplus 139 | } 140 | #endif 141 | #include "close_code.h" 142 | 143 | #endif /* SDL_filesystem_h_ */ 144 | 145 | /* vi: set ts=4 sw=4 expandtab: */ 146 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_gesture.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_gesture.h 24 | * 25 | * Include file for SDL gesture event handling. 26 | */ 27 | 28 | #ifndef SDL_gesture_h_ 29 | #define SDL_gesture_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_video.h" 34 | 35 | #include "SDL_touch.h" 36 | 37 | 38 | #include "begin_code.h" 39 | /* Set up for C function definitions, even when using C++ */ 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | typedef Sint64 SDL_GestureID; 45 | 46 | /* Function prototypes */ 47 | 48 | /** 49 | * Begin recording a gesture on a specified touch device or all touch devices. 50 | * 51 | * If the parameter `touchId` is -1 (i.e., all devices), this function will 52 | * always return 1, regardless of whether there actually are any devices. 53 | * 54 | * \param touchId the touch device id, or -1 for all touch devices 55 | * \returns 1 on success or 0 if the specified device could not be found. 56 | * 57 | * \since This function is available since SDL 2.0.0. 58 | * 59 | * \sa SDL_GetTouchDevice 60 | */ 61 | extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); 62 | 63 | 64 | /** 65 | * Save all currently loaded Dollar Gesture templates. 66 | * 67 | * \param dst a SDL_RWops to save to 68 | * \returns the number of saved templates on success or 0 on failure; call 69 | * SDL_GetError() for more information. 70 | * 71 | * \since This function is available since SDL 2.0.0. 72 | * 73 | * \sa SDL_LoadDollarTemplates 74 | * \sa SDL_SaveDollarTemplate 75 | */ 76 | extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); 77 | 78 | /** 79 | * Save a currently loaded Dollar Gesture template. 80 | * 81 | * \param gestureId a gesture id 82 | * \param dst a SDL_RWops to save to 83 | * \returns 1 on success or 0 on failure; call SDL_GetError() for more 84 | * information. 85 | * 86 | * \since This function is available since SDL 2.0.0. 87 | * 88 | * \sa SDL_LoadDollarTemplates 89 | * \sa SDL_SaveAllDollarTemplates 90 | */ 91 | extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); 92 | 93 | 94 | /** 95 | * Load Dollar Gesture templates from a file. 96 | * 97 | * \param touchId a touch id 98 | * \param src a SDL_RWops to load from 99 | * \returns the number of loaded templates on success or a negative error code 100 | * (or 0) on failure; call SDL_GetError() for more information. 101 | * 102 | * \since This function is available since SDL 2.0.0. 103 | * 104 | * \sa SDL_SaveAllDollarTemplates 105 | * \sa SDL_SaveDollarTemplate 106 | */ 107 | extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); 108 | 109 | /* Ends C function definitions when using C++ */ 110 | #ifdef __cplusplus 111 | } 112 | #endif 113 | #include "close_code.h" 114 | 115 | #endif /* SDL_gesture_h_ */ 116 | 117 | /* vi: set ts=4 sw=4 expandtab: */ 118 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_loadso.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_loadso.h 24 | * 25 | * System dependent library loading routines 26 | * 27 | * Some things to keep in mind: 28 | * \li These functions only work on C function names. Other languages may 29 | * have name mangling and intrinsic language support that varies from 30 | * compiler to compiler. 31 | * \li Make sure you declare your function pointers with the same calling 32 | * convention as the actual library function. Your code will crash 33 | * mysteriously if you do not do this. 34 | * \li Avoid namespace collisions. If you load a symbol from the library, 35 | * it is not defined whether or not it goes into the global symbol 36 | * namespace for the application. If it does and it conflicts with 37 | * symbols in your code or other shared libraries, you will not get 38 | * the results you expect. :) 39 | */ 40 | 41 | #ifndef SDL_loadso_h_ 42 | #define SDL_loadso_h_ 43 | 44 | #include "SDL_stdinc.h" 45 | #include "SDL_error.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /** 54 | * Dynamically load a shared object. 55 | * 56 | * \param sofile a system-dependent name of the object file 57 | * \returns an opaque pointer to the object handle or NULL if there was an 58 | * error; call SDL_GetError() for more information. 59 | * 60 | * \since This function is available since SDL 2.0.0. 61 | * 62 | * \sa SDL_LoadFunction 63 | * \sa SDL_UnloadObject 64 | */ 65 | extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile); 66 | 67 | /** 68 | * Look up the address of the named function in a shared object. 69 | * 70 | * This function pointer is no longer valid after calling SDL_UnloadObject(). 71 | * 72 | * This function can only look up C function names. Other languages may have 73 | * name mangling and intrinsic language support that varies from compiler to 74 | * compiler. 75 | * 76 | * Make sure you declare your function pointers with the same calling 77 | * convention as the actual library function. Your code will crash 78 | * mysteriously if you do not do this. 79 | * 80 | * If the requested function doesn't exist, NULL is returned. 81 | * 82 | * \param handle a valid shared object handle returned by SDL_LoadObject() 83 | * \param name the name of the function to look up 84 | * \returns a pointer to the function or NULL if there was an error; call 85 | * SDL_GetError() for more information. 86 | * 87 | * \since This function is available since SDL 2.0.0. 88 | * 89 | * \sa SDL_LoadObject 90 | * \sa SDL_UnloadObject 91 | */ 92 | extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, 93 | const char *name); 94 | 95 | /** 96 | * Unload a shared object from memory. 97 | * 98 | * \param handle a valid shared object handle returned by SDL_LoadObject() 99 | * 100 | * \since This function is available since SDL 2.0.0. 101 | * 102 | * \sa SDL_LoadFunction 103 | * \sa SDL_LoadObject 104 | */ 105 | extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); 106 | 107 | /* Ends C function definitions when using C++ */ 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | #include "close_code.h" 112 | 113 | #endif /* SDL_loadso_h_ */ 114 | 115 | /* vi: set ts=4 sw=4 expandtab: */ 116 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_locale.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_locale.h 24 | * 25 | * Include file for SDL locale services 26 | */ 27 | 28 | #ifndef _SDL_locale_h 29 | #define _SDL_locale_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | /* *INDENT-OFF* */ 38 | extern "C" { 39 | /* *INDENT-ON* */ 40 | #endif 41 | 42 | 43 | typedef struct SDL_Locale 44 | { 45 | const char *language; /**< A language name, like "en" for English. */ 46 | const char *country; /**< A country, like "US" for America. Can be NULL. */ 47 | } SDL_Locale; 48 | 49 | /** 50 | * Report the user's preferred locale. 51 | * 52 | * This returns an array of SDL_Locale structs, the final item zeroed out. 53 | * When the caller is done with this array, it should call SDL_free() on the 54 | * returned value; all the memory involved is allocated in a single block, so 55 | * a single SDL_free() will suffice. 56 | * 57 | * Returned language strings are in the format xx, where 'xx' is an ISO-639 58 | * language specifier (such as "en" for English, "de" for German, etc). 59 | * Country strings are in the format YY, where "YY" is an ISO-3166 country 60 | * code (such as "US" for the United States, "CA" for Canada, etc). Country 61 | * might be NULL if there's no specific guidance on them (so you might get { 62 | * "en", "US" } for American English, but { "en", NULL } means "English 63 | * language, generically"). Language strings are never NULL, except to 64 | * terminate the array. 65 | * 66 | * Please note that not all of these strings are 2 characters; some are three 67 | * or more. 68 | * 69 | * The returned list of locales are in the order of the user's preference. For 70 | * example, a German citizen that is fluent in US English and knows enough 71 | * Japanese to navigate around Tokyo might have a list like: { "de", "en_US", 72 | * "jp", NULL }. Someone from England might prefer British English (where 73 | * "color" is spelled "colour", etc), but will settle for anything like it: { 74 | * "en_GB", "en", NULL }. 75 | * 76 | * This function returns NULL on error, including when the platform does not 77 | * supply this information at all. 78 | * 79 | * This might be a "slow" call that has to query the operating system. It's 80 | * best to ask for this once and save the results. However, this list can 81 | * change, usually because the user has changed a system preference outside of 82 | * your program; SDL will send an SDL_LOCALECHANGED event in this case, if 83 | * possible, and you can call this function again to get an updated copy of 84 | * preferred locales. 85 | * 86 | * \return array of locales, terminated with a locale with a NULL language 87 | * field. Will return NULL on error. 88 | * 89 | * \since This function is available since SDL 2.0.14. 90 | */ 91 | extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void); 92 | 93 | /* Ends C function definitions when using C++ */ 94 | #ifdef __cplusplus 95 | /* *INDENT-OFF* */ 96 | } 97 | /* *INDENT-ON* */ 98 | #endif 99 | #include "close_code.h" 100 | 101 | #endif /* _SDL_locale_h */ 102 | 103 | /* vi: set ts=4 sw=4 expandtab: */ 104 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_main.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_main_h_ 23 | #define SDL_main_h_ 24 | 25 | #include "SDL_stdinc.h" 26 | 27 | /** 28 | * \file SDL_main.h 29 | * 30 | * Redefine main() on some platforms so that it is called by SDL. 31 | */ 32 | 33 | #ifndef SDL_MAIN_HANDLED 34 | #if defined(__WIN32__) 35 | /* On Windows SDL provides WinMain(), which parses the command line and passes 36 | the arguments to your main function. 37 | 38 | If you provide your own WinMain(), you may define SDL_MAIN_HANDLED 39 | */ 40 | #define SDL_MAIN_AVAILABLE 41 | 42 | #elif defined(__WINRT__) 43 | /* On WinRT, SDL provides a main function that initializes CoreApplication, 44 | creating an instance of IFrameworkView in the process. 45 | 46 | Please note that #include'ing SDL_main.h is not enough to get a main() 47 | function working. In non-XAML apps, the file, 48 | src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled 49 | into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be 50 | called, with a pointer to the Direct3D-hosted XAML control passed in. 51 | */ 52 | #define SDL_MAIN_NEEDED 53 | 54 | #elif defined(__IPHONEOS__) 55 | /* On iOS SDL provides a main function that creates an application delegate 56 | and starts the iOS application run loop. 57 | 58 | If you link with SDL dynamically on iOS, the main function can't be in a 59 | shared library, so you need to link with libSDLmain.a, which includes a 60 | stub main function that calls into the shared library to start execution. 61 | 62 | See src/video/uikit/SDL_uikitappdelegate.m for more details. 63 | */ 64 | #define SDL_MAIN_NEEDED 65 | 66 | #elif defined(__ANDROID__) 67 | /* On Android SDL provides a Java class in SDLActivity.java that is the 68 | main activity entry point. 69 | 70 | See docs/README-android.md for more details on extending that class. 71 | */ 72 | #define SDL_MAIN_NEEDED 73 | 74 | /* We need to export SDL_main so it can be launched from Java */ 75 | #define SDLMAIN_DECLSPEC DECLSPEC 76 | 77 | #elif defined(__NACL__) 78 | /* On NACL we use ppapi_simple to set up the application helper code, 79 | then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before 80 | starting the user main function. 81 | All user code is run in a separate thread by ppapi_simple, thus 82 | allowing for blocking io to take place via nacl_io 83 | */ 84 | #define SDL_MAIN_NEEDED 85 | 86 | #elif defined(__PSP__) 87 | /* On PSP SDL provides a main function that sets the module info, 88 | activates the GPU and starts the thread required to be able to exit 89 | the software. 90 | 91 | If you provide this yourself, you may define SDL_MAIN_HANDLED 92 | */ 93 | #define SDL_MAIN_AVAILABLE 94 | 95 | #endif 96 | #endif /* SDL_MAIN_HANDLED */ 97 | 98 | #ifndef SDLMAIN_DECLSPEC 99 | #define SDLMAIN_DECLSPEC 100 | #endif 101 | 102 | /** 103 | * \file SDL_main.h 104 | * 105 | * The application's main() function must be called with C linkage, 106 | * and should be declared like this: 107 | * \code 108 | * #ifdef __cplusplus 109 | * extern "C" 110 | * #endif 111 | * int main(int argc, char *argv[]) 112 | * { 113 | * } 114 | * \endcode 115 | */ 116 | 117 | #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) 118 | #define main SDL_main 119 | #endif 120 | 121 | #include "begin_code.h" 122 | #ifdef __cplusplus 123 | extern "C" { 124 | #endif 125 | 126 | /** 127 | * The prototype for the application's main() function 128 | */ 129 | typedef int (*SDL_main_func)(int argc, char *argv[]); 130 | extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); 131 | 132 | 133 | /** 134 | * Circumvent failure of SDL_Init() when not using SDL_main() as an entry 135 | * point. 136 | * 137 | * This function is defined in SDL_main.h, along with the preprocessor rule to 138 | * redefine main() as SDL_main(). Thus to ensure that your main() function 139 | * will not be changed it is necessary to define SDL_MAIN_HANDLED before 140 | * including SDL.h. 141 | * 142 | * \since This function is available since SDL 2.0.0. 143 | * 144 | * \sa SDL_Init 145 | */ 146 | extern DECLSPEC void SDLCALL SDL_SetMainReady(void); 147 | 148 | #ifdef __WIN32__ 149 | 150 | /** 151 | * Register a win32 window class for SDL's use. 152 | * 153 | * This can be called to set the application window class at startup. It is 154 | * safe to call this multiple times, as long as every call is eventually 155 | * paired with a call to SDL_UnregisterApp, but a second registration attempt 156 | * while a previous registration is still active will be ignored, other than 157 | * to increment a counter. 158 | * 159 | * Most applications do not need to, and should not, call this directly; SDL 160 | * will call it when initializing the video subsystem. 161 | * 162 | * \param name the window class name, in UTF-8 encoding. If NULL, SDL 163 | * currently uses "SDL_app" but this isn't guaranteed. 164 | * \param style the value to use in WNDCLASSEX::style. If `name` is NULL, SDL 165 | * currently uses `(CS_BYTEALIGNCLIENT | CS_OWNDC)` regardless of 166 | * what is specified here. 167 | * \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL 168 | * will use `GetModuleHandle(NULL)` instead. 169 | * \returns 0 on success, -1 on error. SDL_GetError() may have details. 170 | * 171 | * \since This function is available since SDL 2.0.2. 172 | */ 173 | extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); 174 | 175 | /** 176 | * Deregister the win32 window class from an SDL_RegisterApp call. 177 | * 178 | * This can be called to undo the effects of SDL_RegisterApp. 179 | * 180 | * Most applications do not need to, and should not, call this directly; SDL 181 | * will call it when deinitializing the video subsystem. 182 | * 183 | * It is safe to call this multiple times, as long as every call is eventually 184 | * paired with a prior call to SDL_RegisterApp. The window class will only be 185 | * deregistered when the registration counter in SDL_RegisterApp decrements to 186 | * zero through calls to this function. 187 | * 188 | * \since This function is available since SDL 2.0.2. 189 | */ 190 | extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); 191 | 192 | #endif /* __WIN32__ */ 193 | 194 | 195 | #ifdef __WINRT__ 196 | 197 | /** 198 | * Initialize and launch an SDL/WinRT application. 199 | * 200 | * \param mainFunction the SDL app's C-style main(), an SDL_main_func 201 | * \param reserved reserved for future use; should be NULL 202 | * \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve 203 | * more information on the failure. 204 | * 205 | * \since This function is available since SDL 2.0.3. 206 | */ 207 | extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved); 208 | 209 | #endif /* __WINRT__ */ 210 | 211 | #if defined(__IPHONEOS__) 212 | 213 | /** 214 | * Initializes and launches an SDL application. 215 | * 216 | * \param argc The argc parameter from the application's main() function 217 | * \param argv The argv parameter from the application's main() function 218 | * \param mainFunction The SDL app's C-style main(), an SDL_main_func 219 | * \return the return value from mainFunction 220 | * 221 | * \since This function is available since SDL 2.0.10. 222 | */ 223 | extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction); 224 | 225 | #endif /* __IPHONEOS__ */ 226 | 227 | 228 | #ifdef __cplusplus 229 | } 230 | #endif 231 | #include "close_code.h" 232 | 233 | #endif /* SDL_main_h_ */ 234 | 235 | /* vi: set ts=4 sw=4 expandtab: */ 236 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_messagebox.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_messagebox_h_ 23 | #define SDL_messagebox_h_ 24 | 25 | #include "SDL_stdinc.h" 26 | #include "SDL_video.h" /* For SDL_Window */ 27 | 28 | #include "begin_code.h" 29 | /* Set up for C function definitions, even when using C++ */ 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /** 35 | * SDL_MessageBox flags. If supported will display warning icon, etc. 36 | */ 37 | typedef enum 38 | { 39 | SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ 40 | SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ 41 | SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */ 42 | SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, /**< buttons placed left to right */ 43 | SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100 /**< buttons placed right to left */ 44 | } SDL_MessageBoxFlags; 45 | 46 | /** 47 | * Flags for SDL_MessageBoxButtonData. 48 | */ 49 | typedef enum 50 | { 51 | SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ 52 | SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ 53 | } SDL_MessageBoxButtonFlags; 54 | 55 | /** 56 | * Individual button data. 57 | */ 58 | typedef struct 59 | { 60 | Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ 61 | int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ 62 | const char * text; /**< The UTF-8 button text */ 63 | } SDL_MessageBoxButtonData; 64 | 65 | /** 66 | * RGB value used in a message box color scheme 67 | */ 68 | typedef struct 69 | { 70 | Uint8 r, g, b; 71 | } SDL_MessageBoxColor; 72 | 73 | typedef enum 74 | { 75 | SDL_MESSAGEBOX_COLOR_BACKGROUND, 76 | SDL_MESSAGEBOX_COLOR_TEXT, 77 | SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, 78 | SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, 79 | SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, 80 | SDL_MESSAGEBOX_COLOR_MAX 81 | } SDL_MessageBoxColorType; 82 | 83 | /** 84 | * A set of colors to use for message box dialogs 85 | */ 86 | typedef struct 87 | { 88 | SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; 89 | } SDL_MessageBoxColorScheme; 90 | 91 | /** 92 | * MessageBox structure containing title, text, window, etc. 93 | */ 94 | typedef struct 95 | { 96 | Uint32 flags; /**< ::SDL_MessageBoxFlags */ 97 | SDL_Window *window; /**< Parent window, can be NULL */ 98 | const char *title; /**< UTF-8 title */ 99 | const char *message; /**< UTF-8 message text */ 100 | 101 | int numbuttons; 102 | const SDL_MessageBoxButtonData *buttons; 103 | 104 | const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */ 105 | } SDL_MessageBoxData; 106 | 107 | /** 108 | * Create a modal message box. 109 | * 110 | * If your needs aren't complex, it might be easier to use 111 | * SDL_ShowSimpleMessageBox. 112 | * 113 | * This function should be called on the thread that created the parent 114 | * window, or on the main thread if the messagebox has no parent. It will 115 | * block execution of that thread until the user clicks a button or closes the 116 | * messagebox. 117 | * 118 | * This function may be called at any time, even before SDL_Init(). This makes 119 | * it useful for reporting errors like a failure to create a renderer or 120 | * OpenGL context. 121 | * 122 | * On X11, SDL rolls its own dialog box with X11 primitives instead of a 123 | * formal toolkit like GTK+ or Qt. 124 | * 125 | * Note that if SDL_Init() would fail because there isn't any available video 126 | * target, this function is likely to fail for the same reasons. If this is a 127 | * concern, check the return value from this function and fall back to writing 128 | * to stderr if you can. 129 | * 130 | * \param messageboxdata the SDL_MessageBoxData structure with title, text and 131 | * other options 132 | * \param buttonid the pointer to which user id of hit button should be copied 133 | * \returns 0 on success or a negative error code on failure; call 134 | * SDL_GetError() for more information. 135 | * 136 | * \since This function is available since SDL 2.0.0. 137 | * 138 | * \sa SDL_ShowSimpleMessageBox 139 | */ 140 | extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); 141 | 142 | /** 143 | * Display a simple modal message box. 144 | * 145 | * If your needs aren't complex, this function is preferred over 146 | * SDL_ShowMessageBox. 147 | * 148 | * `flags` may be any of the following: 149 | * 150 | * - `SDL_MESSAGEBOX_ERROR`: error dialog 151 | * - `SDL_MESSAGEBOX_WARNING`: warning dialog 152 | * - `SDL_MESSAGEBOX_INFORMATION`: informational dialog 153 | * 154 | * This function should be called on the thread that created the parent 155 | * window, or on the main thread if the messagebox has no parent. It will 156 | * block execution of that thread until the user clicks a button or closes the 157 | * messagebox. 158 | * 159 | * This function may be called at any time, even before SDL_Init(). This makes 160 | * it useful for reporting errors like a failure to create a renderer or 161 | * OpenGL context. 162 | * 163 | * On X11, SDL rolls its own dialog box with X11 primitives instead of a 164 | * formal toolkit like GTK+ or Qt. 165 | * 166 | * Note that if SDL_Init() would fail because there isn't any available video 167 | * target, this function is likely to fail for the same reasons. If this is a 168 | * concern, check the return value from this function and fall back to writing 169 | * to stderr if you can. 170 | * 171 | * \param flags an SDL_MessageBoxFlags value 172 | * \param title UTF-8 title text 173 | * \param message UTF-8 message text 174 | * \param window the parent window, or NULL for no parent 175 | * \returns 0 on success or a negative error code on failure; call 176 | * SDL_GetError() for more information. 177 | * 178 | * \since This function is available since SDL 2.0.0. 179 | * 180 | * \sa SDL_ShowMessageBox 181 | */ 182 | extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); 183 | 184 | 185 | /* Ends C function definitions when using C++ */ 186 | #ifdef __cplusplus 187 | } 188 | #endif 189 | #include "close_code.h" 190 | 191 | #endif /* SDL_messagebox_h_ */ 192 | 193 | /* vi: set ts=4 sw=4 expandtab: */ 194 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_metal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_metal.h 24 | * 25 | * Header file for functions to creating Metal layers and views on SDL windows. 26 | */ 27 | 28 | #ifndef SDL_metal_h_ 29 | #define SDL_metal_h_ 30 | 31 | #include "SDL_video.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). 41 | * 42 | * \note This can be cast directly to an NSView or UIView. 43 | */ 44 | typedef void *SDL_MetalView; 45 | 46 | /** 47 | * \name Metal support functions 48 | */ 49 | /* @{ */ 50 | 51 | /** 52 | * Create a CAMetalLayer-backed NSView/UIView and attach it to the specified 53 | * window. 54 | * 55 | * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on 56 | * its own. It is up to user code to do that. 57 | * 58 | * The returned handle can be casted directly to a NSView or UIView. To access 59 | * the backing CAMetalLayer, call SDL_Metal_GetLayer(). 60 | * 61 | * \since This function is available since SDL 2.0.12. 62 | * 63 | * \sa SDL_Metal_DestroyView 64 | * \sa SDL_Metal_GetLayer 65 | */ 66 | extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window); 67 | 68 | /** 69 | * Destroy an existing SDL_MetalView object. 70 | * 71 | * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was 72 | * called after SDL_CreateWindow. 73 | * 74 | * \since This function is available since SDL 2.0.12. 75 | * 76 | * \sa SDL_Metal_CreateView 77 | */ 78 | extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); 79 | 80 | /** 81 | * Get a pointer to the backing CAMetalLayer for the given view. 82 | * 83 | * \since This function is available since SDL 2.0.14. 84 | * 85 | * \sa SDL_MetalCreateView 86 | */ 87 | extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); 88 | 89 | /** 90 | * Get the size of a window's underlying drawable in pixels (for use with 91 | * setting viewport, scissor & etc). 92 | * 93 | * \param window SDL_Window from which the drawable size should be queried 94 | * \param w Pointer to variable for storing the width in pixels, may be NULL 95 | * 96 | * \since This function is available since SDL 2.0.14. 97 | * 98 | * \sa SDL_GetWindowSize 99 | * \sa SDL_CreateWindow 100 | */ 101 | extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w, 102 | int *h); 103 | 104 | /* @} *//* Metal support functions */ 105 | 106 | /* Ends C function definitions when using C++ */ 107 | #ifdef __cplusplus 108 | } 109 | #endif 110 | #include "close_code.h" 111 | 112 | #endif /* SDL_metal_h_ */ 113 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_misc.h 24 | * 25 | * \brief Include file for SDL API functions that don't fit elsewhere. 26 | */ 27 | 28 | #ifndef SDL_misc_h_ 29 | #define SDL_misc_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * Open a URL/URI in the browser or other appropriate external application. 42 | * 43 | * Open a URL in a separate, system-provided application. How this works will 44 | * vary wildly depending on the platform. This will likely launch what makes 45 | * sense to handle a specific URL's protocol (a web browser for `http://`, 46 | * etc), but it might also be able to launch file managers for directories and 47 | * other things. 48 | * 49 | * What happens when you open a URL varies wildly as well: your game window 50 | * may lose focus (and may or may not lose focus if your game was fullscreen 51 | * or grabbing input at the time). On mobile devices, your app will likely 52 | * move to the background or your process might be paused. Any given platform 53 | * may or may not handle a given URL. 54 | * 55 | * If this is unimplemented (or simply unavailable) for a platform, this will 56 | * fail with an error. A successful result does not mean the URL loaded, just 57 | * that we launched _something_ to handle it (or at least believe we did). 58 | * 59 | * All this to say: this function can be useful, but you should definitely 60 | * test it on every platform you target. 61 | * 62 | * \param url A valid URL/URI to open. Use `file:///full/path/to/file` for 63 | * local files, if supported. 64 | * \returns 0 on success, or -1 on error; call SDL_GetError() for more 65 | * information. 66 | * 67 | * \since This function is available since SDL 2.0.14. 68 | */ 69 | extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url); 70 | 71 | /* Ends C function definitions when using C++ */ 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | #include "close_code.h" 76 | 77 | #endif /* SDL_misc_h_ */ 78 | 79 | /* vi: set ts=4 sw=4 expandtab: */ 80 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDLname_h_ 23 | #define SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef APIENTRY 38 | #define APIENTRY 39 | #endif 40 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) 30 | 31 | #ifdef __IPHONEOS__ 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #include 38 | #endif 39 | 40 | #else /* _MSC_VER */ 41 | 42 | /* OpenGL ES2 headers for Visual Studio */ 43 | #include "SDL_opengles2_khrplatform.h" 44 | #include "SDL_opengles2_gl2platform.h" 45 | #include "SDL_opengles2_gl2.h" 46 | #include "SDL_opengles2_gl2ext.h" 47 | 48 | #endif /* _MSC_VER */ 49 | 50 | #ifndef APIENTRY 51 | #define APIENTRY GL_APIENTRY 52 | #endif 53 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | /*#include */ 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_platform.h 24 | * 25 | * Try to get a standard set of platform defines. 26 | */ 27 | 28 | #ifndef SDL_platform_h_ 29 | #define SDL_platform_h_ 30 | 31 | #if defined(_AIX) 32 | #undef __AIX__ 33 | #define __AIX__ 1 34 | #endif 35 | #if defined(__HAIKU__) 36 | #undef __HAIKU__ 37 | #define __HAIKU__ 1 38 | #endif 39 | #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) 40 | #undef __BSDI__ 41 | #define __BSDI__ 1 42 | #endif 43 | #if defined(_arch_dreamcast) 44 | #undef __DREAMCAST__ 45 | #define __DREAMCAST__ 1 46 | #endif 47 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 48 | #undef __FREEBSD__ 49 | #define __FREEBSD__ 1 50 | #endif 51 | #if defined(hpux) || defined(__hpux) || defined(__hpux__) 52 | #undef __HPUX__ 53 | #define __HPUX__ 1 54 | #endif 55 | #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) 56 | #undef __IRIX__ 57 | #define __IRIX__ 1 58 | #endif 59 | #if (defined(linux) || defined(__linux) || defined(__linux__)) 60 | #undef __LINUX__ 61 | #define __LINUX__ 1 62 | #endif 63 | #if defined(ANDROID) || defined(__ANDROID__) 64 | #undef __ANDROID__ 65 | #undef __LINUX__ /* do we need to do this? */ 66 | #define __ANDROID__ 1 67 | #endif 68 | 69 | #if defined(__APPLE__) 70 | /* lets us know what version of Mac OS X we're compiling on */ 71 | #include "AvailabilityMacros.h" 72 | #include "TargetConditionals.h" 73 | 74 | /* Fix building with older SDKs that don't define these 75 | See this for more information: 76 | https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets 77 | */ 78 | #ifndef TARGET_OS_MACCATALYST 79 | #define TARGET_OS_MACCATALYST 0 80 | #endif 81 | #ifndef TARGET_OS_IOS 82 | #define TARGET_OS_IOS 0 83 | #endif 84 | #ifndef TARGET_OS_IPHONE 85 | #define TARGET_OS_IPHONE 0 86 | #endif 87 | #ifndef TARGET_OS_TV 88 | #define TARGET_OS_TV 0 89 | #endif 90 | #ifndef TARGET_OS_SIMULATOR 91 | #define TARGET_OS_SIMULATOR 0 92 | #endif 93 | 94 | #if TARGET_OS_TV 95 | #undef __TVOS__ 96 | #define __TVOS__ 1 97 | #endif 98 | #if TARGET_OS_IPHONE 99 | /* if compiling for iOS */ 100 | #undef __IPHONEOS__ 101 | #define __IPHONEOS__ 1 102 | #undef __MACOSX__ 103 | #else 104 | /* if not compiling for iOS */ 105 | #undef __MACOSX__ 106 | #define __MACOSX__ 1 107 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 108 | # error SDL for Mac OS X only supports deploying on 10.6 and above. 109 | #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ 110 | #endif /* TARGET_OS_IPHONE */ 111 | #endif /* defined(__APPLE__) */ 112 | 113 | #if defined(__NetBSD__) 114 | #undef __NETBSD__ 115 | #define __NETBSD__ 1 116 | #endif 117 | #if defined(__OpenBSD__) 118 | #undef __OPENBSD__ 119 | #define __OPENBSD__ 1 120 | #endif 121 | #if defined(__OS2__) || defined(__EMX__) 122 | #undef __OS2__ 123 | #define __OS2__ 1 124 | #endif 125 | #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) 126 | #undef __OSF__ 127 | #define __OSF__ 1 128 | #endif 129 | #if defined(__QNXNTO__) 130 | #undef __QNXNTO__ 131 | #define __QNXNTO__ 1 132 | #endif 133 | #if defined(riscos) || defined(__riscos) || defined(__riscos__) 134 | #undef __RISCOS__ 135 | #define __RISCOS__ 1 136 | #endif 137 | #if defined(__sun) && defined(__SVR4) 138 | #undef __SOLARIS__ 139 | #define __SOLARIS__ 1 140 | #endif 141 | 142 | #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) 143 | /* Try to find out if we're compiling for WinRT or non-WinRT */ 144 | #if defined(_MSC_VER) && defined(__has_include) 145 | #if __has_include() 146 | #define HAVE_WINAPIFAMILY_H 1 147 | #else 148 | #define HAVE_WINAPIFAMILY_H 0 149 | #endif 150 | 151 | /* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ 152 | #elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ 153 | #define HAVE_WINAPIFAMILY_H 1 154 | #else 155 | #define HAVE_WINAPIFAMILY_H 0 156 | #endif 157 | 158 | #if HAVE_WINAPIFAMILY_H 159 | #include 160 | #define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)) 161 | #else 162 | #define WINAPI_FAMILY_WINRT 0 163 | #endif /* HAVE_WINAPIFAMILY_H */ 164 | 165 | #if WINAPI_FAMILY_WINRT 166 | #undef __WINRT__ 167 | #define __WINRT__ 1 168 | #else 169 | #undef __WINDOWS__ 170 | #define __WINDOWS__ 1 171 | #endif 172 | #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */ 173 | 174 | #if defined(__WINDOWS__) 175 | #undef __WIN32__ 176 | #define __WIN32__ 1 177 | #endif 178 | #if defined(__PSP__) 179 | #undef __PSP__ 180 | #define __PSP__ 1 181 | #endif 182 | 183 | /* The NACL compiler defines __native_client__ and __pnacl__ 184 | * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi 185 | */ 186 | #if defined(__native_client__) 187 | #undef __LINUX__ 188 | #undef __NACL__ 189 | #define __NACL__ 1 190 | #endif 191 | #if defined(__pnacl__) 192 | #undef __LINUX__ 193 | #undef __PNACL__ 194 | #define __PNACL__ 1 195 | /* PNACL with newlib supports static linking only */ 196 | #define __SDL_NOGETPROCADDR__ 197 | #endif 198 | 199 | #if defined(__vita__) 200 | #define __VITA__ 1 201 | #endif 202 | 203 | #include "begin_code.h" 204 | /* Set up for C function definitions, even when using C++ */ 205 | #ifdef __cplusplus 206 | extern "C" { 207 | #endif 208 | 209 | /** 210 | * Get the name of the platform. 211 | * 212 | * Here are the names returned for some (but not all) supported platforms: 213 | * 214 | * - "Windows" 215 | * - "Mac OS X" 216 | * - "Linux" 217 | * - "iOS" 218 | * - "Android" 219 | * 220 | * \returns the name of the platform. If the correct platform name is not 221 | * available, returns a string beginning with the text "Unknown". 222 | * 223 | * \since This function is available since SDL 2.0.0. 224 | */ 225 | extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); 226 | 227 | /* Ends C function definitions when using C++ */ 228 | #ifdef __cplusplus 229 | } 230 | #endif 231 | #include "close_code.h" 232 | 233 | #endif /* SDL_platform_h_ */ 234 | 235 | /* vi: set ts=4 sw=4 expandtab: */ 236 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_power.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_power_h_ 23 | #define SDL_power_h_ 24 | 25 | /** 26 | * \file SDL_power.h 27 | * 28 | * Header for the SDL power management routines. 29 | */ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * The basic state for the system's power supply. 41 | */ 42 | typedef enum 43 | { 44 | SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ 45 | SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ 46 | SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ 47 | SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ 48 | SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ 49 | } SDL_PowerState; 50 | 51 | 52 | /** 53 | * Get the current power supply details. 54 | * 55 | * You should never take a battery status as absolute truth. Batteries 56 | * (especially failing batteries) are delicate hardware, and the values 57 | * reported here are best estimates based on what that hardware reports. It's 58 | * not uncommon for older batteries to lose stored power much faster than it 59 | * reports, or completely drain when reporting it has 20 percent left, etc. 60 | * 61 | * Battery status can change at any time; if you are concerned with power 62 | * state, you should call this function frequently, and perhaps ignore changes 63 | * until they seem to be stable for a few seconds. 64 | * 65 | * It's possible a platform can only report battery percentage or time left 66 | * but not both. 67 | * 68 | * \param secs seconds of battery life left, you can pass a NULL here if you 69 | * don't care, will return -1 if we can't determine a value, or 70 | * we're not running on a battery 71 | * \param pct percentage of battery life left, between 0 and 100, you can pass 72 | * a NULL here if you don't care, will return -1 if we can't 73 | * determine a value, or we're not running on a battery 74 | * \returns an SDL_PowerState enum representing the current battery state. 75 | * 76 | * \since This function is available since SDL 2.0.0. 77 | */ 78 | extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); 79 | 80 | /* Ends C function definitions when using C++ */ 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | #include "close_code.h" 85 | 86 | #endif /* SDL_power_h_ */ 87 | 88 | /* vi: set ts=4 sw=4 expandtab: */ 89 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_quit.h 24 | * 25 | * Include file for SDL quit event handling. 26 | */ 27 | 28 | #ifndef SDL_quit_h_ 29 | #define SDL_quit_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | /** 35 | * \file SDL_quit.h 36 | * 37 | * An ::SDL_QUIT event is generated when the user tries to close the application 38 | * window. If it is ignored or filtered out, the window will remain open. 39 | * If it is not ignored or filtered, it is queued normally and the window 40 | * is allowed to close. When the window is closed, screen updates will 41 | * complete, but have no effect. 42 | * 43 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 44 | * and SIGTERM (system termination request), if handlers do not already 45 | * exist, that generate ::SDL_QUIT events as well. There is no way 46 | * to determine the cause of an ::SDL_QUIT event, but setting a signal 47 | * handler in your application will override the default generation of 48 | * quit events for that signal. 49 | * 50 | * \sa SDL_Quit() 51 | */ 52 | 53 | /* There are no functions directly affecting the quit event */ 54 | 55 | #define SDL_QuitRequested() \ 56 | (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) 57 | 58 | #endif /* SDL_quit_h_ */ 59 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_rect.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_rect.h 24 | * 25 | * Header file for SDL_rect definition and management functions. 26 | */ 27 | 28 | #ifndef SDL_rect_h_ 29 | #define SDL_rect_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_pixels.h" 34 | #include "SDL_rwops.h" 35 | 36 | #include "begin_code.h" 37 | /* Set up for C function definitions, even when using C++ */ 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /** 43 | * The structure that defines a point (integer) 44 | * 45 | * \sa SDL_EnclosePoints 46 | * \sa SDL_PointInRect 47 | */ 48 | typedef struct SDL_Point 49 | { 50 | int x; 51 | int y; 52 | } SDL_Point; 53 | 54 | /** 55 | * The structure that defines a point (floating point) 56 | * 57 | * \sa SDL_EnclosePoints 58 | * \sa SDL_PointInRect 59 | */ 60 | typedef struct SDL_FPoint 61 | { 62 | float x; 63 | float y; 64 | } SDL_FPoint; 65 | 66 | 67 | /** 68 | * A rectangle, with the origin at the upper left (integer). 69 | * 70 | * \sa SDL_RectEmpty 71 | * \sa SDL_RectEquals 72 | * \sa SDL_HasIntersection 73 | * \sa SDL_IntersectRect 74 | * \sa SDL_UnionRect 75 | * \sa SDL_EnclosePoints 76 | */ 77 | typedef struct SDL_Rect 78 | { 79 | int x, y; 80 | int w, h; 81 | } SDL_Rect; 82 | 83 | 84 | /** 85 | * A rectangle, with the origin at the upper left (floating point). 86 | */ 87 | typedef struct SDL_FRect 88 | { 89 | float x; 90 | float y; 91 | float w; 92 | float h; 93 | } SDL_FRect; 94 | 95 | 96 | /** 97 | * Returns true if point resides inside a rectangle. 98 | */ 99 | SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) 100 | { 101 | return ( (p->x >= r->x) && (p->x < (r->x + r->w)) && 102 | (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; 103 | } 104 | 105 | /** 106 | * Returns true if the rectangle has no area. 107 | */ 108 | SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) 109 | { 110 | return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE; 111 | } 112 | 113 | /** 114 | * Returns true if the two rectangles are equal. 115 | */ 116 | SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b) 117 | { 118 | return (a && b && (a->x == b->x) && (a->y == b->y) && 119 | (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE; 120 | } 121 | 122 | /** 123 | * Determine whether two rectangles intersect. 124 | * 125 | * If either pointer is NULL the function will return SDL_FALSE. 126 | * 127 | * \param A an SDL_Rect structure representing the first rectangle 128 | * \param B an SDL_Rect structure representing the second rectangle 129 | * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. 130 | * 131 | * \since This function is available since SDL 2.0.0. 132 | * 133 | * \sa SDL_IntersectRect 134 | */ 135 | extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, 136 | const SDL_Rect * B); 137 | 138 | /** 139 | * Calculate the intersection of two rectangles. 140 | * 141 | * If `result` is NULL then this function will return SDL_FALSE. 142 | * 143 | * \param A an SDL_Rect structure representing the first rectangle 144 | * \param B an SDL_Rect structure representing the second rectangle 145 | * \param result an SDL_Rect structure filled in with the intersection of 146 | * rectangles `A` and `B` 147 | * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. 148 | * 149 | * \since This function is available since SDL 2.0.0. 150 | * 151 | * \sa SDL_HasIntersection 152 | */ 153 | extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, 154 | const SDL_Rect * B, 155 | SDL_Rect * result); 156 | 157 | /** 158 | * Calculate the union of two rectangles. 159 | * 160 | * \param A an SDL_Rect structure representing the first rectangle 161 | * \param B an SDL_Rect structure representing the second rectangle 162 | * \param result an SDL_Rect structure filled in with the union of rectangles 163 | * `A` and `B` 164 | * 165 | * \since This function is available since SDL 2.0.0. 166 | */ 167 | extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, 168 | const SDL_Rect * B, 169 | SDL_Rect * result); 170 | 171 | /** 172 | * Calculate a minimal rectangle enclosing a set of points. 173 | * 174 | * If `clip` is not NULL then only points inside of the clipping rectangle are 175 | * considered. 176 | * 177 | * \param points an array of SDL_Point structures representing points to be 178 | * enclosed 179 | * \param count the number of structures in the `points` array 180 | * \param clip an SDL_Rect used for clipping or NULL to enclose all points 181 | * \param result an SDL_Rect structure filled in with the minimal enclosing 182 | * rectangle 183 | * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the 184 | * points were outside of the clipping rectangle. 185 | * 186 | * \since This function is available since SDL 2.0.0. 187 | */ 188 | extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, 189 | int count, 190 | const SDL_Rect * clip, 191 | SDL_Rect * result); 192 | 193 | /** 194 | * Calculate the intersection of a rectangle and line segment. 195 | * 196 | * This function is used to clip a line segment to a rectangle. A line segment 197 | * contained entirely within the rectangle or that does not intersect will 198 | * remain unchanged. A line segment that crosses the rectangle at either or 199 | * both ends will be clipped to the boundary of the rectangle and the new 200 | * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. 201 | * 202 | * \param rect an SDL_Rect structure representing the rectangle to intersect 203 | * \param X1 a pointer to the starting X-coordinate of the line 204 | * \param Y1 a pointer to the starting Y-coordinate of the line 205 | * \param X2 a pointer to the ending X-coordinate of the line 206 | * \param Y2 a pointer to the ending Y-coordinate of the line 207 | * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. 208 | * 209 | * \since This function is available since SDL 2.0.0. 210 | */ 211 | extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * 212 | rect, int *X1, 213 | int *Y1, int *X2, 214 | int *Y2); 215 | 216 | /* Ends C function definitions when using C++ */ 217 | #ifdef __cplusplus 218 | } 219 | #endif 220 | #include "close_code.h" 221 | 222 | #endif /* SDL_rect_h_ */ 223 | 224 | /* vi: set ts=4 sw=4 expandtab: */ 225 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_revision.h: -------------------------------------------------------------------------------- 1 | #define SDL_REVISION "https://github.com/libsdl-org/SDL.git@b424665e0899769b200231ba943353a5fee1b6b6" 2 | #define SDL_REVISION_NUMBER 0 3 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_shape.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_shape_h_ 23 | #define SDL_shape_h_ 24 | 25 | #include "SDL_stdinc.h" 26 | #include "SDL_pixels.h" 27 | #include "SDL_rect.h" 28 | #include "SDL_surface.h" 29 | #include "SDL_video.h" 30 | 31 | #include "begin_code.h" 32 | /* Set up for C function definitions, even when using C++ */ 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /** \file SDL_shape.h 38 | * 39 | * Header file for the shaped window API. 40 | */ 41 | 42 | #define SDL_NONSHAPEABLE_WINDOW -1 43 | #define SDL_INVALID_SHAPE_ARGUMENT -2 44 | #define SDL_WINDOW_LACKS_SHAPE -3 45 | 46 | /** 47 | * Create a window that can be shaped with the specified position, dimensions, 48 | * and flags. 49 | * 50 | * \param title The title of the window, in UTF-8 encoding. 51 | * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or 52 | * ::SDL_WINDOWPOS_UNDEFINED. 53 | * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or 54 | * ::SDL_WINDOWPOS_UNDEFINED. 55 | * \param w The width of the window. 56 | * \param h The height of the window. 57 | * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with 58 | * any of the following: ::SDL_WINDOW_OPENGL, 59 | * ::SDL_WINDOW_INPUT_GRABBED, ::SDL_WINDOW_HIDDEN, 60 | * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, 61 | * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_BORDERLESS is always set, 62 | * and ::SDL_WINDOW_FULLSCREEN is always unset. 63 | * \return the window created, or NULL if window creation failed. 64 | * 65 | * \since This function is available since SDL 2.0.0. 66 | * 67 | * \sa SDL_DestroyWindow 68 | */ 69 | extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); 70 | 71 | /** 72 | * Return whether the given window is a shaped window. 73 | * 74 | * \param window The window to query for being shaped. 75 | * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if 76 | * the window is unshaped or NULL. 77 | * 78 | * \since This function is available since SDL 2.0.0. 79 | * 80 | * \sa SDL_CreateShapedWindow 81 | */ 82 | extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window); 83 | 84 | /** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */ 85 | typedef enum { 86 | /** \brief The default mode, a binarized alpha cutoff of 1. */ 87 | ShapeModeDefault, 88 | /** \brief A binarized alpha cutoff with a given integer value. */ 89 | ShapeModeBinarizeAlpha, 90 | /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */ 91 | ShapeModeReverseBinarizeAlpha, 92 | /** \brief A color key is applied. */ 93 | ShapeModeColorKey 94 | } WindowShapeMode; 95 | 96 | #define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha) 97 | 98 | /** \brief A union containing parameters for shaped windows. */ 99 | typedef union { 100 | /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */ 101 | Uint8 binarizationCutoff; 102 | SDL_Color colorKey; 103 | } SDL_WindowShapeParams; 104 | 105 | /** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */ 106 | typedef struct SDL_WindowShapeMode { 107 | /** \brief The mode of these window-shape parameters. */ 108 | WindowShapeMode mode; 109 | /** \brief Window-shape parameters. */ 110 | SDL_WindowShapeParams parameters; 111 | } SDL_WindowShapeMode; 112 | 113 | /** 114 | * Set the shape and parameters of a shaped window. 115 | * 116 | * \param window The shaped window whose parameters should be set. 117 | * \param shape A surface encoding the desired shape for the window. 118 | * \param shape_mode The parameters to set for the shaped window. 119 | * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape 120 | * argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does 121 | * not reference a valid shaped window. 122 | * 123 | * \since This function is available since SDL 2.0.0. 124 | * 125 | * \sa SDL_WindowShapeMode 126 | * \sa SDL_GetShapedWindowMode 127 | */ 128 | extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); 129 | 130 | /** 131 | * Get the shape parameters of a shaped window. 132 | * 133 | * \param window The shaped window whose parameters should be retrieved. 134 | * \param shape_mode An empty shape-mode structure to fill, or NULL to check 135 | * whether the window has a shape. 136 | * \return 0 if the window has a shape and, provided shape_mode was not NULL, 137 | * shape_mode has been filled with the mode data, 138 | * SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped 139 | * window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a 140 | * shapeable window currently lacking a shape. 141 | * 142 | * \since This function is available since SDL 2.0.0. 143 | * 144 | * \sa SDL_WindowShapeMode 145 | * \sa SDL_SetWindowShape 146 | */ 147 | extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode); 148 | 149 | /* Ends C function definitions when using C++ */ 150 | #ifdef __cplusplus 151 | } 152 | #endif 153 | #include "close_code.h" 154 | 155 | #endif /* SDL_shape_h_ */ 156 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_h_ 31 | #define SDL_test_h_ 32 | 33 | #include "SDL.h" 34 | #include "SDL_test_assert.h" 35 | #include "SDL_test_common.h" 36 | #include "SDL_test_compare.h" 37 | #include "SDL_test_crc32.h" 38 | #include "SDL_test_font.h" 39 | #include "SDL_test_fuzzer.h" 40 | #include "SDL_test_harness.h" 41 | #include "SDL_test_images.h" 42 | #include "SDL_test_log.h" 43 | #include "SDL_test_md5.h" 44 | #include "SDL_test_memory.h" 45 | #include "SDL_test_random.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /* Global definitions */ 54 | 55 | /* 56 | * Note: Maximum size of SDLTest log message is less than SDL's limit 57 | * to ensure we can fit additional information such as the timestamp. 58 | */ 59 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test_assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_assert.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Assert API for test code and test cases 33 | * 34 | */ 35 | 36 | #ifndef SDL_test_assert_h_ 37 | #define SDL_test_assert_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Fails the assert. 47 | */ 48 | #define ASSERT_FAIL 0 49 | 50 | /** 51 | * \brief Passes the assert. 52 | */ 53 | #define ASSERT_PASS 1 54 | 55 | /** 56 | * \brief Assert that logs and break execution flow on failures. 57 | * 58 | * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). 59 | * \param assertDescription Message to log with the assert describing it. 60 | */ 61 | void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); 62 | 63 | /** 64 | * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. 65 | * 66 | * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). 67 | * \param assertDescription Message to log with the assert describing it. 68 | * 69 | * \returns the assertCondition so it can be used to externally to break execution flow if desired. 70 | */ 71 | int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); 72 | 73 | /** 74 | * \brief Explicitly pass without checking an assertion condition. Updates assertion counter. 75 | * 76 | * \param assertDescription Message to log with the assert describing it. 77 | */ 78 | void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1); 79 | 80 | /** 81 | * \brief Resets the assert summary counters to zero. 82 | */ 83 | void SDLTest_ResetAssertSummary(void); 84 | 85 | /** 86 | * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. 87 | */ 88 | void SDLTest_LogAssertSummary(void); 89 | 90 | 91 | /** 92 | * \brief Converts the current assert summary state to a test result. 93 | * 94 | * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT 95 | */ 96 | int SDLTest_AssertSummaryToTestResult(void); 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | #include "close_code.h" 102 | 103 | #endif /* SDL_test_assert_h_ */ 104 | 105 | /* vi: set ts=4 sw=4 expandtab: */ 106 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_common.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* Ported from original test\common.h file. */ 31 | 32 | #ifndef SDL_test_common_h_ 33 | #define SDL_test_common_h_ 34 | 35 | #include "SDL.h" 36 | 37 | #if defined(__PSP__) 38 | #define DEFAULT_WINDOW_WIDTH 480 39 | #define DEFAULT_WINDOW_HEIGHT 272 40 | #elif defined(__VITA__) 41 | #define DEFAULT_WINDOW_WIDTH 960 42 | #define DEFAULT_WINDOW_HEIGHT 544 43 | #else 44 | #define DEFAULT_WINDOW_WIDTH 640 45 | #define DEFAULT_WINDOW_HEIGHT 480 46 | #endif 47 | 48 | #define VERBOSE_VIDEO 0x00000001 49 | #define VERBOSE_MODES 0x00000002 50 | #define VERBOSE_RENDER 0x00000004 51 | #define VERBOSE_EVENT 0x00000008 52 | #define VERBOSE_AUDIO 0x00000010 53 | 54 | typedef struct 55 | { 56 | /* SDL init flags */ 57 | char **argv; 58 | Uint32 flags; 59 | Uint32 verbose; 60 | 61 | /* Video info */ 62 | const char *videodriver; 63 | int display; 64 | const char *window_title; 65 | const char *window_icon; 66 | Uint32 window_flags; 67 | SDL_bool flash_on_focus_loss; 68 | int window_x; 69 | int window_y; 70 | int window_w; 71 | int window_h; 72 | int window_minW; 73 | int window_minH; 74 | int window_maxW; 75 | int window_maxH; 76 | int logical_w; 77 | int logical_h; 78 | float scale; 79 | int depth; 80 | int refresh_rate; 81 | int num_windows; 82 | SDL_Window **windows; 83 | 84 | /* Renderer info */ 85 | const char *renderdriver; 86 | Uint32 render_flags; 87 | SDL_bool skip_renderer; 88 | SDL_Renderer **renderers; 89 | SDL_Texture **targets; 90 | 91 | /* Audio info */ 92 | const char *audiodriver; 93 | SDL_AudioSpec audiospec; 94 | 95 | /* GL settings */ 96 | int gl_red_size; 97 | int gl_green_size; 98 | int gl_blue_size; 99 | int gl_alpha_size; 100 | int gl_buffer_size; 101 | int gl_depth_size; 102 | int gl_stencil_size; 103 | int gl_double_buffer; 104 | int gl_accum_red_size; 105 | int gl_accum_green_size; 106 | int gl_accum_blue_size; 107 | int gl_accum_alpha_size; 108 | int gl_stereo; 109 | int gl_multisamplebuffers; 110 | int gl_multisamplesamples; 111 | int gl_retained_backing; 112 | int gl_accelerated; 113 | int gl_major_version; 114 | int gl_minor_version; 115 | int gl_debug; 116 | int gl_profile_mask; 117 | 118 | /* Additional fields added in 2.0.18 */ 119 | SDL_Rect confine; 120 | 121 | } SDLTest_CommonState; 122 | 123 | #include "begin_code.h" 124 | /* Set up for C function definitions, even when using C++ */ 125 | #ifdef __cplusplus 126 | extern "C" { 127 | #endif 128 | 129 | /* Function prototypes */ 130 | 131 | /** 132 | * \brief Parse command line parameters and create common state. 133 | * 134 | * \param argv Array of command line parameters 135 | * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO) 136 | * 137 | * \returns a newly allocated common state object. 138 | */ 139 | SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags); 140 | 141 | /** 142 | * \brief Process one common argument. 143 | * 144 | * \param state The common state describing the test window to create. 145 | * \param index The index of the argument to process in argv[]. 146 | * 147 | * \returns the number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error. 148 | */ 149 | int SDLTest_CommonArg(SDLTest_CommonState * state, int index); 150 | 151 | 152 | /** 153 | * \brief Logs command line usage info. 154 | * 155 | * This logs the appropriate command line options for the subsystems in use 156 | * plus other common options, and then any application-specific options. 157 | * This uses the SDL_Log() function and splits up output to be friendly to 158 | * 80-character-wide terminals. 159 | * 160 | * \param state The common state describing the test window for the app. 161 | * \param argv0 argv[0], as passed to main/SDL_main. 162 | * \param options an array of strings for application specific options. The last element of the array should be NULL. 163 | */ 164 | void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options); 165 | 166 | /** 167 | * \brief Returns common usage information 168 | * 169 | * You should (probably) be using SDLTest_CommonLogUsage() instead, but this 170 | * function remains for binary compatibility. Strings returned from this 171 | * function are valid until SDLTest_CommonQuit() is called, in which case 172 | * those strings' memory is freed and can no longer be used. 173 | * 174 | * \param state The common state describing the test window to create. 175 | * \returns a string with usage information 176 | */ 177 | const char *SDLTest_CommonUsage(SDLTest_CommonState * state); 178 | 179 | /** 180 | * \brief Open test window. 181 | * 182 | * \param state The common state describing the test window to create. 183 | * 184 | * \returns SDL_TRUE if initialization succeeded, false otherwise 185 | */ 186 | SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state); 187 | 188 | /** 189 | * \brief Easy argument handling when test app doesn't need any custom args. 190 | * 191 | * \param state The common state describing the test window to create. 192 | * \param argc argc, as supplied to SDL_main 193 | * \param argv argv, as supplied to SDL_main 194 | * 195 | * \returns SDL_FALSE if app should quit, true otherwise. 196 | */ 197 | SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc, char **argv); 198 | 199 | /** 200 | * \brief Common event handler for test windows. 201 | * 202 | * \param state The common state used to create test window. 203 | * \param event The event to handle. 204 | * \param done Flag indicating we are done. 205 | * 206 | */ 207 | void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done); 208 | 209 | /** 210 | * \brief Close test window. 211 | * 212 | * \param state The common state used to create test window. 213 | * 214 | */ 215 | void SDLTest_CommonQuit(SDLTest_CommonState * state); 216 | 217 | /** 218 | * \brief Draws various window information (position, size, etc.) to the renderer. 219 | * 220 | * \param renderer The renderer to draw to. 221 | * \param window The window whose information should be displayed. 222 | * \param usedHeight Returns the height used, so the caller can draw more below. 223 | * 224 | */ 225 | void SDLTest_CommonDrawWindowInfo(SDL_Renderer * renderer, SDL_Window * window, int * usedHeight); 226 | 227 | /* Ends C function definitions when using C++ */ 228 | #ifdef __cplusplus 229 | } 230 | #endif 231 | #include "close_code.h" 232 | 233 | #endif /* SDL_test_common_h_ */ 234 | 235 | /* vi: set ts=4 sw=4 expandtab: */ 236 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test_compare.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_compare.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines comparison functions (i.e. for surfaces). 33 | 34 | */ 35 | 36 | #ifndef SDL_test_compare_h_ 37 | #define SDL_test_compare_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "SDL_test_images.h" 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * \brief Compares a surface and with reference image data for equality 51 | * 52 | * \param surface Surface used in comparison 53 | * \param referenceSurface Test Surface used in comparison 54 | * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. 55 | * 56 | * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. 57 | */ 58 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); 59 | 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_compare_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test_crc32.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_crc32.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Implements CRC32 calculations (default output is Perl String::CRC32 compatible). 33 | 34 | */ 35 | 36 | #ifndef SDL_test_crc32_h_ 37 | #define SDL_test_crc32_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | 46 | /* ------------ Definitions --------- */ 47 | 48 | /* Definition shared by all CRC routines */ 49 | 50 | #ifndef CrcUint32 51 | #define CrcUint32 unsigned int 52 | #endif 53 | #ifndef CrcUint8 54 | #define CrcUint8 unsigned char 55 | #endif 56 | 57 | #ifdef ORIGINAL_METHOD 58 | #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */ 59 | #else 60 | #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */ 61 | #endif 62 | 63 | /** 64 | * Data structure for CRC32 (checksum) computation 65 | */ 66 | typedef struct { 67 | CrcUint32 crc32_table[256]; /* CRC table */ 68 | } SDLTest_Crc32Context; 69 | 70 | /* ---------- Function Prototypes ------------- */ 71 | 72 | /** 73 | * \brief Initialize the CRC context 74 | * 75 | * Note: The function initializes the crc table required for all crc calculations. 76 | * 77 | * \param crcContext pointer to context variable 78 | * 79 | * \returns 0 for OK, -1 on error 80 | * 81 | */ 82 | int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext); 83 | 84 | 85 | /** 86 | * \brief calculate a crc32 from a data block 87 | * 88 | * \param crcContext pointer to context variable 89 | * \param inBuf input buffer to checksum 90 | * \param inLen length of input buffer 91 | * \param crc32 pointer to Uint32 to store the final CRC into 92 | * 93 | * \returns 0 for OK, -1 on error 94 | * 95 | */ 96 | int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); 97 | 98 | /* Same routine broken down into three steps */ 99 | int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); 100 | int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); 101 | int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); 102 | 103 | 104 | /** 105 | * \brief clean up CRC context 106 | * 107 | * \param crcContext pointer to context variable 108 | * 109 | * \returns 0 for OK, -1 on error 110 | * 111 | */ 112 | 113 | int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); 114 | 115 | 116 | /* Ends C function definitions when using C++ */ 117 | #ifdef __cplusplus 118 | } 119 | #endif 120 | #include "close_code.h" 121 | 122 | #endif /* SDL_test_crc32_h_ */ 123 | 124 | /* vi: set ts=4 sw=4 expandtab: */ 125 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test_font.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_font.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_font_h_ 31 | #define SDL_test_font_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | #define FONT_CHARACTER_SIZE 8 42 | 43 | /** 44 | * \brief Draw a string in the currently set font. 45 | * 46 | * \param renderer The renderer to draw on. 47 | * \param x The X coordinate of the upper left corner of the character. 48 | * \param y The Y coordinate of the upper left corner of the character. 49 | * \param c The character to draw. 50 | * 51 | * \returns 0 on success, -1 on failure. 52 | */ 53 | int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c); 54 | 55 | /** 56 | * \brief Draw a string in the currently set font. 57 | * 58 | * \param renderer The renderer to draw on. 59 | * \param x The X coordinate of the upper left corner of the string. 60 | * \param y The Y coordinate of the upper left corner of the string. 61 | * \param s The string to draw. 62 | * 63 | * \returns 0 on success, -1 on failure. 64 | */ 65 | int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s); 66 | 67 | 68 | /** 69 | * \brief Cleanup textures used by font drawing functions. 70 | */ 71 | void SDLTest_CleanupTextDrawing(void); 72 | 73 | /* Ends C function definitions when using C++ */ 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | #include "close_code.h" 78 | 79 | #endif /* SDL_test_font_h_ */ 80 | 81 | /* vi: set ts=4 sw=4 expandtab: */ 82 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test_harness.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_harness.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | Defines types for test case definitions and the test execution harness API. 32 | 33 | Based on original GSOC code by Markus Kauppila 34 | */ 35 | 36 | #ifndef SDL_test_h_arness_h 37 | #define SDL_test_h_arness_h 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | 46 | /* ! Definitions for test case structures */ 47 | #define TEST_ENABLED 1 48 | #define TEST_DISABLED 0 49 | 50 | /* ! Definition of all the possible test return values of the test case method */ 51 | #define TEST_ABORTED -1 52 | #define TEST_STARTED 0 53 | #define TEST_COMPLETED 1 54 | #define TEST_SKIPPED 2 55 | 56 | /* ! Definition of all the possible test results for the harness */ 57 | #define TEST_RESULT_PASSED 0 58 | #define TEST_RESULT_FAILED 1 59 | #define TEST_RESULT_NO_ASSERT 2 60 | #define TEST_RESULT_SKIPPED 3 61 | #define TEST_RESULT_SETUP_FAILURE 4 62 | 63 | /* !< Function pointer to a test case setup function (run before every test) */ 64 | typedef void (*SDLTest_TestCaseSetUpFp)(void *arg); 65 | 66 | /* !< Function pointer to a test case function */ 67 | typedef int (*SDLTest_TestCaseFp)(void *arg); 68 | 69 | /* !< Function pointer to a test case teardown function (run after every test) */ 70 | typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); 71 | 72 | /** 73 | * Holds information about a single test case. 74 | */ 75 | typedef struct SDLTest_TestCaseReference { 76 | /* !< Func2Stress */ 77 | SDLTest_TestCaseFp testCase; 78 | /* !< Short name (or function name) "Func2Stress" */ 79 | const char *name; 80 | /* !< Long name or full description "This test pushes func2() to the limit." */ 81 | const char *description; 82 | /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */ 83 | int enabled; 84 | } SDLTest_TestCaseReference; 85 | 86 | /** 87 | * Holds information about a test suite (multiple test cases). 88 | */ 89 | typedef struct SDLTest_TestSuiteReference { 90 | /* !< "PlatformSuite" */ 91 | const char *name; 92 | /* !< The function that is run before each test. NULL skips. */ 93 | SDLTest_TestCaseSetUpFp testSetUp; 94 | /* !< The test cases that are run as part of the suite. Last item should be NULL. */ 95 | const SDLTest_TestCaseReference **testCases; 96 | /* !< The function that is run after each test. NULL skips. */ 97 | SDLTest_TestCaseTearDownFp testTearDown; 98 | } SDLTest_TestSuiteReference; 99 | 100 | 101 | /** 102 | * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z). 103 | * 104 | * Note: The returned string needs to be deallocated by the caller. 105 | * 106 | * \param length The length of the seed string to generate 107 | * 108 | * \returns the generated seed string 109 | */ 110 | char *SDLTest_GenerateRunSeed(const int length); 111 | 112 | /** 113 | * \brief Execute a test suite using the given run seed and execution key. 114 | * 115 | * \param testSuites Suites containing the test case. 116 | * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one. 117 | * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. 118 | * \param filter Filter specification. NULL disables. Case sensitive. 119 | * \param testIterations Number of iterations to run each test case. 120 | * 121 | * \returns the test run result: 0 when all tests passed, 1 if any tests failed. 122 | */ 123 | int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations); 124 | 125 | 126 | /* Ends C function definitions when using C++ */ 127 | #ifdef __cplusplus 128 | } 129 | #endif 130 | #include "close_code.h" 131 | 132 | #endif /* SDL_test_h_arness_h */ 133 | 134 | /* vi: set ts=4 sw=4 expandtab: */ 135 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test_images.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_images.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines some images for tests. 33 | 34 | */ 35 | 36 | #ifndef SDL_test_images_h_ 37 | #define SDL_test_images_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "begin_code.h" 42 | /* Set up for C function definitions, even when using C++ */ 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /** 48 | *Type for test images. 49 | */ 50 | typedef struct SDLTest_SurfaceImage_s { 51 | int width; 52 | int height; 53 | unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ 54 | const char *pixel_data; 55 | } SDLTest_SurfaceImage_t; 56 | 57 | /* Test images */ 58 | SDL_Surface *SDLTest_ImageBlit(void); 59 | SDL_Surface *SDLTest_ImageBlitColor(void); 60 | SDL_Surface *SDLTest_ImageBlitAlpha(void); 61 | SDL_Surface *SDLTest_ImageBlitBlendAdd(void); 62 | SDL_Surface *SDLTest_ImageBlitBlend(void); 63 | SDL_Surface *SDLTest_ImageBlitBlendMod(void); 64 | SDL_Surface *SDLTest_ImageBlitBlendNone(void); 65 | SDL_Surface *SDLTest_ImageBlitBlendAll(void); 66 | SDL_Surface *SDLTest_ImageFace(void); 67 | SDL_Surface *SDLTest_ImagePrimitives(void); 68 | SDL_Surface *SDLTest_ImagePrimitivesBlend(void); 69 | 70 | /* Ends C function definitions when using C++ */ 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | #include "close_code.h" 75 | 76 | #endif /* SDL_test_images_h_ */ 77 | 78 | /* vi: set ts=4 sw=4 expandtab: */ 79 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test_log.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_log.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Wrapper to log in the TEST category 33 | * 34 | */ 35 | 36 | #ifndef SDL_test_log_h_ 37 | #define SDL_test_log_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority. 47 | * 48 | * \param fmt Message to be logged 49 | */ 50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 51 | 52 | /** 53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. 54 | * 55 | * \param fmt Message to be logged 56 | */ 57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 58 | 59 | /* Ends C function definitions when using C++ */ 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #include "close_code.h" 64 | 65 | #endif /* SDL_test_log_h_ */ 66 | 67 | /* vi: set ts=4 sw=4 expandtab: */ 68 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test_md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_md5.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | *********************************************************************** 32 | ** Header file for implementation of MD5 ** 33 | ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** 34 | ** Created: 2/17/90 RLR ** 35 | ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** 36 | ** Revised (for MD5): RLR 4/27/91 ** 37 | ** -- G modified to have y&~z instead of y&z ** 38 | ** -- FF, GG, HH modified to add in last register done ** 39 | ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** 40 | ** -- distinct additive constant for each step ** 41 | ** -- round 4 added, working mod 7 ** 42 | *********************************************************************** 43 | */ 44 | 45 | /* 46 | *********************************************************************** 47 | ** Message-digest routines: ** 48 | ** To form the message digest for a message M ** 49 | ** (1) Initialize a context buffer mdContext using MD5Init ** 50 | ** (2) Call MD5Update on mdContext and M ** 51 | ** (3) Call MD5Final on mdContext ** 52 | ** The message digest is now in mdContext->digest[0...15] ** 53 | *********************************************************************** 54 | */ 55 | 56 | #ifndef SDL_test_md5_h_ 57 | #define SDL_test_md5_h_ 58 | 59 | #include "begin_code.h" 60 | /* Set up for C function definitions, even when using C++ */ 61 | #ifdef __cplusplus 62 | extern "C" { 63 | #endif 64 | 65 | /* ------------ Definitions --------- */ 66 | 67 | /* typedef a 32-bit type */ 68 | typedef unsigned long int MD5UINT4; 69 | 70 | /* Data structure for MD5 (Message-Digest) computation */ 71 | typedef struct { 72 | MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ 73 | MD5UINT4 buf[4]; /* scratch buffer */ 74 | unsigned char in[64]; /* input buffer */ 75 | unsigned char digest[16]; /* actual digest after Md5Final call */ 76 | } SDLTest_Md5Context; 77 | 78 | /* ---------- Function Prototypes ------------- */ 79 | 80 | /** 81 | * \brief initialize the context 82 | * 83 | * \param mdContext pointer to context variable 84 | * 85 | * Note: The function initializes the message-digest context 86 | * mdContext. Call before each new use of the context - 87 | * all fields are set to zero. 88 | */ 89 | void SDLTest_Md5Init(SDLTest_Md5Context * mdContext); 90 | 91 | 92 | /** 93 | * \brief update digest from variable length data 94 | * 95 | * \param mdContext pointer to context variable 96 | * \param inBuf pointer to data array/string 97 | * \param inLen length of data array/string 98 | * 99 | * Note: The function updates the message-digest context to account 100 | * for the presence of each of the characters inBuf[0..inLen-1] 101 | * in the message whose digest is being computed. 102 | */ 103 | 104 | void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf, 105 | unsigned int inLen); 106 | 107 | 108 | /** 109 | * \brief complete digest computation 110 | * 111 | * \param mdContext pointer to context variable 112 | * 113 | * Note: The function terminates the message-digest computation and 114 | * ends with the desired message digest in mdContext.digest[0..15]. 115 | * Always call before using the digest[] variable. 116 | */ 117 | 118 | void SDLTest_Md5Final(SDLTest_Md5Context * mdContext); 119 | 120 | 121 | /* Ends C function definitions when using C++ */ 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | #include "close_code.h" 126 | 127 | #endif /* SDL_test_md5_h_ */ 128 | 129 | /* vi: set ts=4 sw=4 expandtab: */ 130 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_memory.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_memory_h_ 31 | #define SDL_test_memory_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | /** 41 | * \brief Start tracking SDL memory allocations 42 | * 43 | * \note This should be called before any other SDL functions for complete tracking coverage 44 | */ 45 | int SDLTest_TrackAllocations(void); 46 | 47 | /** 48 | * \brief Print a log of any outstanding allocations 49 | * 50 | * \note This can be called after SDL_Quit() 51 | */ 52 | void SDLTest_LogAllocations(void); 53 | 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* SDL_test_memory_h_ */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_test_random.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_random.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | A "32-bit Multiply with carry random number generator. Very fast. 33 | Includes a list of recommended multipliers. 34 | 35 | multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32. 36 | period: (a*2^31)-1 37 | 38 | */ 39 | 40 | #ifndef SDL_test_random_h_ 41 | #define SDL_test_random_h_ 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /* --- Definitions */ 50 | 51 | /* 52 | * Macros that return a random number in a specific format. 53 | */ 54 | #define SDLTest_RandomInt(c) ((int)SDLTest_Random(c)) 55 | 56 | /* 57 | * Context structure for the random number generator state. 58 | */ 59 | typedef struct { 60 | unsigned int a; 61 | unsigned int x; 62 | unsigned int c; 63 | unsigned int ah; 64 | unsigned int al; 65 | } SDLTest_RandomContext; 66 | 67 | 68 | /* --- Function prototypes */ 69 | 70 | /** 71 | * \brief Initialize random number generator with two integers. 72 | * 73 | * Note: The random sequence of numbers returned by ...Random() is the 74 | * same for the same two integers and has a period of 2^31. 75 | * 76 | * \param rndContext pointer to context structure 77 | * \param xi integer that defines the random sequence 78 | * \param ci integer that defines the random sequence 79 | * 80 | */ 81 | void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, 82 | unsigned int ci); 83 | 84 | /** 85 | * \brief Initialize random number generator based on current system time. 86 | * 87 | * \param rndContext pointer to context structure 88 | * 89 | */ 90 | void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext); 91 | 92 | 93 | /** 94 | * \brief Initialize random number generator based on current system time. 95 | * 96 | * Note: ...RandomInit() or ...RandomInitTime() must have been called 97 | * before using this function. 98 | * 99 | * \param rndContext pointer to context structure 100 | * 101 | * \returns a random number (32bit unsigned integer) 102 | * 103 | */ 104 | unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext); 105 | 106 | 107 | /* Ends C function definitions when using C++ */ 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | #include "close_code.h" 112 | 113 | #endif /* SDL_test_random_h_ */ 114 | 115 | /* vi: set ts=4 sw=4 expandtab: */ 116 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_timer_h_ 23 | #define SDL_timer_h_ 24 | 25 | /** 26 | * \file SDL_timer.h 27 | * 28 | * Header for the SDL time management routines. 29 | */ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * Get the number of milliseconds since SDL library initialization. 42 | * 43 | * This value wraps if the program runs for more than ~49 days. 44 | * 45 | * This function is not recommended as of SDL 2.0.18; use SDL_GetTicks64() 46 | * instead, where the value doesn't wrap every ~49 days. There are places in 47 | * SDL where we provide a 32-bit timestamp that can not change without 48 | * breaking binary compatibility, though, so this function isn't officially 49 | * deprecated. 50 | * 51 | * \returns an unsigned 32-bit value representing the number of milliseconds 52 | * since the SDL library initialized. 53 | * 54 | * \since This function is available since SDL 2.0.0. 55 | * 56 | * \sa SDL_TICKS_PASSED 57 | */ 58 | extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); 59 | 60 | /** 61 | * Get the number of milliseconds since SDL library initialization. 62 | * 63 | * Note that you should not use the SDL_TICKS_PASSED macro with values 64 | * returned by this function, as that macro does clever math to compensate for 65 | * the 32-bit overflow every ~49 days that SDL_GetTicks() suffers from. 64-bit 66 | * values from this function can be safely compared directly. 67 | * 68 | * For example, if you want to wait 100 ms, you could do this: 69 | * 70 | * ```c 71 | * const Uint64 timeout = SDL_GetTicks64() + 100; 72 | * while (SDL_GetTicks64() < timeout) { 73 | * // ... do work until timeout has elapsed 74 | * } 75 | * ``` 76 | * 77 | * \returns an unsigned 64-bit value representing the number of milliseconds 78 | * since the SDL library initialized. 79 | * 80 | * \since This function is available since SDL 2.0.18. 81 | */ 82 | extern DECLSPEC Uint64 SDLCALL SDL_GetTicks64(void); 83 | 84 | /** 85 | * Compare 32-bit SDL ticks values, and return true if `A` has passed `B`. 86 | * 87 | * This should be used with results from SDL_GetTicks(), as this macro 88 | * attempts to deal with the 32-bit counter wrapping back to zero every ~49 89 | * days, but should _not_ be used with SDL_GetTicks64(), which does not have 90 | * that problem. 91 | * 92 | * For example, with SDL_GetTicks(), if you want to wait 100 ms, you could 93 | * do this: 94 | * 95 | * ```c 96 | * const Uint32 timeout = SDL_GetTicks() + 100; 97 | * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { 98 | * // ... do work until timeout has elapsed 99 | * } 100 | * ``` 101 | * 102 | * Note that this does not handle tick differences greater 103 | * than 2^31 so take care when using the above kind of code 104 | * with large timeout delays (tens of days). 105 | */ 106 | #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) 107 | 108 | /** 109 | * Get the current value of the high resolution counter. 110 | * 111 | * This function is typically used for profiling. 112 | * 113 | * The counter values are only meaningful relative to each other. Differences 114 | * between values can be converted to times by using 115 | * SDL_GetPerformanceFrequency(). 116 | * 117 | * \returns the current counter value. 118 | * 119 | * \since This function is available since SDL 2.0.0. 120 | * 121 | * \sa SDL_GetPerformanceFrequency 122 | */ 123 | extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void); 124 | 125 | /** 126 | * Get the count per second of the high resolution counter. 127 | * 128 | * \returns a platform-specific count per second. 129 | * 130 | * \since This function is available since SDL 2.0.0. 131 | * 132 | * \sa SDL_GetPerformanceCounter 133 | */ 134 | extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void); 135 | 136 | /** 137 | * Wait a specified number of milliseconds before returning. 138 | * 139 | * This function waits a specified number of milliseconds before returning. It 140 | * waits at least the specified time, but possibly longer due to OS 141 | * scheduling. 142 | * 143 | * \param ms the number of milliseconds to delay 144 | * 145 | * \since This function is available since SDL 2.0.0. 146 | */ 147 | extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); 148 | 149 | /** 150 | * Function prototype for the timer callback function. 151 | * 152 | * The callback function is passed the current timer interval and returns 153 | * the next timer interval. If the returned value is the same as the one 154 | * passed in, the periodic alarm continues, otherwise a new alarm is 155 | * scheduled. If the callback returns 0, the periodic alarm is cancelled. 156 | */ 157 | typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param); 158 | 159 | /** 160 | * Definition of the timer ID type. 161 | */ 162 | typedef int SDL_TimerID; 163 | 164 | /** 165 | * Call a callback function at a future time. 166 | * 167 | * If you use this function, you must pass `SDL_INIT_TIMER` to SDL_Init(). 168 | * 169 | * The callback function is passed the current timer interval and the user 170 | * supplied parameter from the SDL_AddTimer() call and should return the next 171 | * timer interval. If the value returned from the callback is 0, the timer is 172 | * canceled. 173 | * 174 | * The callback is run on a separate thread. 175 | * 176 | * Timers take into account the amount of time it took to execute the 177 | * callback. For example, if the callback took 250 ms to execute and returned 178 | * 1000 (ms), the timer would only wait another 750 ms before its next 179 | * iteration. 180 | * 181 | * Timing may be inexact due to OS scheduling. Be sure to note the current 182 | * time with SDL_GetTicks() or SDL_GetPerformanceCounter() in case your 183 | * callback needs to adjust for variances. 184 | * 185 | * \param interval the timer delay, in milliseconds, passed to `callback` 186 | * \param callback the SDL_TimerCallback function to call when the specified 187 | * `interval` elapses 188 | * \param param a pointer that is passed to `callback` 189 | * \returns a timer ID or 0 if an error occurs; call SDL_GetError() for more 190 | * information. 191 | * 192 | * \since This function is available since SDL 2.0.0. 193 | * 194 | * \sa SDL_RemoveTimer 195 | */ 196 | extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, 197 | SDL_TimerCallback callback, 198 | void *param); 199 | 200 | /** 201 | * Remove a timer created with SDL_AddTimer(). 202 | * 203 | * \param id the ID of the timer to remove 204 | * \returns SDL_TRUE if the timer is removed or SDL_FALSE if the timer wasn't 205 | * found. 206 | * 207 | * \since This function is available since SDL 2.0.0. 208 | * 209 | * \sa SDL_AddTimer 210 | */ 211 | extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); 212 | 213 | 214 | /* Ends C function definitions when using C++ */ 215 | #ifdef __cplusplus 216 | } 217 | #endif 218 | #include "close_code.h" 219 | 220 | #endif /* SDL_timer_h_ */ 221 | 222 | /* vi: set ts=4 sw=4 expandtab: */ 223 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_touch.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_touch.h 24 | * 25 | * Include file for SDL touch event handling. 26 | */ 27 | 28 | #ifndef SDL_touch_h_ 29 | #define SDL_touch_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_video.h" 34 | 35 | #include "begin_code.h" 36 | /* Set up for C function definitions, even when using C++ */ 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | typedef Sint64 SDL_TouchID; 42 | typedef Sint64 SDL_FingerID; 43 | 44 | typedef enum 45 | { 46 | SDL_TOUCH_DEVICE_INVALID = -1, 47 | SDL_TOUCH_DEVICE_DIRECT, /* touch screen with window-relative coordinates */ 48 | SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, /* trackpad with absolute device coordinates */ 49 | SDL_TOUCH_DEVICE_INDIRECT_RELATIVE /* trackpad with screen cursor-relative coordinates */ 50 | } SDL_TouchDeviceType; 51 | 52 | typedef struct SDL_Finger 53 | { 54 | SDL_FingerID id; 55 | float x; 56 | float y; 57 | float pressure; 58 | } SDL_Finger; 59 | 60 | /* Used as the device ID for mouse events simulated with touch input */ 61 | #define SDL_TOUCH_MOUSEID ((Uint32)-1) 62 | 63 | /* Used as the SDL_TouchID for touch events simulated with mouse input */ 64 | #define SDL_MOUSE_TOUCHID ((Sint64)-1) 65 | 66 | 67 | /** 68 | * Get the number of registered touch devices. 69 | * 70 | * On some platforms SDL first sees the touch device if it was actually used. 71 | * Therefore SDL_GetNumTouchDevices() may return 0 although devices are 72 | * available. After using all devices at least once the number will be 73 | * correct. 74 | * 75 | * This was fixed for Android in SDL 2.0.1. 76 | * 77 | * \returns the number of registered touch devices. 78 | * 79 | * \since This function is available since SDL 2.0.0. 80 | * 81 | * \sa SDL_GetTouchDevice 82 | */ 83 | extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void); 84 | 85 | /** 86 | * Get the touch ID with the given index. 87 | * 88 | * \param index the touch device index 89 | * \returns the touch ID with the given index on success or 0 if the index is 90 | * invalid; call SDL_GetError() for more information. 91 | * 92 | * \since This function is available since SDL 2.0.0. 93 | * 94 | * \sa SDL_GetNumTouchDevices 95 | */ 96 | extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); 97 | 98 | /** 99 | * Get the type of the given touch device. 100 | * 101 | * \since This function is available since SDL 2.0.10. 102 | */ 103 | extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID); 104 | 105 | /** 106 | * Get the number of active fingers for a given touch device. 107 | * 108 | * \param touchID the ID of a touch device 109 | * \returns the number of active fingers for a given touch device on success 110 | * or 0 on failure; call SDL_GetError() for more information. 111 | * 112 | * \since This function is available since SDL 2.0.0. 113 | * 114 | * \sa SDL_GetTouchFinger 115 | */ 116 | extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID); 117 | 118 | /** 119 | * Get the finger object for specified touch device ID and finger index. 120 | * 121 | * The returned resource is owned by SDL and should not be deallocated. 122 | * 123 | * \param touchID the ID of the requested touch device 124 | * \param index the index of the requested finger 125 | * \returns a pointer to the SDL_Finger object or NULL if no object at the 126 | * given ID and index could be found. 127 | * 128 | * \since This function is available since SDL 2.0.0. 129 | * 130 | * \sa SDL_RecordGesture 131 | */ 132 | extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index); 133 | 134 | /* Ends C function definitions when using C++ */ 135 | #ifdef __cplusplus 136 | } 137 | #endif 138 | #include "close_code.h" 139 | 140 | #endif /* SDL_touch_h_ */ 141 | 142 | /* vi: set ts=4 sw=4 expandtab: */ 143 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/SDL_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_version.h 24 | * 25 | * This header defines the current SDL version. 26 | */ 27 | 28 | #ifndef SDL_version_h_ 29 | #define SDL_version_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * Information about the version of SDL in use. 41 | * 42 | * Represents the library's version as three levels: major revision 43 | * (increments with massive changes, additions, and enhancements), 44 | * minor revision (increments with backwards-compatible changes to the 45 | * major revision), and patchlevel (increments with fixes to the minor 46 | * revision). 47 | * 48 | * \sa SDL_VERSION 49 | * \sa SDL_GetVersion 50 | */ 51 | typedef struct SDL_version 52 | { 53 | Uint8 major; /**< major version */ 54 | Uint8 minor; /**< minor version */ 55 | Uint8 patch; /**< update version */ 56 | } SDL_version; 57 | 58 | /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL 59 | */ 60 | #define SDL_MAJOR_VERSION 2 61 | #define SDL_MINOR_VERSION 0 62 | #define SDL_PATCHLEVEL 20 63 | 64 | /** 65 | * Macro to determine SDL version program was compiled against. 66 | * 67 | * This macro fills in a SDL_version structure with the version of the 68 | * library you compiled against. This is determined by what header the 69 | * compiler uses. Note that if you dynamically linked the library, you might 70 | * have a slightly newer or older version at runtime. That version can be 71 | * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), 72 | * is not a macro. 73 | * 74 | * \param x A pointer to a SDL_version struct to initialize. 75 | * 76 | * \sa SDL_version 77 | * \sa SDL_GetVersion 78 | */ 79 | #define SDL_VERSION(x) \ 80 | { \ 81 | (x)->major = SDL_MAJOR_VERSION; \ 82 | (x)->minor = SDL_MINOR_VERSION; \ 83 | (x)->patch = SDL_PATCHLEVEL; \ 84 | } 85 | 86 | /** 87 | * This macro turns the version numbers into a numeric value: 88 | * \verbatim 89 | (1,2,3) -> (1203) 90 | \endverbatim 91 | * 92 | * This assumes that there will never be more than 100 patchlevels. 93 | */ 94 | #define SDL_VERSIONNUM(X, Y, Z) \ 95 | ((X)*1000 + (Y)*100 + (Z)) 96 | 97 | /** 98 | * This is the version number macro for the current SDL version. 99 | */ 100 | #define SDL_COMPILEDVERSION \ 101 | SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) 102 | 103 | /** 104 | * This macro will evaluate to true if compiled with SDL at least X.Y.Z. 105 | */ 106 | #define SDL_VERSION_ATLEAST(X, Y, Z) \ 107 | (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) 108 | 109 | /** 110 | * Get the version of SDL that is linked against your program. 111 | * 112 | * If you are linking to SDL dynamically, then it is possible that the current 113 | * version will be different than the version you compiled against. This 114 | * function returns the current version, while SDL_VERSION() is a macro that 115 | * tells you what version you compiled with. 116 | * 117 | * This function may be called safely at any time, even before SDL_Init(). 118 | * 119 | * \param ver the SDL_version structure that contains the version information 120 | * 121 | * \since This function is available since SDL 2.0.0. 122 | * 123 | * \sa SDL_GetRevision 124 | */ 125 | extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); 126 | 127 | /** 128 | * Get the code revision of SDL that is linked against your program. 129 | * 130 | * This value is the revision of the code you are linked with and may be 131 | * different from the code you are compiling with, which is found in the 132 | * constant SDL_REVISION. 133 | * 134 | * The revision is arbitrary string (a hash value) uniquely identifying the 135 | * exact revision of the SDL library in use, and is only useful in comparing 136 | * against other revisions. It is NOT an incrementing number. 137 | * 138 | * If SDL wasn't built from a git repository with the appropriate tools, this 139 | * will return an empty string. 140 | * 141 | * Prior to SDL 2.0.16, before development moved to GitHub, this returned a 142 | * hash for a Mercurial repository. 143 | * 144 | * You shouldn't use this function for anything but logging it for debugging 145 | * purposes. The string is not intended to be reliable in any way. 146 | * 147 | * \returns an arbitrary string, uniquely identifying the exact revision of 148 | * the SDL library in use. 149 | * 150 | * \since This function is available since SDL 2.0.0. 151 | * 152 | * \sa SDL_GetVersion 153 | */ 154 | extern DECLSPEC const char *SDLCALL SDL_GetRevision(void); 155 | 156 | /** 157 | * Obsolete function, do not use. 158 | * 159 | * When SDL was hosted in a Mercurial repository, and was built carefully, 160 | * this would return the revision number that the build was created from. This 161 | * number was not reliable for several reasons, but more importantly, SDL is 162 | * now hosted in a git repository, which does not offer numbers at all, only 163 | * hashes. This function only ever returns zero now. Don't use it. 164 | * 165 | * Before SDL 2.0.16, this might have returned an unreliable, but non-zero 166 | * number. 167 | * 168 | * \deprecated Use SDL_GetRevision() instead; if SDL was carefully built, it 169 | * will return a git hash. 170 | * 171 | * \returns zero, always, in modern SDL releases. 172 | * 173 | * \since This function is available since SDL 2.0.0. 174 | * 175 | * \sa SDL_GetRevision 176 | */ 177 | extern SDL_DEPRECATED DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); 178 | 179 | 180 | /* Ends C function definitions when using C++ */ 181 | #ifdef __cplusplus 182 | } 183 | #endif 184 | #include "close_code.h" 185 | 186 | #endif /* SDL_version_h_ */ 187 | 188 | /* vi: set ts=4 sw=4 expandtab: */ 189 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/begin_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file begin_code.h 24 | * 25 | * This file sets things up for C dynamic library function definitions, 26 | * static inlined functions, and structures aligned at 4-byte alignment. 27 | * If you don't like ugly C preprocessor code, don't look at this file. :) 28 | */ 29 | 30 | /* This shouldn't be nested -- included it around code only. */ 31 | #ifdef _begin_code_h 32 | #error Nested inclusion of begin_code.h 33 | #endif 34 | #define _begin_code_h 35 | 36 | #ifndef SDL_DEPRECATED 37 | # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ 38 | # define SDL_DEPRECATED __attribute__((deprecated)) 39 | # else 40 | # define SDL_DEPRECATED 41 | # endif 42 | #endif 43 | 44 | #ifndef SDL_UNUSED 45 | # ifdef __GNUC__ 46 | # define SDL_UNUSED __attribute__((unused)) 47 | # else 48 | # define SDL_UNUSED 49 | # endif 50 | #endif 51 | 52 | /* Some compilers use a special export keyword */ 53 | #ifndef DECLSPEC 54 | # if defined(__WIN32__) || defined(__WINRT__) || defined(__CYGWIN__) 55 | # ifdef DLL_EXPORT 56 | # define DECLSPEC __declspec(dllexport) 57 | # else 58 | # define DECLSPEC 59 | # endif 60 | # elif defined(__OS2__) 61 | # ifdef BUILD_SDL 62 | # define DECLSPEC __declspec(dllexport) 63 | # else 64 | # define DECLSPEC 65 | # endif 66 | # else 67 | # if defined(__GNUC__) && __GNUC__ >= 4 68 | # define DECLSPEC __attribute__ ((visibility("default"))) 69 | # else 70 | # define DECLSPEC 71 | # endif 72 | # endif 73 | #endif 74 | 75 | /* By default SDL uses the C calling convention */ 76 | #ifndef SDLCALL 77 | #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) 78 | #define SDLCALL __cdecl 79 | #elif defined(__OS2__) || defined(__EMX__) 80 | #define SDLCALL _System 81 | # if defined (__GNUC__) && !defined(_System) 82 | # define _System /* for old EMX/GCC compat. */ 83 | # endif 84 | #else 85 | #define SDLCALL 86 | #endif 87 | #endif /* SDLCALL */ 88 | 89 | /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ 90 | #ifdef __SYMBIAN32__ 91 | #undef DECLSPEC 92 | #define DECLSPEC 93 | #endif /* __SYMBIAN32__ */ 94 | 95 | /* Force structure packing at 4 byte alignment. 96 | This is necessary if the header is included in code which has structure 97 | packing set to an alternate value, say for loading structures from disk. 98 | The packing is reset to the previous value in close_code.h 99 | */ 100 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 101 | #ifdef _MSC_VER 102 | #pragma warning(disable: 4103) 103 | #endif 104 | #ifdef __clang__ 105 | #pragma clang diagnostic ignored "-Wpragma-pack" 106 | #endif 107 | #ifdef __BORLANDC__ 108 | #pragma nopackwarning 109 | #endif 110 | #ifdef _M_X64 111 | /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ 112 | #pragma pack(push,8) 113 | #else 114 | #pragma pack(push,4) 115 | #endif 116 | #endif /* Compiler needs structure packing set */ 117 | 118 | #ifndef SDL_INLINE 119 | #if defined(__GNUC__) 120 | #define SDL_INLINE __inline__ 121 | #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ 122 | defined(__DMC__) || defined(__SC__) || \ 123 | defined(__WATCOMC__) || defined(__LCC__) || \ 124 | defined(__DECC) || defined(__CC_ARM) 125 | #define SDL_INLINE __inline 126 | #ifndef __inline__ 127 | #define __inline__ __inline 128 | #endif 129 | #else 130 | #define SDL_INLINE inline 131 | #ifndef __inline__ 132 | #define __inline__ inline 133 | #endif 134 | #endif 135 | #endif /* SDL_INLINE not defined */ 136 | 137 | #ifndef SDL_FORCE_INLINE 138 | #if defined(_MSC_VER) 139 | #define SDL_FORCE_INLINE __forceinline 140 | #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) 141 | #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ 142 | #else 143 | #define SDL_FORCE_INLINE static SDL_INLINE 144 | #endif 145 | #endif /* SDL_FORCE_INLINE not defined */ 146 | 147 | #ifndef SDL_NORETURN 148 | #if defined(__GNUC__) 149 | #define SDL_NORETURN __attribute__((noreturn)) 150 | #elif defined(_MSC_VER) 151 | #define SDL_NORETURN __declspec(noreturn) 152 | #else 153 | #define SDL_NORETURN 154 | #endif 155 | #endif /* SDL_NORETURN not defined */ 156 | 157 | /* Apparently this is needed by several Windows compilers */ 158 | #if !defined(__MACH__) 159 | #ifndef NULL 160 | #ifdef __cplusplus 161 | #define NULL 0 162 | #else 163 | #define NULL ((void *)0) 164 | #endif 165 | #endif /* NULL */ 166 | #endif /* ! Mac OS X - breaks precompiled headers */ 167 | 168 | #ifndef SDL_FALLTHROUGH 169 | #if (defined(__cplusplus) && __cplusplus >= 201703L) || \ 170 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L) 171 | #define SDL_FALLTHROUGH [[fallthrough]] 172 | #else 173 | #if defined(__has_attribute) 174 | #define _HAS_FALLTHROUGH __has_attribute(__fallthrough__) 175 | #else 176 | #define _HAS_FALLTHROUGH 0 177 | #endif /* __has_attribute */ 178 | #if _HAS_FALLTHROUGH && \ 179 | ((defined(__GNUC__) && __GNUC__ >= 7) || \ 180 | (defined(__clang_major__) && __clang_major__ >= 10)) 181 | #define SDL_FALLTHROUGH __attribute__((__fallthrough__)) 182 | #else 183 | #define SDL_FALLTHROUGH do {} while (0) /* fallthrough */ 184 | #endif /* _HAS_FALLTHROUGH */ 185 | #undef _HAS_FALLTHROUGH 186 | #endif /* C++17 or C2x */ 187 | #endif /* SDL_FALLTHROUGH not defined */ 188 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/include/SDL2/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #ifndef _begin_code_h 30 | #error close_code.h included without matching begin_code.h 31 | #endif 32 | #undef _begin_code_h 33 | 34 | /* Reset structure packing at previous byte alignment */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #pragma pack(pop) 40 | #endif /* Compiler needs structure packing set */ 41 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/cmake/SDL2/sdl2-config-version.cmake: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "2.0.20") 2 | 3 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 4 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 5 | else() 6 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 7 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 8 | set(PACKAGE_VERSION_EXACT TRUE) 9 | endif() 10 | endif() 11 | 12 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/cmake/SDL2/sdl2-config.cmake: -------------------------------------------------------------------------------- 1 | # sdl2 cmake project-config input for ./configure scripts 2 | 3 | set(prefix "/opt/local/i686-w64-mingw32") 4 | set(exec_prefix "${prefix}") 5 | set(libdir "${exec_prefix}/lib") 6 | set(includedir "${prefix}/include") 7 | set(SDL2_PREFIX "${prefix}") 8 | set(SDL2_EXEC_PREFIX "${exec_prefix}") 9 | set(SDL2_LIBDIR "${libdir}") 10 | set(SDL2_INCLUDE_DIRS "${includedir}/SDL2") 11 | set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -lSDL2 -mwindows") 12 | string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) 13 | 14 | if(NOT TARGET SDL2::SDL2) 15 | # provide SDL2::SDL2, SDL2::SDL2main and SDL2::SDL2-static targets, like SDL2Config.cmake does, for compatibility 16 | 17 | # Remove -lSDL2 as that is handled by CMake, note the space at the end so it does not replace e.g. -lSDL2main 18 | # This may require "libdir" beeing set (from above) 19 | string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS " -lmingw32 -lSDL2main -lSDL2 -mwindows ") 20 | # also get rid of -lSDL2main, if you want to link against that use both SDL2::SDL2main and SDL2::SDL2 (in that order) 21 | # (SDL2Config.cmake has the same behavior) 22 | string(REPLACE "-lSDL2main" "" SDL2_EXTRA_LINK_FLAGS ${SDL2_EXTRA_LINK_FLAGS}) 23 | string(STRIP "${SDL2_EXTRA_LINK_FLAGS}" SDL2_EXTRA_LINK_FLAGS) 24 | string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC " -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid ") 25 | string(STRIP "${SDL2_EXTRA_LINK_FLAGS_STATIC}" SDL2_EXTRA_LINK_FLAGS_STATIC) 26 | 27 | if(WIN32 AND NOT MSVC) 28 | # MINGW needs very special handling, because the link order must be exactly -lmingw32 -lSDL2main -lSDL2 29 | # for it to work at all (and -mwindows somewhere); a normal SHARED IMPORTED or STATIC IMPORTED library always puts itself first 30 | # so handle this like a header-only lib and put everything in INTERFACE_LINK_LIBRARIES 31 | 32 | add_library(SDL2::SDL2 INTERFACE IMPORTED) 33 | set_target_properties(SDL2::SDL2 PROPERTIES 34 | INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" 35 | INTERFACE_LINK_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2") 36 | 37 | add_library(SDL2::SDL2main INTERFACE IMPORTED) 38 | set_target_properties(SDL2::SDL2main PROPERTIES 39 | INTERFACE_LINK_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -mwindows") 40 | 41 | else() # (not WIN32) or MSVC 42 | 43 | add_library(SDL2::SDL2 SHARED IMPORTED) 44 | set_target_properties(SDL2::SDL2 PROPERTIES 45 | INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" 46 | IMPORTED_LINK_INTERFACE_LANGUAGES "C" 47 | IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}") 48 | 49 | if(MSVC) 50 | # This file is generated when building SDL2 with autotools and MinGW, and MinGW/dlltool 51 | # isn't able to generate .lib files that are usable by recent MSVC versions 52 | # (something about "module unsafe for SAFESEH"; SAFESEH is enabled by default in MSVC). 53 | # The .lib file for SDL2.dll *could* be generated with `gendef SDL2.dll` and then 54 | # `lib.exe /machine:x86 /def:SDL2.def /out:SDL2.lib` (or /machine:amd64) 55 | # but that requires lib.exe from a Visual Studio installation - and that still doesn't 56 | # give you a static SDL2main.lib with SAFESEH support that you'll need (unless you don't use SDL2main) 57 | # Note that when building SDL2 with CMake and MSVC, the result works with both MinGW and MSVC. 58 | 59 | message(FATAL_ERROR, "This build of libSDL2 only supports MinGW, not MSVC (Visual C++), because it lacks .lib files!") 60 | # MSVC needs SDL2.lib set as IMPORTED_IMPLIB to link against (comment out message() call above if you added SDL2.lib yourself) 61 | set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_IMPLIB "${SDL2_LIBDIR}/SDL2.lib") 62 | else() 63 | # this mustn't be set for MSVC, so do it here in an extra call here 64 | set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") 65 | endif() 66 | 67 | add_library(SDL2::SDL2main STATIC IMPORTED) 68 | set_target_properties(SDL2::SDL2main PROPERTIES 69 | IMPORTED_LINK_INTERFACE_LANGUAGES "C" 70 | IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}") 71 | 72 | endif() # (not WIN32) or MSVC 73 | 74 | add_library(SDL2::SDL2-static STATIC IMPORTED) 75 | set_target_properties(SDL2::SDL2-static PROPERTIES 76 | INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" 77 | IMPORTED_LINK_INTERFACE_LANGUAGES "C" 78 | IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}" 79 | INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS_STATIC}") 80 | 81 | endif() # NOT TARGET SDL2::SDL2 82 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/libSDL2.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/libSDL2.a -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/libSDL2.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/libSDL2.dll.a -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/libSDL2.la: -------------------------------------------------------------------------------- 1 | # libSDL2.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='../bin/SDL2.dll' 9 | 10 | # Names of this library. 11 | library_names='libSDL2.dll.a' 12 | 13 | # The name of the static archive. 14 | old_library='libSDL2.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libSDL2. 26 | current=18 27 | age=18 28 | revision=2 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/Users/valve/release/SDL/SDL2-2.0.20/i686-w64-mingw32/lib' 42 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/libSDL2_test.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/libSDL2_test.a -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/libSDL2_test.la: -------------------------------------------------------------------------------- 1 | # libSDL2_test.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='' 9 | 10 | # Names of this library. 11 | library_names='' 12 | 13 | # The name of the static archive. 14 | old_library='libSDL2_test.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs='' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libSDL2_test. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/Users/valve/release/SDL/SDL2-2.0.20/i686-w64-mingw32/lib' 42 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/libSDL2main.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/libSDL2main.a -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/libSDL2main.la: -------------------------------------------------------------------------------- 1 | # libSDL2main.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='' 9 | 10 | # Names of this library. 11 | library_names='' 12 | 13 | # The name of the static archive. 14 | old_library='libSDL2main.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs='' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libSDL2main. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/Users/valve/release/SDL/SDL2-2.0.20/i686-w64-mingw32/lib' 42 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio Code/SDLTemplate/src/lib/pkgconfig/sdl2.pc: -------------------------------------------------------------------------------- 1 | # sdl pkg-config source file 2 | 3 | prefix=/opt/local/i686-w64-mingw32 4 | exec_prefix=${prefix} 5 | libdir=${exec_prefix}/lib 6 | includedir=${prefix}/include 7 | 8 | Name: sdl2 9 | Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. 10 | Version: 2.0.20 11 | Requires: 12 | Conflicts: 13 | Libs: -L${libdir} -lmingw32 -lSDL2main -lSDL2 -mwindows 14 | Libs.private: -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid 15 | Cflags: -I${includedir}/SDL2 -Dmain=SDL_main 16 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/.vs/SDLTutorial/v14/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/.vs/SDLTutorial/v14/.suo -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/Debug/SDLTutorial.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/Debug/SDLTutorial.exe -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/Debug/SDLTutorial.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/Debug/SDLTutorial.ilk -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/Debug/SDLTutorial.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/Debug/SDLTutorial.pdb -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial.VC.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial.VC.db -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLTutorial", "SDLTutorial\SDLTutorial.vcxproj", "{8ADCD721-ADE8-43C4-9550-F619EDE621CC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {8ADCD721-ADE8-43C4-9550-F619EDE621CC}.Debug|x64.ActiveCfg = Debug|x64 17 | {8ADCD721-ADE8-43C4-9550-F619EDE621CC}.Debug|x64.Build.0 = Debug|x64 18 | {8ADCD721-ADE8-43C4-9550-F619EDE621CC}.Debug|x86.ActiveCfg = Debug|Win32 19 | {8ADCD721-ADE8-43C4-9550-F619EDE621CC}.Debug|x86.Build.0 = Debug|Win32 20 | {8ADCD721-ADE8-43C4-9550-F619EDE621CC}.Release|x64.ActiveCfg = Release|x64 21 | {8ADCD721-ADE8-43C4-9550-F619EDE621CC}.Release|x64.Build.0 = Release|x64 22 | {8ADCD721-ADE8-43C4-9550-F619EDE621CC}.Release|x86.ActiveCfg = Release|Win32 23 | {8ADCD721-ADE8-43C4-9550-F619EDE621CC}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.log: -------------------------------------------------------------------------------- 1 |  main.cpp 2 | SDLTutorial.vcxproj -> C:\Users\FrahaanAmanAziz\Desktop\SDLTutorial\Debug\SDLTutorial.exe 3 | SDLTutorial.vcxproj -> C:\Users\FrahaanAmanAziz\Desktop\SDLTutorial\Debug\SDLTutorial.pdb (Full PDB) 4 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/SDLTutorial.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 2 | Debug|Win32|C:\Users\FrahaanAmanAziz\Desktop\SDLTutorial\| 3 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/SDLTutorial.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/main.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/main.obj -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/vc140.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/vc140.idb -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/vc140.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/Debug/vc140.pdb -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/SDL2.dll -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/SDLTutorial.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {8ADCD721-ADE8-43C4-9550-F619EDE621CC} 23 | Win32Proj 24 | SDLTutorial 25 | 8.1 26 | 27 | 28 | 29 | Application 30 | true 31 | v140 32 | Unicode 33 | 34 | 35 | Application 36 | false 37 | v140 38 | true 39 | Unicode 40 | 41 | 42 | Application 43 | true 44 | v140 45 | Unicode 46 | 47 | 48 | Application 49 | false 50 | v140 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | 75 | 76 | true 77 | 78 | 79 | false 80 | 81 | 82 | false 83 | 84 | 85 | 86 | 87 | 88 | Level3 89 | Disabled 90 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 91 | C:\Development\SDL2\include;%(AdditionalIncludeDirectories) 92 | 93 | 94 | Console 95 | true 96 | C:\Development\SDL2\lib\x86;%(AdditionalLibraryDirectories) 97 | SDL2.lib;SDL2main.lib;%(AdditionalDependencies) 98 | 99 | 100 | 101 | 102 | 103 | 104 | Level3 105 | Disabled 106 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 107 | 108 | 109 | Console 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | 117 | 118 | MaxSpeed 119 | true 120 | true 121 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 122 | C:\Development\SDL2\include;%(AdditionalIncludeDirectories) 123 | 124 | 125 | Console 126 | true 127 | true 128 | true 129 | C:\Development\SDL2\lib\x86;%(AdditionalLibraryDirectories) 130 | SDL2.lib;SDL2main.lib;%(AdditionalDependencies) 131 | 132 | 133 | 134 | 135 | Level3 136 | 137 | 138 | MaxSpeed 139 | true 140 | true 141 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 142 | 143 | 144 | Console 145 | true 146 | true 147 | true 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/SDLTutorial.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Tutorial 001_Setup/Windows/Visual Studio/SDLTutorial/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | if (SDL_Init(SDL_INIT_EVERYTHING) < 0) 8 | { 9 | std::cout << "SDL could not initialise! SDL Error: " << SDL_GetError() << std::endl; 10 | } 11 | 12 | return EXIT_SUCCESS; 13 | } -------------------------------------------------------------------------------- /Tutorial 002_Hello World/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | const int WIDTH = 800, HEIGHT = 600; 6 | 7 | int main( int argc, char *argv[] ) 8 | { 9 | SDL_Init( SDL_INIT_EVERYTHING ); 10 | 11 | SDL_Window *window = SDL_CreateWindow( "Hello SDL World", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_ALLOW_HIGHDPI ); 12 | 13 | // Check that the window was successfully created 14 | if ( NULL == window ) 15 | { 16 | // In the case that the window could not be made... 17 | std::cout << "Could not create window: " << SDL_GetError( ) << std::endl; 18 | return 1; 19 | } 20 | 21 | SDL_Event windowEvent; 22 | 23 | while ( true ) 24 | { 25 | if ( SDL_PollEvent( &windowEvent ) ) 26 | { 27 | if ( SDL_QUIT == windowEvent.type ) 28 | { 29 | break; 30 | } 31 | } 32 | } 33 | 34 | SDL_DestroyWindow( window ); 35 | SDL_Quit( ); 36 | 37 | return EXIT_SUCCESS; 38 | } 39 | -------------------------------------------------------------------------------- /Tutorial 003_Drawing A BMP Image/hello_world.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 003_Drawing A BMP Image/hello_world.bmp -------------------------------------------------------------------------------- /Tutorial 003_Drawing A BMP Image/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | const int WIDTH = 640, HEIGHT = 360; 6 | 7 | int main( int argc, char *argv[] ) 8 | { 9 | SDL_Surface *imageSurface = NULL; 10 | SDL_Surface *windowSurface = NULL; 11 | 12 | if ( SDL_Init( SDL_INIT_EVERYTHING ) < 0 ) 13 | { 14 | std::cout << "SDL could not initialize! SDL Error: " << SDL_GetError( ) << std::endl; 15 | } 16 | 17 | SDL_Window *window = SDL_CreateWindow( "Hello SDL World", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_ALLOW_HIGHDPI ); 18 | windowSurface = SDL_GetWindowSurface( window ); 19 | 20 | if ( NULL == window ) 21 | { 22 | std::cout << "Could not create window: " << SDL_GetError( ) << std::endl; 23 | 24 | return EXIT_FAILURE; 25 | } 26 | 27 | SDL_Event windowEvent; 28 | 29 | imageSurface = SDL_LoadBMP( "hello_world.bmp" ); 30 | if( imageSurface == NULL ) 31 | { 32 | std::cout << "SDL could not load image! SDL Error: " << SDL_GetError( ) << std::endl; 33 | } 34 | 35 | while ( true ) 36 | { 37 | if ( SDL_PollEvent( &windowEvent ) ) 38 | { 39 | if ( SDL_QUIT == windowEvent.type ) 40 | { 41 | break; 42 | } 43 | } 44 | 45 | SDL_BlitSurface( imageSurface, NULL, windowSurface, NULL ); 46 | 47 | //Update the surface 48 | SDL_UpdateWindowSurface( window ); 49 | } 50 | 51 | SDL_FreeSurface( imageSurface ); 52 | SDL_FreeSurface( windowSurface ); 53 | 54 | imageSurface = NULL; 55 | windowSurface = NULL; 56 | 57 | SDL_DestroyWindow( window ); 58 | SDL_Quit( ); 59 | 60 | return EXIT_SUCCESS; 61 | } 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Tutorial 004_Load Image Using SDL_image/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSystems/SDL-2-Tutorials/51bb3a188339a3cba9c7f5477a13c76a57f477b6/Tutorial 004_Load Image Using SDL_image/logo.png -------------------------------------------------------------------------------- /Tutorial 004_Load Image Using SDL_image/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | const int WIDTH = 640, HEIGHT = 360; 7 | 8 | int main( int argc, char *argv[] ) 9 | { 10 | SDL_Surface *imageSurface = NULL; 11 | SDL_Surface *windowSurface = NULL; 12 | 13 | SDL_Init( SDL_INIT_EVERYTHING ); 14 | 15 | SDL_Window *window = SDL_CreateWindow( "Hello SDL World", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_ALLOW_HIGHDPI ); 16 | windowSurface = SDL_GetWindowSurface( window ); 17 | 18 | // Check that the window was successfully created 19 | if ( NULL == window ) 20 | { 21 | // In the case that the window could not be made... 22 | std::cout << "Could not create window: " << SDL_GetError( ) << std::endl; 23 | return 1; 24 | } 25 | 26 | if( !( IMG_Init( IMG_INIT_PNG ) & IMG_INIT_PNG ) ) 27 | { 28 | std::cout << "Could not create window: " << IMG_GetError( ) << std::endl; 29 | return 1; 30 | } 31 | 32 | SDL_Event windowEvent; 33 | 34 | imageSurface = IMG_Load( "logo.png" ); 35 | 36 | if ( NULL == imageSurface ) 37 | { 38 | std::cout << "SDL could not load image! SDL Error: " << SDL_GetError( ) << std::endl; 39 | } 40 | 41 | while ( true ) 42 | { 43 | if ( SDL_PollEvent( &windowEvent ) ) 44 | { 45 | if ( SDL_QUIT == windowEvent.type ) 46 | { 47 | break; 48 | } 49 | } 50 | 51 | SDL_BlitSurface( imageSurface, NULL, windowSurface, NULL ); 52 | 53 | SDL_UpdateWindowSurface( window ); 54 | } 55 | 56 | SDL_FreeSurface( imageSurface ); 57 | SDL_FreeSurface( windowSurface ); 58 | 59 | imageSurface = NULL; 60 | windowSurface = NULL; 61 | 62 | SDL_DestroyWindow( window ); 63 | SDL_Quit( ); 64 | 65 | return EXIT_SUCCESS; 66 | } 67 | -------------------------------------------------------------------------------- /Tutorial 005_Change Background Colour/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | const int WIDTH = 800, HEIGHT = 600; 5 | 6 | int main( int argc, char *argv[] ) 7 | { 8 | SDL_Init( SDL_INIT_EVERYTHING ); 9 | 10 | SDL_Window *window = SDL_CreateWindow( "Hello SDL WORLD", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_ALLOW_HIGHDPI ); 11 | 12 | if ( NULL == window ) 13 | { 14 | std::cout << "Could not create window: " << SDL_GetError( ) << std::endl; 15 | return 1; 16 | } 17 | 18 | // We must call SDL_CreateRenderer in order for draw calls to affect this window 19 | SDL_Renderer *renderer = SDL_CreateRenderer( window, -1, 0 ); 20 | 21 | // Select the color for drawing. It is set to red here 22 | SDL_SetRenderDrawColor( renderer, 255, 0, 0, 255 ); 23 | 24 | // Clear the entire screen to our selected color 25 | SDL_RenderClear( renderer ); 26 | 27 | // This will show the new, red background of the window 28 | SDL_RenderPresent(renderer); 29 | 30 | SDL_Event windowEvent; 31 | 32 | while ( true ) 33 | { 34 | if ( SDL_PollEvent( &windowEvent ) ) 35 | { 36 | if ( SDL_QUIT == windowEvent.type ) 37 | { break; } 38 | } 39 | } 40 | 41 | SDL_DestroyWindow( window ); 42 | SDL_Quit( ); 43 | 44 | return EXIT_SUCCESS; 45 | } -------------------------------------------------------------------------------- /Tutorial 006_Keyboard Events/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | const int WIDTH = 800, HEIGHT = 600; 5 | 6 | int main( int argc, char *argv[] ) 7 | { 8 | SDL_Init( SDL_INIT_EVERYTHING ); 9 | 10 | SDL_Window *window = SDL_CreateWindow( "Hello SDL WORLD", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_ALLOW_HIGHDPI ); 11 | 12 | if ( NULL == window ) 13 | { 14 | std::cout << "Could not create window: " << SDL_GetError( ) << std::endl; 15 | return 1; 16 | } 17 | 18 | SDL_Renderer *renderer = SDL_CreateRenderer( window, -1, 0 ); 19 | 20 | SDL_SetRenderDrawColor( renderer, 255, 255, 0, 255 ); 21 | 22 | SDL_RenderClear( renderer ); 23 | 24 | SDL_RenderPresent( renderer ); 25 | 26 | SDL_Event event; 27 | 28 | while ( true ) 29 | { 30 | if ( SDL_PollEvent( &event ) ) 31 | { 32 | if ( SDL_QUIT == event.type ) 33 | { break; } 34 | 35 | if ( SDL_KEYDOWN == event.type ) 36 | { 37 | //std::cout << "Key is down" << std::endl; 38 | if ( SDLK_a == event.key.keysym.sym ) 39 | { std::cout << "A is down - Move left" << std::endl; } 40 | if ( SDLK_s == event.key.keysym.sym ) 41 | { std::cout << "S is down - Move right" << std::endl; } 42 | if ( SDLK_d == event.key.keysym.sym ) 43 | { std::cout << "D is down - Move down" << std::endl; } 44 | if ( SDLK_w == event.key.keysym.sym ) 45 | { std::cout << "W is down - Move up" << std::endl; } 46 | } 47 | else if ( SDL_KEYUP == event.type ) 48 | { 49 | //std::cout << "Key is up" << std::endl; 50 | if ( SDLK_a == event.key.keysym.sym ) 51 | { std::cout << "A is up - Stop moving left" << std::endl; } 52 | if ( SDLK_s == event.key.keysym.sym ) 53 | { std::cout << "S is up - Stop moving right" << std::endl; } 54 | if ( SDLK_d == event.key.keysym.sym ) 55 | { std::cout << "D is up - Stop moving down" << std::endl; } 56 | if ( SDLK_w == event.key.keysym.sym ) 57 | { std::cout << "W is up - Stop moving up" << std::endl; } 58 | } 59 | } 60 | } 61 | 62 | SDL_DestroyWindow( window ); 63 | SDL_Quit( ); 64 | 65 | return EXIT_SUCCESS; 66 | } -------------------------------------------------------------------------------- /Tutorial 007_Mouse Events/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | const int WIDTH = 800, HEIGHT = 600; 5 | 6 | int main( int argc, char *argv[] ) 7 | { 8 | SDL_Init( SDL_INIT_EVERYTHING ); 9 | 10 | SDL_Window *window = SDL_CreateWindow( "Hello SDL WORLD", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_ALLOW_HIGHDPI ); 11 | 12 | if ( NULL == window ) 13 | { 14 | std::cout << "Could not create window: " << SDL_GetError( ) << std::endl; 15 | return 1; 16 | } 17 | 18 | SDL_Renderer *renderer = SDL_CreateRenderer( window, -1, 0 ); 19 | 20 | SDL_SetRenderDrawColor( renderer, 255, 255, 0, 255 ); 21 | 22 | SDL_RenderClear( renderer ); 23 | 24 | SDL_RenderPresent( renderer ); 25 | 26 | SDL_Event event; 27 | 28 | while ( true ) 29 | { 30 | if ( SDL_PollEvent( &event ) ) 31 | { 32 | if ( SDL_QUIT == event.type ) 33 | { break; } 34 | 35 | if ( SDL_MOUSEMOTION == event.type ) 36 | { 37 | int x, y; 38 | SDL_GetMouseState( &x, &y ); 39 | 40 | std::cout << x << " : " << y << std::endl; 41 | } 42 | 43 | if ( SDL_MOUSEBUTTONDOWN == event.type ) 44 | { 45 | if ( SDL_BUTTON_LEFT == event.button.button ) 46 | { std::cout << "Left mouse button is down" << std::endl; } 47 | else if ( SDL_BUTTON_RIGHT == event.button.button ) 48 | { std::cout << "Right mouse button is down" << std::endl; } 49 | else if ( SDL_BUTTON_MIDDLE == event.button.button ) 50 | { std::cout << "Middle mouse button is down" << std::endl; } 51 | } 52 | 53 | if ( SDL_MOUSEBUTTONUP == event.type ) 54 | { 55 | if ( SDL_BUTTON_LEFT == event.button.button ) 56 | { std::cout << "Left mouse button is up" << std::endl; } 57 | else if ( SDL_BUTTON_RIGHT == event.button.button ) 58 | { std::cout << "Right mouse button is up" << std::endl; } 59 | else if ( SDL_BUTTON_MIDDLE == event.button.button ) 60 | { std::cout << "Middle mouse button is up" << std::endl; } 61 | } 62 | 63 | if ( SDL_MOUSEWHEEL == event.type ) 64 | { 65 | if ( event.wheel.y > 0 ) // scroll up 66 | { std::cout << "Mouse wheel is scrolling up" << std::endl; } 67 | else if ( event.wheel.y < 0 ) // scroll down 68 | { std::cout << "Mouse wheel is scrolling down" << std::endl; } 69 | 70 | if ( event.wheel.x > 0 ) // scroll right 71 | { std::cout << "Mouse wheel is scrolling right" << std::endl; } 72 | else if ( event.wheel.x < 0 ) // scroll left 73 | { std::cout << "Mouse wheel is scrolling left" << std::endl; } 74 | } 75 | 76 | if ( SDL_KEYDOWN == event.type ) 77 | { 78 | //std::cout << "Key is down" << std::endl; 79 | 80 | if ( SDLK_a == event.key.keysym.sym ) 81 | { std::cout << "A is down - Move left" << std::endl; } 82 | else if ( SDLK_s == event.key.keysym.sym ) 83 | { std::cout << "S is down - Move down" << std::endl; } 84 | else if ( SDLK_d == event.key.keysym.sym ) 85 | { std::cout << "D is down - Move right" << std::endl; } 86 | else if ( SDLK_w == event.key.keysym.sym ) 87 | { std::cout << "W is down - Move up" << std::endl; } 88 | } 89 | else if ( SDL_KEYUP == event.type ) 90 | { 91 | //std::cout << "Key is up" << std::endl; 92 | if ( SDLK_a == event.key.keysym.sym ) 93 | { std::cout << "A is up - Stop moving left" << std::endl; } 94 | else if ( SDLK_s == event.key.keysym.sym ) 95 | { std::cout << "S is up - Stop moving down" << std::endl; } 96 | else if ( SDLK_d == event.key.keysym.sym ) 97 | { std::cout << "D is up - Stop moving right" << std::endl; } 98 | else if ( SDLK_w == event.key.keysym.sym ) 99 | { std::cout << "W is up - Stop moving up" << std::endl; } 100 | } 101 | } 102 | } 103 | 104 | SDL_DestroyWindow( window ); 105 | SDL_Quit( ); 106 | 107 | return EXIT_SUCCESS; 108 | } 109 | --------------------------------------------------------------------------------