├── .gitignore
├── lib
└── SDL2-2.0.16
│ ├── lib
│ └── x64
│ │ ├── SDL2.dll
│ │ ├── SDL2.lib
│ │ ├── SDL2main.lib
│ │ └── SDL2test.lib
│ ├── docs
│ ├── README-hg.md
│ ├── README-platforms.md
│ ├── README-wince.md
│ ├── README-psp.md
│ ├── README-git.md
│ ├── README-pandora.md
│ ├── README-vita.md
│ ├── README-emscripten.md
│ ├── README-kmsbsd.md
│ ├── README-os2.md
│ ├── README-porting.md
│ ├── README.md
│ ├── README-windows.md
│ ├── README-directfb.md
│ ├── README-cmake.md
│ ├── README-linux.md
│ ├── README-gesture.md
│ ├── README-touch.md
│ ├── README-nacl.md
│ └── README-visualc.md
│ ├── include
│ ├── SDL_revision.h
│ ├── SDL_copying.h
│ ├── SDL_opengles2_gl2platform.h
│ ├── SDL_types.h
│ ├── SDL_name.h
│ ├── SDL_opengles.h
│ ├── close_code.h
│ ├── SDL_opengles2.h
│ ├── SDL_test_memory.h
│ ├── SDL_test_log.h
│ ├── SDL_test.h
│ ├── SDL_quit.h
│ ├── SDL_test_compare.h
│ ├── SDL_test_images.h
│ ├── SDL_test_font.h
│ ├── SDL_config_minimal.h
│ ├── SDL_clipboard.h
│ ├── SDL_misc.h
│ ├── SDL_power.h
│ ├── SDL_metal.h
│ ├── SDL_test_random.h
│ ├── SDL_test_assert.h
│ ├── SDL_config_wiz.h
│ ├── SDL_bits.h
│ ├── SDL_config_pandora.h
│ ├── SDL_gesture.h
│ ├── SDL_test_crc32.h
│ ├── SDL_locale.h
│ ├── SDL_loadso.h
│ ├── SDL_config_psp.h
│ ├── SDL_touch.h
│ ├── SDL_config_android.h
│ ├── SDL_config_iphoneos.h
│ ├── SDL_test_md5.h
│ ├── SDL_test_harness.h
│ ├── begin_code.h
│ ├── SDL_error.h
│ ├── SDL_filesystem.h
│ ├── SDL_timer.h
│ ├── SDL_shape.h
│ ├── SDL_main.h
│ └── SDL_version.h
│ ├── README-SDL.txt
│ ├── BUGS.txt
│ ├── README.txt
│ └── COPYING.txt
├── vs16
├── cloth-simulation-2d.vcxproj.user
├── cloth-simulation-2d.sln
├── cloth-simulation-2d.vcxproj.filters
└── cloth-simulation-2d.vcxproj
├── README.md
└── source
├── Main.cpp
├── Mouse.cpp
├── Stick.h
├── Cloth.h
├── Renderer.h
├── Application.h
├── Point.h
├── Vec2.h
├── Mouse.h
├── Stick.cpp
├── Cloth.cpp
├── Renderer.cpp
├── Point.cpp
└── Application.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | /vs16/.vs
2 | /vs16/x64
3 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/lib/x64/SDL2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marianpekar/cloth-simulation-2d/HEAD/lib/SDL2-2.0.16/lib/x64/SDL2.dll
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/lib/x64/SDL2.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marianpekar/cloth-simulation-2d/HEAD/lib/SDL2-2.0.16/lib/x64/SDL2.lib
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-hg.md:
--------------------------------------------------------------------------------
1 | We are no longer hosted in Mercurial. Please see README-git.md for details.
2 |
3 | Thanks!
4 |
5 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/lib/x64/SDL2main.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marianpekar/cloth-simulation-2d/HEAD/lib/SDL2-2.0.16/lib/x64/SDL2main.lib
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/lib/x64/SDL2test.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marianpekar/cloth-simulation-2d/HEAD/lib/SDL2-2.0.16/lib/x64/SDL2test.lib
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_revision.h:
--------------------------------------------------------------------------------
1 | #define SDL_REVISION "https://github.com/libsdl-org/SDL.git@25f9ed87ff6947d9576fc9d79dee0784e638ac58"
2 | #define SDL_REVISION_NUMBER 0
3 |
--------------------------------------------------------------------------------
/vs16/cloth-simulation-2d.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 2D Cloth Simulation in C++ with SDL
2 |
3 | Read the tutorial, where the code and all the underlying theory is explained in great depth at https://pikuma.com/blog/verlet-integration-2d-cloth-physics-simulation
4 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-platforms.md:
--------------------------------------------------------------------------------
1 | Platforms
2 | =========
3 |
4 | We maintain the list of supported platforms on our wiki now, and how to
5 | build and install SDL for those platforms:
6 |
7 | https://wiki.libsdl.org/Installation
8 |
9 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-wince.md:
--------------------------------------------------------------------------------
1 | WinCE
2 | =====
3 |
4 | Windows CE is no longer supported by SDL.
5 |
6 | We have left the CE support in SDL 1.2 for those that must have it, and we
7 | have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3.
8 |
9 | --ryan.
10 |
11 |
--------------------------------------------------------------------------------
/source/Main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "Application.h"
4 |
5 | int main(int argc, char* args[])
6 | {
7 | Application app;
8 |
9 | app.Setup(1200, 320, 10);
10 |
11 | while(app.IsRunning())
12 | {
13 | app.Input();
14 | app.Update();
15 | app.Render();
16 | }
17 |
18 | app.Destroy();
19 |
20 | return 0;
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/source/Mouse.cpp:
--------------------------------------------------------------------------------
1 | #include "Mouse.h"
2 |
3 | void Mouse::IncreaseCursorSize(float increment)
4 | {
5 | if(cursorSize + increment > maxCursorSize || cursorSize + increment < minCursorSize)
6 | return;
7 |
8 | cursorSize += increment;
9 | }
10 |
11 | void Mouse::UpdatePosition(int x, int y)
12 | {
13 | prevPos.x = pos.x;
14 | prevPos.y = pos.y;
15 | pos.x = x;
16 | pos.y = y;
17 | }
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-psp.md:
--------------------------------------------------------------------------------
1 | PSP
2 | ======
3 | SDL port for the Sony PSP contributed by
4 | Captian Lex
5 |
6 | Credit to
7 | Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
8 | Geecko for his PSP GU lib "Glib2d"
9 |
10 | Building
11 | --------
12 | To build for the PSP, make sure psp-config is in the path and run:
13 | make -f Makefile.psp
14 |
15 |
16 |
17 | To Do
18 | ------
19 | PSP Screen Keyboard
20 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/README-SDL.txt:
--------------------------------------------------------------------------------
1 |
2 | Please distribute this file with the SDL runtime environment:
3 |
4 | The Simple DirectMedia Layer (SDL for short) is a cross-platform library
5 | designed to make it easy to write multi-media software, such as games
6 | and emulators.
7 |
8 | The Simple DirectMedia Layer library source code is available from:
9 | https://www.libsdl.org/
10 |
11 | This library is distributed under the terms of the zlib license:
12 | http://www.zlib.net/zlib_license.html
13 |
14 |
--------------------------------------------------------------------------------
/source/Stick.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Renderer.h"
4 |
5 | class Point;
6 | class Stick
7 | {
8 | private:
9 | Point& p0;
10 | Point& p1;
11 | float length;
12 |
13 | bool isActive = true;
14 | bool isSelected = false;
15 |
16 | Uint32 color = 0xFF0048E3;
17 | Uint32 colorWhenSelected = 0xFFCC0000;
18 |
19 | public:
20 | Stick(Point& p0, Point& p1, float lenght);
21 | ~Stick() = default;
22 |
23 | void SetIsSelected(bool value);
24 |
25 | void Update();
26 | void Draw(const Renderer* renderer) const;
27 | void Break();
28 | };
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/BUGS.txt:
--------------------------------------------------------------------------------
1 |
2 | Bugs are now managed in the SDL issue tracker, here:
3 |
4 | https://github.com/libsdl-org/SDL/issues
5 |
6 | You may report bugs there, and search to see if a given issue has already
7 | been reported, discussed, and maybe even fixed.
8 |
9 |
10 | You may also find help at the SDL forums/mailing list:
11 |
12 | https://discourse.libsdl.org/
13 |
14 | Bug reports are welcome here, but we really appreciate if you use the issue
15 | tracker, as bugs discussed on the mailing list may be forgotten or missed.
16 |
17 |
--------------------------------------------------------------------------------
/source/Cloth.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "Point.h"
5 | #include "Stick.h"
6 |
7 | class Cloth
8 | {
9 | private:
10 | Vec2 gravity = { 0.0f, 981.0f };
11 | float drag = 0.01f;
12 | float elasticity = 10.0f;
13 |
14 | std::vector points;
15 | std::vector sticks;
16 |
17 | public:
18 | Cloth() = default;
19 | Cloth(int width, int height, int spacing, int startX, int startY);
20 | ~Cloth();
21 |
22 | void Update(Renderer* renderer, Mouse* mouse, float deltaTime);
23 | void Draw(Renderer* renderer) const;
24 | };
25 |
--------------------------------------------------------------------------------
/source/Renderer.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | class Renderer {
6 | private:
7 | int windowWidth, windowHeight;
8 | SDL_Window* window;
9 | SDL_Renderer* renderer;
10 |
11 | public:
12 | Renderer() = default;
13 | ~Renderer();
14 |
15 | int GetWindowWidth() const { return windowWidth; }
16 | int GetWindowHeight() const { return windowHeight; }
17 |
18 | bool Setup();
19 |
20 | void ClearScreen(Uint32 color) const;
21 | void Render() const;
22 |
23 | void DrawLine(int x0, int y0, int x1, int y1, Uint32 color) const;
24 | void DrawPoint(int x, int y, Uint32 color) const;
25 | };
--------------------------------------------------------------------------------
/source/Application.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "Mouse.h"
5 | #include "Renderer.h"
6 | #include "Cloth.h"
7 |
8 | struct Application
9 | {
10 | private:
11 | Renderer* renderer = nullptr;
12 | Mouse* mouse = nullptr;
13 | Cloth* cloth = nullptr;
14 |
15 | bool isRunning = false;
16 |
17 | Uint32 lastUpdateTime;
18 | public:
19 | Application() = default;
20 | ~Application() = default;
21 |
22 | bool IsRunning() const;
23 |
24 | void Setup(int clothWidth, int clothHeight, int clothSpacing);
25 | void Input();
26 | void Update();
27 | void Render() const;
28 | void Destroy();
29 | };
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/README.txt:
--------------------------------------------------------------------------------
1 |
2 | Simple DirectMedia Layer
3 |
4 | (SDL)
5 |
6 | Version 2.0
7 |
8 | ---
9 | https://www.libsdl.org/
10 |
11 | Simple DirectMedia Layer is a cross-platform development library designed
12 | to provide low level access to audio, keyboard, mouse, joystick, and graphics
13 | hardware via OpenGL and Direct3D. It is used by video playback software,
14 | emulators, and popular games including Valve's award winning catalog
15 | and many Humble Bundle games.
16 |
17 | More extensive documentation is available in the docs directory, starting
18 | with README.md
19 |
20 | Enjoy!
21 | Sam Lantinga (slouken@libsdl.org)
22 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-git.md:
--------------------------------------------------------------------------------
1 | git
2 | =========
3 |
4 | The latest development version of SDL is available via git.
5 | Git allows you to get up-to-the-minute fixes and enhancements;
6 | as a developer works on a source tree, you can use "git" to mirror that
7 | source tree instead of waiting for an official release. Please look
8 | at the Git website ( https://git-scm.com/ ) for more
9 | information on using git, where you can also download software for
10 | macOS, Windows, and Unix systems.
11 |
12 | git clone https://github.com/libsdl-org/SDL
13 |
14 | If you are building SDL via configure, you will need to run autogen.sh
15 | before running configure.
16 |
17 | There is a web interface to the Git repository at:
18 | http://github.com/libsdl-org/SDL/
19 |
20 |
--------------------------------------------------------------------------------
/source/Point.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Renderer.h"
4 | #include "Vec2.h"
5 | #include "Mouse.h"
6 | #include "Stick.h"
7 |
8 | class Point
9 | {
10 | private:
11 | Stick* sticks[2] = { nullptr };
12 |
13 | Vec2 pos;
14 | Vec2 prevPos;
15 | Vec2 initPos;
16 | bool isPinned = false;
17 |
18 | bool isSelected = false;
19 |
20 | void KeepInsideView(int width, int height);
21 |
22 | public:
23 | Point() = default;
24 | Point(float x, float y);
25 | ~Point() = default;
26 |
27 | void AddStick(Stick* stick, int index);
28 |
29 | const Vec2& GetPosition() const { return pos; }
30 | void SetPosition(float x, float y);
31 |
32 | void Pin();
33 |
34 | void Update(float deltaTime, float drag, const Vec2& acceleration, float elasticity, Mouse* mouse, int windowWidth, int windowHeight);
35 | };
--------------------------------------------------------------------------------
/source/Vec2.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | struct Vec2
4 | {
5 | float x, y;
6 |
7 | Vec2() : x(0), y(0) { }
8 | Vec2(float x, float y) : x(x), y(y) {}
9 | ~Vec2() = default;
10 |
11 | Vec2 operator + (const Vec2& v) const
12 | {
13 | Vec2 result;
14 | result.x = x + v.x;
15 | result.y = y + v.y;
16 | return result;
17 | }
18 |
19 | Vec2 operator - (const Vec2& v) const
20 | {
21 | Vec2 result;
22 | result.x = x - v.x;
23 | result.y = y - v.y;
24 | return result;
25 | }
26 |
27 | Vec2 operator * (const float n) const
28 | {
29 | Vec2 result;
30 | result.x = x * n;
31 | result.y = y * n;
32 | return result;
33 | }
34 |
35 | Vec2 operator / (const float n) const
36 | {
37 | Vec2 result;
38 | result.x = x / n;
39 | result.y = y / n;
40 | return result;
41 | }
42 | };
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-pandora.md:
--------------------------------------------------------------------------------
1 | Pandora
2 | =====================================================================
3 |
4 | ( http://openpandora.org/ )
5 | - A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
6 | support to work on the pandora under the framebuffer. This driver do not have
7 | input support for now, so if you use it you will have to add your own control code.
8 | The video driver name is "pandora" so if you have problem running it from
9 | the framebuffer, try to set the following variable before starting your application :
10 | "export SDL_VIDEODRIVER=pandora"
11 |
12 | - OpenGL ES support was added to the x11 driver, so it's working like the normal
13 | x11 driver one with OpenGLX support, with SDL input event's etc..
14 |
15 |
16 | David Carré (Cpasjuste)
17 | cpasjuste@gmail.com
18 |
--------------------------------------------------------------------------------
/source/Mouse.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Vec2.h"
4 |
5 | class Mouse
6 | {
7 | private:
8 | Vec2 pos;
9 | Vec2 prevPos;
10 |
11 | float maxCursorSize = 100;
12 | float minCursorSize = 20;
13 |
14 | float cursorSize = 20;
15 |
16 | bool leftButtonDown = false;
17 | bool rightButtonDown = false;
18 |
19 | public:
20 | Mouse() = default;
21 | ~Mouse() = default;
22 |
23 | const Vec2& GetPosition() const { return pos; }
24 | const Vec2& GetPreviousPosition() const {return prevPos; }
25 | void UpdatePosition(int x, int y);
26 |
27 | bool GetLeftButtonDown() const { return leftButtonDown; }
28 | void SetLeftMouseButton(bool state) { this->leftButtonDown = state; }
29 |
30 | bool GetRightMouseButton() const { return rightButtonDown; }
31 | void SetRightMouseButton(bool state) { this->rightButtonDown = state; }
32 |
33 | void IncreaseCursorSize(float increment);
34 | float GetCursorSize() const { return cursorSize; }
35 | };
36 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/COPYING.txt:
--------------------------------------------------------------------------------
1 |
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2020 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_copying.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2017 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-vita.md:
--------------------------------------------------------------------------------
1 | PS Vita
2 | =======
3 | SDL port for the Sony Playstation Vita and Sony Playstation TV
4 |
5 | Credit to
6 | * xerpi and rsn8887 for initial (vita2d) port
7 | * vitasdk/dolcesdk devs
8 | * CBPS discord (Namely Graphene and SonicMastr)
9 |
10 | Building
11 | --------
12 | To build for the PSVita, make sure you have vitasdk and cmake installed and run:
13 | ```
14 | cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release
15 | cmake --build build
16 | cmake --install build
17 | ```
18 |
19 |
20 | Notes
21 | -----
22 | * gles2 support is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON`
23 | * By default SDL emits mouse events for touch events on every touchscreen.
24 | Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead.
25 | * Support for L2/R2/R3/R3 buttons, haptic feedback and gamepad led only available on PSTV, or when using external ds4 gamepad on vita.
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/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 |
--------------------------------------------------------------------------------
/source/Stick.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "Stick.h"
3 | #include "Point.h"
4 |
5 | Stick::Stick(Point& p0, Point& p1, float length) : p0(p0), p1(p1), length(length) {}
6 |
7 | void Stick::Update()
8 | {
9 | if(!isActive)
10 | return;
11 |
12 | Vec2 p0Pos = p0.GetPosition();
13 | Vec2 p1Pos = p1.GetPosition();
14 |
15 | Vec2 diff = p0Pos - p1Pos;
16 | float dist = sqrtf(diff.x * diff.x + diff.y * diff.y);
17 | float diffFactor = (length - dist) / dist;
18 | Vec2 offset = diff * diffFactor * 0.5f;
19 |
20 | p0.SetPosition(p0Pos.x + offset.x, p0Pos.y + offset.y);
21 | p1.SetPosition(p1Pos.x - offset.x, p1Pos.y - offset.y);
22 | }
23 |
24 | void Stick::Draw(const Renderer* renderer) const
25 | {
26 | if (!isActive)
27 | return;
28 |
29 | Vec2 p0Pos = p0.GetPosition();
30 | Vec2 p1Pos = p1.GetPosition();
31 |
32 | renderer->DrawLine(p0Pos.x, p0Pos.y, p1Pos.x, p1Pos.y, isSelected ? colorWhenSelected : color);
33 | }
34 |
35 | void Stick::Break()
36 | {
37 | isActive = false;
38 | }
39 |
40 | void Stick::SetIsSelected(bool value)
41 | {
42 | isSelected = value;
43 | }
44 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-emscripten.md:
--------------------------------------------------------------------------------
1 | Emscripten
2 | ================================================================================
3 |
4 | Build:
5 |
6 | $ mkdir build
7 | $ cd build
8 | $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2"
9 | $ emmake make
10 |
11 | Or with cmake:
12 |
13 | $ mkdir build
14 | $ cd build
15 | $ emcmake cmake ..
16 | $ emmake make
17 |
18 | To build one of the tests:
19 |
20 | $ cd test/
21 | $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
22 |
23 | Uses GLES2 renderer or software
24 |
25 | Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere):
26 |
27 | SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/):
28 |
29 | $ EMCONFIGURE_JS=1 emconfigure ../configure
30 | build as usual...
31 |
32 | SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx):
33 |
34 | $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx
35 | build as usual...
36 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_types.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/vs16/cloth-simulation-2d.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31019.35
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cloth-simulation-2d", "cloth-simulation-2d.vcxproj", "{0DBDC2CC-E1B4-4A56-81D5-A217F361E7B6}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {0DBDC2CC-E1B4-4A56-81D5-A217F361E7B6}.Debug|x64.ActiveCfg = Debug|x64
15 | {0DBDC2CC-E1B4-4A56-81D5-A217F361E7B6}.Debug|x64.Build.0 = Debug|x64
16 | {0DBDC2CC-E1B4-4A56-81D5-A217F361E7B6}.Release|x64.ActiveCfg = Release|x64
17 | {0DBDC2CC-E1B4-4A56-81D5-A217F361E7B6}.Release|x64.Build.0 = Release|x64
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {1A5362A4-03DE-4327-BA27-9B8624EBDEC6}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_name.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_opengles.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-kmsbsd.md:
--------------------------------------------------------------------------------
1 | KMSDRM on *BSD
2 | ==================================================
3 |
4 | KMSDRM is supported on FreeBSD and OpenBSD. DragonFlyBSD works but requires being a root user. NetBSD isn't supported yet because the application will crash when creating the KMSDRM screen.
5 |
6 | WSCONS support has been brought back, but only as an input backend. It will not be brought back as a video backend to ease maintenance.
7 |
8 | OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices.
9 |
10 |
11 | SDL2 WSCONS input backend features
12 | ===================================================
13 | 1. It is keymap-aware; it will work properly with different keymaps.
14 | 2. It has mouse support.
15 | 3. Accent input is supported.
16 | 4. Compose keys are supported.
17 | 5. AltGr and Meta Shift keys work as intended.
18 |
19 | Partially working or no input on OpenBSD/NetBSD.
20 | ==================================================
21 |
22 | The WSCONS input backend needs read/write access to the /dev/wskbd* devices, without which it will not work properly. /dev/wsmouse must also be read/write accessible, otherwise mouse input will not work.
23 |
24 | Partially working or no input on FreeBSD.
25 | ==================================================
26 |
27 | The evdev devices are only accessible to the root user by default. Edit devfs rules to allow access to such devices. The /dev/kbd* devices are also only accessible to the root user by default. Edit devfs rules to allow access to such devices.
28 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/close_code.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/source/Cloth.cpp:
--------------------------------------------------------------------------------
1 | #include "Cloth.h"
2 |
3 | Cloth::Cloth(int width, int height, int spacing, int startX, int startY)
4 | {
5 | for (int y = 0; y <= height; y++) {
6 | for (int x = 0; x <= width; x++)
7 | {
8 | Point* point = new Point(startX + x * spacing, startY + y * spacing);
9 |
10 | if (x != 0)
11 | {
12 | Point* leftPoint = points[this->points.size() - 1];
13 | Stick* s = new Stick(*point, *leftPoint, spacing);
14 | leftPoint->AddStick(s, 0);
15 | point->AddStick(s, 0);
16 | sticks.push_back(s);
17 | }
18 |
19 | if (y != 0)
20 | {
21 | Point* upPoint = points[x + (y - 1) * (width + 1)];
22 | Stick* s = new Stick(*point, *upPoint, spacing);
23 | upPoint->AddStick(s, 1);
24 | point->AddStick(s, 1);
25 | sticks.push_back(s);
26 | }
27 |
28 | if (y == 0 && x % 2 == 0)
29 | {
30 | point->Pin();
31 | }
32 |
33 | points.push_back(point);
34 | }
35 | }
36 | }
37 |
38 | void Cloth::Update(Renderer* renderer, Mouse* mouse, float deltaTime)
39 | {
40 | for (int i = 0; i < points.size(); i++)
41 | {
42 | Point* p = points[i];
43 | p->Update(deltaTime, drag, gravity, elasticity, mouse, renderer->GetWindowWidth(), renderer->GetWindowHeight());
44 | };
45 |
46 | for (int i = 0; i < sticks.size(); i++)
47 | {
48 | sticks[i]->Update();
49 | };
50 | }
51 |
52 | void Cloth::Draw(Renderer* renderer) const
53 | {
54 | for (int i = 0; i < sticks.size(); i++)
55 | {
56 | sticks[i]->Draw(renderer);
57 | }
58 | }
59 |
60 | Cloth::~Cloth()
61 | {
62 | for (auto point : points)
63 | {
64 | delete point;
65 | }
66 |
67 | for (auto stick : sticks)
68 | {
69 | delete stick;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/source/Renderer.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "Renderer.h"
3 |
4 | bool Renderer::Setup()
5 | {
6 | if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
7 | {
8 | std::cerr << "Error initializing SDL" << std::endl;
9 | return false;
10 | }
11 |
12 | SDL_DisplayMode displayMode;
13 | SDL_GetCurrentDisplayMode(0, &displayMode);
14 | windowWidth = displayMode.w;
15 | windowHeight = displayMode.h;
16 |
17 | window = SDL_CreateWindow(NULL, 0, 0, windowWidth, windowHeight, SDL_WINDOW_BORDERLESS);
18 | if (!window)
19 | {
20 | std::cerr << "Error initializing SDL window" << std::endl;
21 | return false;
22 | }
23 |
24 | renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
25 | if (!renderer)
26 | {
27 | std::cerr << "Error initializing SDL renderer" << std::endl;
28 | return false;
29 | }
30 |
31 | return true;
32 | }
33 |
34 | void Renderer::ClearScreen(Uint32 color) const
35 | {
36 | SDL_SetRenderDrawColor(renderer, color >> 16, color >> 8, color, 255);
37 | SDL_RenderClear(renderer);
38 | }
39 |
40 | void Renderer::Render() const
41 | {
42 | SDL_RenderPresent(renderer);
43 | }
44 |
45 | void Renderer::DrawLine(int x0, int y0, int x1, int y1, Uint32 color) const
46 | {
47 | SDL_SetRenderDrawColor(renderer, color >> 16, color >> 8, color, 255);
48 | SDL_RenderDrawLine(renderer, x0, y0, x1, y1);
49 | }
50 |
51 | void Renderer::DrawPoint(int x, int y, Uint32 color) const
52 | {
53 | SDL_SetRenderDrawColor(renderer, color >> 16, color >> 8, color, 255);
54 | SDL_RenderDrawPoint(renderer, x, y);
55 | }
56 |
57 | Renderer::~Renderer()
58 | {
59 | SDL_DestroyRenderer(renderer);
60 | SDL_DestroyWindow(window);
61 | SDL_Quit();
62 | }
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_opengles2.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_opengles2.h
24 | *
25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
26 | */
27 | #include "SDL_config.h"
28 |
29 | #ifndef _MSC_VER
30 |
31 | #ifdef __IPHONEOS__
32 | #include
33 | #include
34 | #else
35 | #include
36 | #include
37 | #include
38 | #endif
39 |
40 | #else /* _MSC_VER */
41 |
42 | /* OpenGL ES2 headers for Visual Studio */
43 | #include "SDL_opengles2_khrplatform.h"
44 | #include "SDL_opengles2_gl2platform.h"
45 | #include "SDL_opengles2_gl2.h"
46 | #include "SDL_opengles2_gl2ext.h"
47 |
48 | #endif /* _MSC_VER */
49 |
50 | #ifndef APIENTRY
51 | #define APIENTRY GL_APIENTRY
52 | #endif
53 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-os2.md:
--------------------------------------------------------------------------------
1 | Simple DirectMedia Layer 2 for OS/2 & eComStation
2 | ================================================================================
3 | SDL port for OS/2, authored by Andrey Vasilkin , 2016
4 |
5 |
6 | OpenGL, joystick and audio capture not supported by this port.
7 |
8 | Additional environment variables (optional) for OS/2 version:
9 |
10 | SDL_AUDIO_SHARE
11 | Values: 0 or 1, default is 0
12 | Initializes the device as shareable or exclusively acquired.
13 |
14 | SDL_VIDEODRIVER
15 | Values: DIVE or VMAN, default is DIVE
16 | Use video subsystem: Direct interface video extensions (DIVE) or
17 | Video Manager (VMAN).
18 |
19 | You may significantly increase video output speed with OS4 kernel and patched
20 | files vman.dll and dive.dll or with latest versions of ACPI support and video
21 | driver Panorama.
22 |
23 | Latest versions of OS/4 kernel:
24 | http://gus.biysk.ru/os4/
25 | (Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4)
26 |
27 | Patched files vman.dll and dive.dll:
28 | http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR
29 |
30 |
31 | Compiling:
32 | ----------
33 |
34 | Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see:
35 | https://github.com/open-watcom/ and https://open-watcom.github.io
36 | WATCOM ervironment variable must to be set to the Open Watcom install
37 | directory. To compile, run: wmake -f Makefile.os2
38 |
39 |
40 | Installing:
41 | -----------
42 |
43 | - eComStation:
44 |
45 | If you have previously installed SDL2, make a Backup copy of SDL2.dll
46 | located in D:\ecs\dll (where D: is disk on which installed eComStation).
47 | Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll
48 |
49 | - OS/2:
50 |
51 | Copy SDL2.dll to any directory on your LIBPATH. If you have a previous
52 | version installed, close all SDL2 applications before replacing the old
53 | copy. Also make sure that any other older versions of DLLs are removed
54 | from your system.
55 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_test_memory.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_test_log.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-porting.md:
--------------------------------------------------------------------------------
1 | Porting
2 | =======
3 |
4 | * Porting To A New Platform
5 |
6 | The first thing you have to do when porting to a new platform, is look at
7 | include/SDL_platform.h and create an entry there for your operating system.
8 | The standard format is "__PLATFORM__", where PLATFORM is the name of the OS.
9 | Ideally SDL_platform.h will be able to auto-detect the system it's building
10 | on based on C preprocessor symbols.
11 |
12 | There are two basic ways of building SDL at the moment:
13 |
14 | 1. The "UNIX" way: ./configure; make; make install
15 |
16 | If you have a GNUish system, then you might try this. Edit configure.ac,
17 | take a look at the large section labelled:
18 |
19 | "Set up the configuration based on the host platform!"
20 |
21 | Add a section for your platform, and then re-run autogen.sh and build!
22 |
23 | 2. Using an IDE:
24 |
25 | If you're using an IDE or other non-configure build system, you'll probably
26 | want to create a custom SDL_config.h for your platform. Edit SDL_config.h,
27 | add a section for your platform, and create a custom SDL_config_{platform}.h,
28 | based on SDL_config_minimal.h and SDL_config.h.in
29 |
30 | Add the top level include directory to the header search path, and then add
31 | the following sources to the project:
32 |
33 | src/*.c
34 | src/atomic/*.c
35 | src/audio/*.c
36 | src/cpuinfo/*.c
37 | src/events/*.c
38 | src/file/*.c
39 | src/haptic/*.c
40 | src/joystick/*.c
41 | src/power/*.c
42 | src/render/*.c
43 | src/render/software/*.c
44 | src/stdlib/*.c
45 | src/thread/*.c
46 | src/timer/*.c
47 | src/video/*.c
48 | src/audio/disk/*.c
49 | src/audio/dummy/*.c
50 | src/filesystem/dummy/*.c
51 | src/video/dummy/*.c
52 | src/haptic/dummy/*.c
53 | src/joystick/dummy/*.c
54 | src/main/dummy/*.c
55 | src/thread/generic/*.c
56 | src/timer/dummy/*.c
57 | src/loadso/dummy/*.c
58 |
59 |
60 | Once you have a working library without any drivers, you can go back to each
61 | of the major subsystems and start implementing drivers for your platform.
62 |
63 | If you have any questions, don't hesitate to ask on the SDL mailing list:
64 | http://www.libsdl.org/mailing-list.php
65 |
66 | Enjoy!
67 | Sam Lantinga (slouken@libsdl.org)
68 |
69 |
--------------------------------------------------------------------------------
/vs16/cloth-simulation-2d.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
11 |
12 |
13 |
14 |
15 | Source Files
16 |
17 |
18 | Source Files
19 |
20 |
21 | Source Files
22 |
23 |
24 | Source Files
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | Source Files
34 |
35 |
36 |
37 |
38 | Header Files
39 |
40 |
41 | Header Files
42 |
43 |
44 | Header Files
45 |
46 |
47 | Header Files
48 |
49 |
50 | Header Files
51 |
52 |
53 | Header Files
54 |
55 |
56 | Header Files
57 |
58 |
59 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_test.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/source/Point.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "Point.h"
3 |
4 | Point::Point(float x, float y)
5 | {
6 | pos = prevPos = initPos = Vec2(x, y);
7 | }
8 |
9 | void Point::AddStick(Stick* stick, int index)
10 | {
11 | sticks[index] = stick;
12 | }
13 |
14 | void Point::SetPosition(float x, float y)
15 | {
16 | pos.x = x;
17 | pos.y = y;
18 | }
19 |
20 | void Point::Pin()
21 | {
22 | isPinned = true;
23 | }
24 |
25 | void Point::Update(float deltaTime, float drag, const Vec2& acceleration, float elasticity, Mouse* mouse, int windowWidth, int windowHeight)
26 | {
27 | Vec2 cursorToPosDir = pos - mouse->GetPosition();
28 | float cursorToPosDist = cursorToPosDir.x * cursorToPosDir.x + cursorToPosDir.y * cursorToPosDir.y;
29 | float cursorSize = mouse->GetCursorSize();
30 | isSelected = cursorToPosDist < cursorSize * cursorSize;
31 |
32 | for (Stick* stick : sticks)
33 | {
34 | if(stick != nullptr)
35 | stick->SetIsSelected(isSelected);
36 | }
37 |
38 | if(mouse->GetLeftButtonDown() && isSelected)
39 | {
40 | Vec2 difference = mouse->GetPosition() - mouse->GetPreviousPosition();
41 |
42 | if (difference.x > elasticity) difference.x = elasticity;
43 | if (difference.y > elasticity) difference.y = elasticity;
44 | if (difference.x < -elasticity) difference.x = -elasticity;
45 | if (difference.y < -elasticity) difference.y = -elasticity;
46 |
47 | prevPos = pos - difference;
48 | }
49 |
50 | if (mouse->GetRightMouseButton() && isSelected)
51 | {
52 | for (Stick* stick : sticks)
53 | {
54 | if (stick != nullptr)
55 | stick->Break();
56 | }
57 | }
58 |
59 | if (isPinned) {
60 | pos = initPos;
61 | return;
62 | }
63 |
64 | Vec2 newPos = pos + (pos - prevPos) * (1.0f - drag) + acceleration * (1.0f - drag) * deltaTime * deltaTime;
65 | prevPos = pos;
66 | pos = newPos;
67 |
68 | KeepInsideView(windowWidth, windowHeight);
69 | }
70 |
71 | void Point::KeepInsideView(int windowWidth, int windowHeight)
72 | {
73 | if (pos.x > windowWidth)
74 | {
75 | pos.x = windowWidth;
76 | prevPos.x = pos.x;
77 | }
78 | else if (pos.x < 0)
79 | {
80 | pos.x = 0;
81 | prevPos.x = pos.x;
82 | }
83 |
84 | if (pos.y > windowHeight)
85 | {
86 | pos.y = windowHeight;
87 | prevPos.y = pos.y;
88 | }
89 | else if (pos.y < 0)
90 | {
91 | pos.y = 0;
92 | prevPos.y = pos.y;
93 | }
94 | }
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_quit.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_test_compare.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README.md:
--------------------------------------------------------------------------------
1 | Simple DirectMedia Layer {#mainpage}
2 | ========================
3 |
4 | (SDL)
5 |
6 | Version 2.0
7 |
8 | ---
9 | http://www.libsdl.org/
10 |
11 | Simple DirectMedia Layer is a cross-platform development library designed
12 | to provide low level access to audio, keyboard, mouse, joystick, and graphics
13 | hardware via OpenGL and Direct3D. It is used by video playback software,
14 | emulators, and popular games including Valve's award winning catalog
15 | and many Humble Bundle games.
16 |
17 | SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
18 | Support for other platforms may be found in the source code.
19 |
20 | SDL is written in C, works natively with C++, and there are bindings
21 | available for several other languages, including C# and Python.
22 |
23 | This library is distributed under the zlib license, which can be found
24 | in the file "LICENSE.txt".
25 |
26 | The best way to learn how to use SDL is to check out the header files in
27 | the "include" subdirectory and the programs in the "test" subdirectory.
28 | The header files and test programs are well commented and always up to date.
29 |
30 | More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/)
31 |
32 | - [Android](README-android.md)
33 | - [CMake](README-cmake.md)
34 | - [DirectFB](README-directfb.md)
35 | - [DynAPI](README-dynapi.md)
36 | - [Emscripten](README-emscripten.md)
37 | - [Gesture](README-gesture.md)
38 | - [Git](README-git.md)
39 | - [iOS](README-ios.md)
40 | - [Linux](README-linux.md)
41 | - [OS X](README-macosx.md)
42 | - [Native Client](README-nacl.md)
43 | - [Pandora](README-pandora.md)
44 | - [Supported Platforms](README-platforms.md)
45 | - [Porting information](README-porting.md)
46 | - [PSP](README-psp.md)
47 | - [Raspberry Pi](README-raspberrypi.md)
48 | - [Touch](README-touch.md)
49 | - [WinCE](README-wince.md)
50 | - [Windows](README-windows.md)
51 | - [WinRT](README-winrt.md)
52 | - [PSVita](README-vita.md)
53 |
54 | If you need help with the library, or just want to discuss SDL related
55 | issues, you can join the [SDL Discourse](https://discourse.libsdl.org/),
56 | which can be used as a web forum or a mailing list, at your preference.
57 |
58 | If you want to report bugs or contribute patches, please submit them to
59 | [our bug tracker](https://github.com/libsdl-org/SDL/issues)
60 |
61 | Enjoy!
62 |
63 |
64 | Sam Lantinga
65 |
66 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-windows.md:
--------------------------------------------------------------------------------
1 | Windows
2 | ================================================================================
3 |
4 | ================================================================================
5 | OpenGL ES 2.x support
6 | ================================================================================
7 |
8 | SDL has support for OpenGL ES 2.x under Windows via two alternative
9 | implementations.
10 | The most straightforward method consists in running your app in a system with
11 | a graphic card paired with a relatively recent (as of November of 2013) driver
12 | which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
13 | to ship said extension on Windows currently include nVidia and Intel.
14 |
15 | The other method involves using the ANGLE library (https://code.google.com/p/angleproject/)
16 | If an OpenGL ES 2.x context is requested and no WGL_EXT_create_context_es2_profile
17 | extension is found, SDL will try to load the libEGL.dll library provided by
18 | ANGLE.
19 | To obtain the ANGLE binaries, you can either compile from source from
20 | https://chromium.googlesource.com/angle/angle or copy the relevant binaries from
21 | a recent Chrome/Chromium install for Windows. The files you need are:
22 |
23 | * libEGL.dll
24 | * libGLESv2.dll
25 | * d3dcompiler_46.dll (supports Windows Vista or later, better shader compiler)
26 | or...
27 | * d3dcompiler_43.dll (supports Windows XP or later)
28 |
29 | If you compile ANGLE from source, you can configure it so it does not need the
30 | d3dcompiler_* DLL at all (for details on this, see their documentation).
31 | However, by default SDL will try to preload the d3dcompiler_46.dll to
32 | comply with ANGLE's requirements. If you wish SDL to preload d3dcompiler_43.dll (to
33 | support Windows XP) or to skip this step at all, you can use the
34 | SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more details).
35 |
36 | Known Bugs:
37 |
38 | * SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
39 | that there's a bug in the library which prevents the window contents from
40 | refreshing if this is set to anything other than the default value.
41 |
42 | Vulkan Surface Support
43 | ==============
44 |
45 | Support for creating Vulkan surfaces is configured on by default. To disable it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to use Vulkan graphics in your application.
46 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_test_images.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_test_font.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/source/Application.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "Application.h"
3 |
4 | void Application::Setup(int clothWidth, int clothHeight, int clothSpacing)
5 | {
6 | renderer = new Renderer();
7 | mouse = new Mouse();
8 |
9 | isRunning = renderer->Setup();
10 |
11 | clothWidth /= clothSpacing;
12 | clothHeight /= clothSpacing;
13 | int startX = renderer->GetWindowWidth() * 0.5f - clothWidth * clothSpacing * 0.5f;
14 | int startY = renderer->GetWindowHeight() * 0.1f;
15 |
16 | cloth = new Cloth(clothWidth, clothHeight, clothSpacing, startX, startY);
17 |
18 | lastUpdateTime = SDL_GetTicks();
19 | }
20 |
21 | void Application::Input()
22 | {
23 | SDL_Event event;
24 | while (SDL_PollEvent(&event))
25 | {
26 | switch (event.type)
27 | {
28 | case SDL_QUIT:
29 | isRunning = false;
30 | break;
31 | case SDL_KEYDOWN:
32 | if (event.key.keysym.sym == SDLK_ESCAPE)
33 | {
34 | isRunning = false;
35 | }
36 | break;
37 | case SDL_MOUSEMOTION:
38 | {
39 | int x = event.motion.x;
40 | int y = event.motion.y;
41 | mouse->UpdatePosition(x, y);
42 | }
43 | break;
44 | case SDL_MOUSEBUTTONDOWN:
45 | int x, y;
46 | SDL_GetMouseState(&x, &y);
47 | mouse->UpdatePosition(x, y);
48 |
49 | if (!mouse->GetLeftButtonDown() && event.button.button == SDL_BUTTON_LEFT)
50 | {
51 | mouse->SetLeftMouseButton(true);
52 | }
53 | if (!mouse->GetRightMouseButton() && event.button.button == SDL_BUTTON_RIGHT)
54 | {
55 | mouse->SetRightMouseButton(true);
56 | }
57 | break;
58 | case SDL_MOUSEBUTTONUP:
59 | if (mouse->GetLeftButtonDown() && event.button.button == SDL_BUTTON_LEFT)
60 | {
61 | mouse->SetLeftMouseButton(false);
62 | }
63 | if (mouse->GetRightMouseButton() && event.button.button == SDL_BUTTON_RIGHT)
64 | {
65 | mouse->SetRightMouseButton(false);
66 | }
67 | break;
68 | case SDL_MOUSEWHEEL:
69 | if (event.wheel.y > 0)
70 | {
71 | mouse->IncreaseCursorSize(10);
72 | }
73 | else if (event.wheel.y < 0)
74 | {
75 | mouse->IncreaseCursorSize(-10);
76 | }
77 | break;
78 | }
79 | }
80 | }
81 |
82 | void Application::Update()
83 | {
84 | Uint32 currentTime = SDL_GetTicks();
85 | float deltaTime = (currentTime - lastUpdateTime) / 1000.0f;
86 |
87 | cloth->Update(renderer, mouse, deltaTime);
88 |
89 | lastUpdateTime = currentTime;
90 | }
91 |
92 | void Application::Render() const
93 | {
94 | renderer->ClearScreen(0xFF000816);
95 |
96 | cloth->Draw(renderer);
97 |
98 | renderer->Render();
99 | }
100 |
101 |
102 | bool Application::IsRunning() const
103 | {
104 | return isRunning;
105 | }
106 |
107 | void Application::Destroy()
108 | {
109 | delete mouse;
110 | delete renderer;
111 | delete cloth;
112 | }
113 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_config_minimal.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2017 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDL_config_minimal_h_
23 | #define SDL_config_minimal_h_
24 | #define SDL_config_h_
25 |
26 | #include "SDL_platform.h"
27 |
28 | /**
29 | * \file SDL_config_minimal.h
30 | *
31 | * This is the minimal configuration that can be used to build SDL.
32 | */
33 |
34 | #define HAVE_STDARG_H 1
35 | #define HAVE_STDDEF_H 1
36 |
37 | /* Most everything except Visual Studio 2008 and earlier has stdint.h now */
38 | #if defined(_MSC_VER) && (_MSC_VER < 1600)
39 | /* Here are some reasonable defaults */
40 | typedef unsigned int size_t;
41 | typedef signed char int8_t;
42 | typedef unsigned char uint8_t;
43 | typedef signed short int16_t;
44 | typedef unsigned short uint16_t;
45 | typedef signed int int32_t;
46 | typedef unsigned int uint32_t;
47 | typedef signed long long int64_t;
48 | typedef unsigned long long uint64_t;
49 | typedef unsigned long uintptr_t;
50 | #else
51 | #define HAVE_STDINT_H 1
52 | #endif /* Visual Studio 2008 */
53 |
54 | #ifdef __GNUC__
55 | #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
56 | #endif
57 |
58 | /* Enable the dummy audio driver (src/audio/dummy/\*.c) */
59 | #define SDL_AUDIO_DRIVER_DUMMY 1
60 |
61 | /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
62 | #define SDL_JOYSTICK_DISABLED 1
63 |
64 | /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
65 | #define SDL_HAPTIC_DISABLED 1
66 |
67 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
68 | #define SDL_LOADSO_DISABLED 1
69 |
70 | /* Enable the stub thread support (src/thread/generic/\*.c) */
71 | #define SDL_THREADS_DISABLED 1
72 |
73 | /* Enable the stub timer support (src/timer/dummy/\*.c) */
74 | #define SDL_TIMERS_DISABLED 1
75 |
76 | /* Enable the dummy video driver (src/video/dummy/\*.c) */
77 | #define SDL_VIDEO_DRIVER_DUMMY 1
78 |
79 | /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
80 | #define SDL_FILESYSTEM_DUMMY 1
81 |
82 | #endif /* SDL_config_minimal_h_ */
83 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_clipboard.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 | * \sa SDL_GetClipboardText
49 | * \sa SDL_HasClipboardText
50 | */
51 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
52 |
53 | /**
54 | * Get UTF-8 text from the clipboard, which must be freed with SDL_free().
55 | *
56 | * This functions returns NULL if there was not enough memory left for a copy
57 | * of the clipboard's content.
58 | *
59 | * \returns the clipboard text on success or NULL on failure; call
60 | * SDL_GetError() for more information. Caller must call SDL_free()
61 | * on the returned pointer when done with it.
62 | *
63 | * \sa SDL_HasClipboardText
64 | * \sa SDL_SetClipboardText
65 | */
66 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
67 |
68 | /**
69 | * Query whether the clipboard exists and contains a non-empty text string.
70 | *
71 | * \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not.
72 | *
73 | * \since This function is available since SDL 2.0.0.
74 | *
75 | * \sa SDL_GetClipboardText
76 | * \sa SDL_SetClipboardText
77 | */
78 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
79 |
80 |
81 | /* Ends C function definitions when using C++ */
82 | #ifdef __cplusplus
83 | }
84 | #endif
85 | #include "close_code.h"
86 |
87 | #endif /* SDL_clipboard_h_ */
88 |
89 | /* vi: set ts=4 sw=4 expandtab: */
90 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-directfb.md:
--------------------------------------------------------------------------------
1 | DirectFB
2 | ========
3 |
4 | Supports:
5 |
6 | - Hardware YUV overlays
7 | - OpenGL - software only
8 | - 2D/3D accelerations (depends on directfb driver)
9 | - multiple displays
10 | - windows
11 |
12 | What you need:
13 |
14 | * DirectFB 1.0.1, 1.2.x, 1.3.0
15 | * Kernel-Framebuffer support: required: vesafb, radeonfb ....
16 | * Mesa 7.0.x - optional for OpenGL
17 |
18 | /etc/directfbrc
19 |
20 | This file should contain the following lines to make
21 | your joystick work and avoid crashes:
22 | ------------------------
23 | disable-module=joystick
24 | disable-module=cle266
25 | disable-module=cyber5k
26 | no-linux-input-grab
27 | ------------------------
28 |
29 | To disable to use x11 backend when DISPLAY variable is found use
30 |
31 | export SDL_DIRECTFB_X11_CHECK=0
32 |
33 | To disable the use of linux input devices, i.e. multimice/multikeyboard support,
34 | use
35 |
36 | export SDL_DIRECTFB_LINUX_INPUT=0
37 |
38 | To use hardware accelerated YUV-overlays for YUV-textures, use:
39 |
40 | export SDL_DIRECTFB_YUV_DIRECT=1
41 |
42 | This is disabled by default. It will only support one
43 | YUV texture, namely the first. Every other YUV texture will be
44 | rendered in software.
45 |
46 | In addition, you may use (directfb-1.2.x)
47 |
48 | export SDL_DIRECTFB_YUV_UNDERLAY=1
49 |
50 | to make the YUV texture an underlay. This will make the cursor to
51 | be shown.
52 |
53 | Simple Window Manager
54 | =====================
55 |
56 | The driver has support for a very, very basic window manager you may
57 | want to use when running with "wm=default". Use
58 |
59 | export SDL_DIRECTFB_WM=1
60 |
61 | to enable basic window borders. In order to have the window title rendered,
62 | you need to have the following font installed:
63 |
64 | /usr/share/fonts/truetype/freefont/FreeSans.ttf
65 |
66 | OpenGL Support
67 | ==============
68 |
69 | The following instructions will give you *software* OpenGL. However this
70 | works at least on all directfb supported platforms.
71 |
72 | As of this writing 20100802 you need to pull Mesa from git and do the following:
73 |
74 | ------------------------
75 | git clone git://anongit.freedesktop.org/git/mesa/mesa
76 | cd mesa
77 | git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
78 | ------------------------
79 |
80 | Edit configs/linux-directfb so that the Directories-section looks like
81 | ------------------------
82 | # Directories
83 | SRC_DIRS = mesa glu
84 | GLU_DIRS = sgi
85 | DRIVER_DIRS = directfb
86 | PROGRAM_DIRS =
87 | ------------------------
88 |
89 | make linux-directfb
90 | make
91 |
92 | echo Installing - please enter sudo pw.
93 |
94 | sudo make install INSTALL_DIR=/usr/local/dfb_GL
95 | cd src/mesa/drivers/directfb
96 | make
97 | sudo make install INSTALL_DIR=/usr/local/dfb_GL
98 | ------------------------
99 |
100 | To run the SDL - testprograms:
101 |
102 | export SDL_VIDEODRIVER=directfb
103 | export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
104 | export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
105 |
106 | ./testgl
107 |
108 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_misc.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 in SDL 2.0.14 and newer
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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_power.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 | extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
77 |
78 | /* Ends C function definitions when using C++ */
79 | #ifdef __cplusplus
80 | }
81 | #endif
82 | #include "close_code.h"
83 |
84 | #endif /* SDL_power_h_ */
85 |
86 | /* vi: set ts=4 sw=4 expandtab: */
87 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_metal.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 | * \sa SDL_Metal_DestroyView
62 | * \sa SDL_Metal_GetLayer
63 | */
64 | extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
65 |
66 | /**
67 | * Destroy an existing SDL_MetalView object.
68 | *
69 | * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
70 | * called after SDL_CreateWindow.
71 | *
72 | * \sa SDL_Metal_CreateView
73 | */
74 | extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
75 |
76 | /**
77 | * Get a pointer to the backing CAMetalLayer for the given view.
78 | *
79 | * \sa SDL_MetalCreateView
80 | */
81 | extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
82 |
83 | /**
84 | * Get the size of a window's underlying drawable in pixels (for use with
85 | * setting viewport, scissor & etc).
86 | *
87 | * \param window SDL_Window from which the drawable size should be queried
88 | * \param w Pointer to variable for storing the width in pixels, may be NULL
89 | *
90 | * \sa SDL_GetWindowSize
91 | * \sa SDL_CreateWindow
92 | */
93 | extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w,
94 | int *h);
95 |
96 | /* @} *//* Metal support functions */
97 |
98 | /* Ends C function definitions when using C++ */
99 | #ifdef __cplusplus
100 | }
101 | #endif
102 | #include "close_code.h"
103 |
104 | #endif /* SDL_metal_h_ */
105 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-cmake.md:
--------------------------------------------------------------------------------
1 | CMake
2 | ================================================================================
3 | (www.cmake.org)
4 |
5 | SDL's build system was traditionally based on autotools. Over time, this
6 | approach has suffered from several issues across the different supported
7 | platforms.
8 | To solve these problems, a new build system based on CMake is under development.
9 | It works in parallel to the legacy system, so users can experiment with it
10 | without complication.
11 | While still experimental, the build system should be usable on the following
12 | platforms:
13 |
14 | * FreeBSD
15 | * Linux
16 | * VS.NET 2010
17 | * MinGW and Msys
18 | * macOS, iOS, and tvOS, with support for XCode
19 |
20 |
21 | ================================================================================
22 | Usage
23 | ================================================================================
24 |
25 | Assuming the source for SDL is located at ~/sdl
26 |
27 | cd ~
28 | mkdir build
29 | cd build
30 | cmake ../sdl
31 |
32 | This will build the static and dynamic versions of SDL in the ~/build directory.
33 |
34 |
35 | ================================================================================
36 | Usage, iOS/tvOS
37 | ================================================================================
38 |
39 | CMake 3.14+ natively includes support for iOS and tvOS. SDL binaries may be built
40 | using Xcode or Make, possibly among other build-systems.
41 |
42 | When using a recent version of CMake (3.14+), it should be possible to:
43 |
44 | - build SDL for iOS, both static and dynamic
45 | - build SDL test apps (as iOS/tvOS .app bundles)
46 | - generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
47 |
48 | To use, set the following CMake variables when running CMake's configuration stage:
49 |
50 | - `CMAKE_SYSTEM_NAME=` (either `iOS` or `tvOS`)
51 | - `CMAKE_OSX_SYSROOT=` (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
52 | `appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
53 | - `CMAKE_OSX_ARCHITECTURES=` (example: "arm64;armv7s;x86_64")
54 |
55 |
56 | ### Examples (for iOS/tvOS):
57 |
58 | - for iOS-Simulator, using the latest, installed SDK:
59 |
60 | `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
61 |
62 | - for iOS-Device, using the latest, installed SDK, 64-bit only
63 |
64 | `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64`
65 |
66 | - for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
67 |
68 | `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"`
69 |
70 | - for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
71 |
72 | `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64`
73 |
74 | - for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
75 |
76 | `cmake ~/sdl -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
77 |
78 | - for tvOS-Simulator, using the latest, installed SDK:
79 |
80 | `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
81 |
82 | - for tvOS-Device, using the latest, installed SDK:
83 |
84 | `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`
85 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_test_random.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_test_assert.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_config_wiz.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2017 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDL_config_wiz_h_
23 | #define SDL_config_wiz_h_
24 | #define SDL_config_h_
25 |
26 | /* This is a set of defines to configure the SDL features */
27 |
28 | /* General platform specific identifiers */
29 | #include "SDL_platform.h"
30 |
31 | #define SDL_BYTEORDER 1234
32 |
33 | #define HAVE_ALLOCA_H 1
34 | #define HAVE_SYS_TYPES_H 1
35 | #define HAVE_STDIO_H 1
36 | #define STDC_HEADERS 1
37 | #define HAVE_STDLIB_H 1
38 | #define HAVE_STDARG_H 1
39 | #define HAVE_MALLOC_H 1
40 | #define HAVE_MEMORY_H 1
41 | #define HAVE_STRING_H 1
42 | #define HAVE_STRINGS_H 1
43 | #define HAVE_INTTYPES_H 1
44 | #define HAVE_STDINT_H 1
45 | #define HAVE_CTYPE_H 1
46 | #define HAVE_MATH_H 1
47 | #define HAVE_ICONV_H 1
48 | #define HAVE_SIGNAL_H 1
49 | #define HAVE_MALLOC 1
50 | #define HAVE_CALLOC 1
51 | #define HAVE_REALLOC 1
52 | #define HAVE_FREE 1
53 | #define HAVE_ALLOCA 1
54 | #define HAVE_GETENV 1
55 | #define HAVE_SETENV 1
56 | #define HAVE_PUTENV 1
57 | #define HAVE_UNSETENV 1
58 | #define HAVE_QSORT 1
59 | #define HAVE_ABS 1
60 | #define HAVE_BCOPY 1
61 | #define HAVE_MEMSET 1
62 | #define HAVE_MEMCPY 1
63 | #define HAVE_MEMMOVE 1
64 | #define HAVE_STRLEN 1
65 | #define HAVE_STRDUP 1
66 | #define HAVE_STRCHR 1
67 | #define HAVE_STRRCHR 1
68 | #define HAVE_STRSTR 1
69 | #define HAVE_STRTOL 1
70 | #define HAVE_STRTOUL 1
71 | #define HAVE_STRTOLL 1
72 | #define HAVE_STRTOULL 1
73 | #define HAVE_ATOI 1
74 | #define HAVE_ATOF 1
75 | #define HAVE_STRCMP 1
76 | #define HAVE_STRNCMP 1
77 | #define HAVE_STRCASECMP 1
78 | #define HAVE_STRNCASECMP 1
79 | #define HAVE_VSSCANF 1
80 | #define HAVE_VSNPRINTF 1
81 | #define HAVE_M_PI 1
82 | #define HAVE_CEIL 1
83 | #define HAVE_COPYSIGN 1
84 | #define HAVE_COS 1
85 | #define HAVE_COSF 1
86 | #define HAVE_FABS 1
87 | #define HAVE_FLOOR 1
88 | #define HAVE_LOG 1
89 | #define HAVE_SCALBN 1
90 | #define HAVE_SIN 1
91 | #define HAVE_SINF 1
92 | #define HAVE_SQRT 1
93 | #define HAVE_SQRTF 1
94 | #define HAVE_TAN 1
95 | #define HAVE_TANF 1
96 | #define HAVE_SIGACTION 1
97 | #define HAVE_SETJMP 1
98 | #define HAVE_NANOSLEEP 1
99 | #define HAVE_POW 1
100 |
101 | #define SDL_AUDIO_DRIVER_DUMMY 1
102 | #define SDL_AUDIO_DRIVER_OSS 1
103 |
104 | #define SDL_INPUT_LINUXEV 1
105 | #define SDL_INPUT_TSLIB 1
106 | #define SDL_JOYSTICK_LINUX 1
107 | #define SDL_HAPTIC_LINUX 1
108 |
109 | #define SDL_LOADSO_DLOPEN 1
110 |
111 | #define SDL_THREAD_PTHREAD 1
112 | #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
113 |
114 | #define SDL_TIMER_UNIX 1
115 |
116 | #define SDL_VIDEO_DRIVER_DUMMY 1
117 | #define SDL_VIDEO_DRIVER_PANDORA 1
118 | #define SDL_VIDEO_RENDER_OGL_ES 1
119 | #define SDL_VIDEO_OPENGL_ES 1
120 |
121 | #endif /* SDL_config_wiz_h_ */
122 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-linux.md:
--------------------------------------------------------------------------------
1 | Linux
2 | ================================================================================
3 |
4 | By default SDL will only link against glibc, the rest of the features will be
5 | enabled dynamically at runtime depending on the available features on the target
6 | system. So, for example if you built SDL with Xinerama support and the target
7 | system does not have the Xinerama libraries installed, it will be disabled
8 | at runtime, and you won't get a missing library error, at least with the
9 | default configuration parameters.
10 |
11 |
12 | Build Dependencies
13 | --------------------------------------------------------------------------------
14 |
15 | Ubuntu 20.04, all available features enabled:
16 |
17 | sudo apt-get install build-essential git make cmake autoconf automake \
18 | libtool pkg-config libasound2-dev libpulse-dev libaudio-dev libjack-dev \
19 | libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev \
20 | libxinerama-dev libxxf86vm-dev libxss-dev libgl1-mesa-dev libdbus-1-dev \
21 | libudev-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
22 | fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev \
23 | libxkbcommon-dev libdrm-dev libgbm-dev
24 |
25 | NOTES:
26 | - This includes all the audio targets except arts and esd, because Ubuntu
27 | (and/or Debian) pulled their packages, but in theory SDL still supports them.
28 | - libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
29 | for higher-quality audio resampling. SDL will work without it if the library
30 | is missing, so it's safe to build in support even if the end user doesn't
31 | have this library installed.
32 | - DirectFB isn't included because the configure script (currently) fails to find
33 | it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the
34 | configure script to include DirectFB support. Send patches. :)
35 |
36 |
37 | Joystick does not work
38 | --------------------------------------------------------------------------------
39 |
40 | If you compiled or are using a version of SDL with udev support (and you should!)
41 | there's a few issues that may cause SDL to fail to detect your joystick. To
42 | debug this, start by installing the evtest utility. On Ubuntu/Debian:
43 |
44 | sudo apt-get install evtest
45 |
46 | Then run:
47 |
48 | sudo evtest
49 |
50 | You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
51 | Now run:
52 |
53 | cat /dev/input/event/XX
54 |
55 | If you get a permission error, you need to set a udev rule to change the mode of
56 | your device (see below)
57 |
58 | Also, try:
59 |
60 | sudo udevadm info --query=all --name=input/eventXX
61 |
62 | If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
63 | you need to set up an udev rule to force this variable.
64 |
65 | A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks
66 | like:
67 |
68 | SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
69 | SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
70 |
71 | You can set up similar rules for your device by changing the values listed in
72 | idProduct and idVendor. To obtain these values, try:
73 |
74 | sudo udevadm info -a --name=input/eventXX | grep idVendor
75 | sudo udevadm info -a --name=input/eventXX | grep idProduct
76 |
77 | If multiple values come up for each of these, the one you want is the first one of each.
78 |
79 | On other systems which ship with an older udev (such as CentOS), you may need
80 | to set up a rule such as:
81 |
82 | SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
83 |
84 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_bits.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_config_pandora.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2017 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDL_config_pandora_h_
23 | #define SDL_config_pandora_h_
24 | #define SDL_config_h_
25 |
26 | /* This is a set of defines to configure the SDL features */
27 |
28 | /* General platform specific identifiers */
29 | #include "SDL_platform.h"
30 |
31 | #ifdef __LP64__
32 | #define SIZEOF_VOIDP 8
33 | #else
34 | #define SIZEOF_VOIDP 4
35 | #endif
36 |
37 | #define SDL_BYTEORDER 1234
38 |
39 | #define HAVE_ALLOCA_H 1
40 | #define HAVE_SYS_TYPES_H 1
41 | #define HAVE_STDIO_H 1
42 | #define STDC_HEADERS 1
43 | #define HAVE_STDLIB_H 1
44 | #define HAVE_STDARG_H 1
45 | #define HAVE_MALLOC_H 1
46 | #define HAVE_MEMORY_H 1
47 | #define HAVE_STRING_H 1
48 | #define HAVE_STRINGS_H 1
49 | #define HAVE_INTTYPES_H 1
50 | #define HAVE_STDINT_H 1
51 | #define HAVE_CTYPE_H 1
52 | #define HAVE_MATH_H 1
53 | #define HAVE_ICONV_H 1
54 | #define HAVE_SIGNAL_H 1
55 | #define HAVE_MALLOC 1
56 | #define HAVE_CALLOC 1
57 | #define HAVE_REALLOC 1
58 | #define HAVE_FREE 1
59 | #define HAVE_ALLOCA 1
60 | #define HAVE_GETENV 1
61 | #define HAVE_SETENV 1
62 | #define HAVE_PUTENV 1
63 | #define HAVE_UNSETENV 1
64 | #define HAVE_QSORT 1
65 | #define HAVE_ABS 1
66 | #define HAVE_BCOPY 1
67 | #define HAVE_MEMSET 1
68 | #define HAVE_MEMCPY 1
69 | #define HAVE_MEMMOVE 1
70 | #define HAVE_STRLEN 1
71 | #define HAVE_STRDUP 1
72 | #define HAVE_STRCHR 1
73 | #define HAVE_STRRCHR 1
74 | #define HAVE_STRSTR 1
75 | #define HAVE_STRTOL 1
76 | #define HAVE_STRTOUL 1
77 | #define HAVE_STRTOLL 1
78 | #define HAVE_STRTOULL 1
79 | #define HAVE_ATOI 1
80 | #define HAVE_ATOF 1
81 | #define HAVE_STRCMP 1
82 | #define HAVE_STRNCMP 1
83 | #define HAVE_STRCASECMP 1
84 | #define HAVE_STRNCASECMP 1
85 | #define HAVE_VSSCANF 1
86 | #define HAVE_VSNPRINTF 1
87 | #define HAVE_M_PI 1
88 | #define HAVE_CEIL 1
89 | #define HAVE_COPYSIGN 1
90 | #define HAVE_COS 1
91 | #define HAVE_COSF 1
92 | #define HAVE_FABS 1
93 | #define HAVE_FLOOR 1
94 | #define HAVE_LOG 1
95 | #define HAVE_SCALBN 1
96 | #define HAVE_SIN 1
97 | #define HAVE_SINF 1
98 | #define HAVE_SQRT 1
99 | #define HAVE_SQRTF 1
100 | #define HAVE_TAN 1
101 | #define HAVE_TANF 1
102 | #define HAVE_SIGACTION 1
103 | #define HAVE_SETJMP 1
104 | #define HAVE_NANOSLEEP 1
105 |
106 | #define SDL_AUDIO_DRIVER_DUMMY 1
107 | #define SDL_AUDIO_DRIVER_OSS 1
108 |
109 | #define SDL_INPUT_LINUXEV 1
110 | #define SDL_INPUT_TSLIB 1
111 | #define SDL_JOYSTICK_LINUX 1
112 | #define SDL_HAPTIC_LINUX 1
113 |
114 | #define SDL_LOADSO_DLOPEN 1
115 |
116 | #define SDL_THREAD_PTHREAD 1
117 | #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
118 |
119 | #define SDL_TIMER_UNIX 1
120 | #define SDL_FILESYSTEM_UNIX 1
121 |
122 | #define SDL_VIDEO_DRIVER_DUMMY 1
123 | #define SDL_VIDEO_DRIVER_X11 1
124 | #define SDL_VIDEO_DRIVER_PANDORA 1
125 | #define SDL_VIDEO_RENDER_OGL_ES 1
126 | #define SDL_VIDEO_OPENGL_ES 1
127 |
128 | #endif /* SDL_config_pandora_h_ */
129 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_gesture.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_test_crc32.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-gesture.md:
--------------------------------------------------------------------------------
1 | Dollar Gestures
2 | ===========================================================================
3 | SDL provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
4 |
5 | Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.
6 |
7 | Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID.
8 |
9 | Recording:
10 | ----------
11 | To begin recording on a touch device call:
12 | SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.
13 |
14 | Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
15 | A SDL_DOLLARRECORD event is a dgesture with the following fields:
16 |
17 | * event.dgesture.touchId - the Id of the touch used to record the gesture.
18 | * event.dgesture.gestureId - the unique id of the recorded gesture.
19 |
20 |
21 | Performing:
22 | -----------
23 | As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields:
24 |
25 | * event.dgesture.touchId - the Id of the touch which performed the gesture.
26 | * event.dgesture.gestureId - the unique id of the closest gesture to the performed stroke.
27 | * event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
28 | * event.dgesture.numFingers - the number of fingers used to draw the stroke.
29 |
30 | Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed).
31 |
32 |
33 |
34 | Saving:
35 | -------
36 | To save a template, call SDL_SaveDollarTemplate(gestureId, dst) where gestureId is the id of the gesture you want to save, and dst is an SDL_RWops pointer to the file where the gesture will be stored.
37 |
38 | To save all currently loaded templates, call SDL_SaveAllDollarTemplates(dst) where dst is an SDL_RWops pointer to the file where the gesture will be stored.
39 |
40 | Both functions return the number of gestures successfully saved.
41 |
42 |
43 | Loading:
44 | --------
45 | To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file.
46 |
47 | SDL_LoadDollarTemplates returns the number of templates successfully loaded.
48 |
49 |
50 |
51 | ===========================================================================
52 | Multi Gestures
53 | ===========================================================================
54 | SDL provides simple support for pinch/rotate/swipe gestures.
55 | Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
56 |
57 | * event.mgesture.touchId - the Id of the touch on which the gesture was performed.
58 | * event.mgesture.x - the normalized x coordinate of the gesture. (0..1)
59 | * event.mgesture.y - the normalized y coordinate of the gesture. (0..1)
60 | * event.mgesture.dTheta - the amount that the fingers rotated during this motion.
61 | * event.mgesture.dDist - the amount that the fingers pinched during this motion.
62 | * event.mgesture.numFingers - the number of fingers used in the gesture.
63 |
64 |
65 | ===========================================================================
66 | Notes
67 | ===========================================================================
68 | For a complete example see test/testgesture.c
69 |
70 | Please direct questions/comments to:
71 | jim.tla+sdl_touch@gmail.com
72 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_locale.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 | extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void);
90 |
91 | /* Ends C function definitions when using C++ */
92 | #ifdef __cplusplus
93 | /* *INDENT-OFF* */
94 | }
95 | /* *INDENT-ON* */
96 | #endif
97 | #include "close_code.h"
98 |
99 | #endif /* _SDL_locale_h */
100 |
101 | /* vi: set ts=4 sw=4 expandtab: */
102 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_loadso.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 | * \sa SDL_LoadFunction
61 | * \sa SDL_UnloadObject
62 | */
63 | extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
64 |
65 | /**
66 | * Look up the address of the named function in a shared object.
67 | *
68 | * This function pointer is no longer valid after calling SDL_UnloadObject().
69 | *
70 | * This function can only look up C function names. Other languages may have
71 | * name mangling and intrinsic language support that varies from compiler to
72 | * compiler.
73 | *
74 | * Make sure you declare your function pointers with the same calling
75 | * convention as the actual library function. Your code will crash
76 | * mysteriously if you do not do this.
77 | *
78 | * If the requested function doesn't exist, NULL is returned.
79 | *
80 | * \param handle a valid shared object handle returned by SDL_LoadObject()
81 | * \param name the name of the function to look up
82 | * \returns a pointer to the function or NULL if there was an error; call
83 | * SDL_GetError() for more information.
84 | *
85 | * \sa SDL_LoadObject
86 | * \sa SDL_UnloadObject
87 | */
88 | extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
89 | const char *name);
90 |
91 | /**
92 | * Unload a shared object from memory.
93 | *
94 | * \param handle a valid shared object handle returned by SDL_LoadObject()
95 | *
96 | * \sa SDL_LoadFunction
97 | * \sa SDL_LoadObject
98 | */
99 | extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
100 |
101 | /* Ends C function definitions when using C++ */
102 | #ifdef __cplusplus
103 | }
104 | #endif
105 | #include "close_code.h"
106 |
107 | #endif /* SDL_loadso_h_ */
108 |
109 | /* vi: set ts=4 sw=4 expandtab: */
110 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-touch.md:
--------------------------------------------------------------------------------
1 | Touch
2 | ===========================================================================
3 | System Specific Notes
4 | ===========================================================================
5 | Linux:
6 | The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it.
7 |
8 | Mac:
9 | The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
10 |
11 | iPhone:
12 | Works out of box.
13 |
14 | Windows:
15 | Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com
16 |
17 | ===========================================================================
18 | Events
19 | ===========================================================================
20 | SDL_FINGERDOWN:
21 | Sent when a finger (or stylus) is placed on a touch device.
22 | Fields:
23 | * event.tfinger.touchId - the Id of the touch device.
24 | * event.tfinger.fingerId - the Id of the finger which just went down.
25 | * event.tfinger.x - the x coordinate of the touch (0..1)
26 | * event.tfinger.y - the y coordinate of the touch (0..1)
27 | * event.tfinger.pressure - the pressure of the touch (0..1)
28 |
29 | SDL_FINGERMOTION:
30 | Sent when a finger (or stylus) is moved on the touch device.
31 | Fields:
32 | Same as SDL_FINGERDOWN but with additional:
33 | * event.tfinger.dx - change in x coordinate during this motion event.
34 | * event.tfinger.dy - change in y coordinate during this motion event.
35 |
36 | SDL_FINGERUP:
37 | Sent when a finger (or stylus) is lifted from the touch device.
38 | Fields:
39 | Same as SDL_FINGERDOWN.
40 |
41 |
42 | ===========================================================================
43 | Functions
44 | ===========================================================================
45 | SDL provides the ability to access the underlying SDL_Finger structures.
46 | These structures should _never_ be modified.
47 |
48 | The following functions are included from SDL_touch.h
49 |
50 | To get a SDL_TouchID call SDL_GetTouchDevice(int index).
51 | This returns a SDL_TouchID.
52 | IMPORTANT: If the touch has been removed, or there is no touch with the given index, SDL_GetTouchDevice() will return 0. Be sure to check for this!
53 |
54 | The number of touch devices can be queried with SDL_GetNumTouchDevices().
55 |
56 | A SDL_TouchID may be used to get pointers to SDL_Finger.
57 |
58 | SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device.
59 |
60 | The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following:
61 |
62 | float x = event.tfinger.x;
63 | float y = event.tfinger.y;
64 |
65 |
66 |
67 | To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger.
68 | This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed.
69 | A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
70 | As a result, be very careful to check for NULL return values.
71 |
72 | A SDL_Finger has the following fields:
73 | * x, y:
74 | The current coordinates of the touch.
75 | * pressure:
76 | The pressure of the touch.
77 |
78 |
79 | ===========================================================================
80 | Notes
81 | ===========================================================================
82 | For a complete example see test/testgesture.c
83 |
84 | Please direct questions/comments to:
85 | jim.tla+sdl_touch@gmail.com
86 | (original author, API was changed since)
87 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_config_psp.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2017 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDL_config_psp_h_
23 | #define SDL_config_psp_h_
24 | #define SDL_config_h_
25 |
26 | #include "SDL_platform.h"
27 |
28 |
29 |
30 | #ifdef __GNUC__
31 | #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
32 | #endif
33 |
34 | #define HAVE_GCC_ATOMICS 1
35 |
36 | #define HAVE_ALLOCA_H 1
37 | #define HAVE_SYS_TYPES_H 1
38 | #define HAVE_STDIO_H 1
39 | #define STDC_HEADERS 1
40 | #define HAVE_STRING_H 1
41 | #define HAVE_INTTYPES_H 1
42 | #define HAVE_STDINT_H 1
43 | #define HAVE_CTYPE_H 1
44 | #define HAVE_MATH_H 1
45 | #define HAVE_SIGNAL_H 1
46 |
47 | /* C library functions */
48 | #define HAVE_MALLOC 1
49 | #define HAVE_CALLOC 1
50 | #define HAVE_REALLOC 1
51 | #define HAVE_FREE 1
52 | #define HAVE_ALLOCA 1
53 | #define HAVE_GETENV 1
54 | #define HAVE_SETENV 1
55 | #define HAVE_PUTENV 1
56 | #define HAVE_SETENV 1
57 | #define HAVE_UNSETENV 1
58 | #define HAVE_QSORT 1
59 | #define HAVE_ABS 1
60 | #define HAVE_BCOPY 1
61 | #define HAVE_MEMSET 1
62 | #define HAVE_MEMCPY 1
63 | #define HAVE_MEMMOVE 1
64 | #define HAVE_MEMCMP 1
65 | #define HAVE_STRLEN 1
66 | #define HAVE_STRLCPY 1
67 | #define HAVE_STRLCAT 1
68 | #define HAVE_STRDUP 1
69 | #define HAVE_STRCHR 1
70 | #define HAVE_STRRCHR 1
71 | #define HAVE_STRSTR 1
72 | #define HAVE_STRTOL 1
73 | #define HAVE_STRTOUL 1
74 | #define HAVE_STRTOLL 1
75 | #define HAVE_STRTOULL 1
76 | #define HAVE_STRTOD 1
77 | #define HAVE_ATOI 1
78 | #define HAVE_ATOF 1
79 | #define HAVE_STRCMP 1
80 | #define HAVE_STRNCMP 1
81 | #define HAVE_STRCASECMP 1
82 | #define HAVE_STRNCASECMP 1
83 | #define HAVE_VSSCANF 1
84 | #define HAVE_VSNPRINTF 1
85 | #define HAVE_M_PI 1
86 | #define HAVE_ATAN 1
87 | #define HAVE_ATAN2 1
88 | #define HAVE_ACOS 1
89 | #define HAVE_ASIN 1
90 | #define HAVE_CEIL 1
91 | #define HAVE_COPYSIGN 1
92 | #define HAVE_COS 1
93 | #define HAVE_COSF 1
94 | #define HAVE_FABS 1
95 | #define HAVE_FLOOR 1
96 | #define HAVE_LOG 1
97 | #define HAVE_POW 1
98 | #define HAVE_SCALBN 1
99 | #define HAVE_SIN 1
100 | #define HAVE_SINF 1
101 | #define HAVE_SQRT 1
102 | #define HAVE_SQRTF 1
103 | #define HAVE_TAN 1
104 | #define HAVE_TANF 1
105 | #define HAVE_SETJMP 1
106 | #define HAVE_NANOSLEEP 1
107 | /* #define HAVE_SYSCONF 1 */
108 | /* #define HAVE_SIGACTION 1 */
109 |
110 |
111 | /* PSP isn't that sophisticated */
112 | #define LACKS_SYS_MMAN_H 1
113 |
114 | /* Enable the stub thread support (src/thread/psp/\*.c) */
115 | #define SDL_THREAD_PSP 1
116 |
117 | /* Enable the stub timer support (src/timer/psp/\*.c) */
118 | #define SDL_TIMERS_PSP 1
119 |
120 | /* Enable the stub joystick driver (src/joystick/psp/\*.c) */
121 | #define SDL_JOYSTICK_PSP 1
122 |
123 | /* Enable the stub audio driver (src/audio/psp/\*.c) */
124 | #define SDL_AUDIO_DRIVER_PSP 1
125 |
126 | /* PSP video dirver */
127 | #define SDL_VIDEO_DRIVER_PSP 1
128 |
129 | /* PSP render dirver */
130 | #define SDL_VIDEO_RENDER_PSP 1
131 |
132 | #define SDL_POWER_PSP 1
133 |
134 | /* !!! FIXME: what does PSP do for filesystem stuff? */
135 | #define SDL_FILESYSTEM_DUMMY 1
136 |
137 | /* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
138 | #define SDL_HAPTIC_DISABLED 1
139 |
140 | /* PSP can't load shared object (src/loadso/dummy/\*.c) */
141 | #define SDL_LOADSO_DISABLED 1
142 |
143 |
144 | #endif /* SDL_config_psp_h_ */
145 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-nacl.md:
--------------------------------------------------------------------------------
1 | Native Client
2 | ================================================================================
3 |
4 | Requirements:
5 |
6 | * Native Client SDK (https://developer.chrome.com/native-client),
7 | (tested with Pepper version 33 or higher).
8 |
9 | The SDL backend for Chrome's Native Client has been tested only with the PNaCl
10 | toolchain, which generates binaries designed to run on ARM and x86_32/64
11 | platforms. This does not mean it won't work with the other toolchains!
12 |
13 | ================================================================================
14 | Building SDL for NaCl
15 | ================================================================================
16 |
17 | Set up the right environment variables (see naclbuild.sh), then configure SDL with:
18 |
19 | configure --host=pnacl --prefix some/install/destination
20 |
21 | Then "make".
22 |
23 | As an example of how to create a deployable app a Makefile project is provided
24 | in test/nacl/Makefile, which includes some monkey patching of the common.mk file
25 | provided by NaCl, without which linking properly to SDL won't work (the search
26 | path can't be modified externally, so the linker won't find SDL's binaries unless
27 | you dump them into the SDK path, which is inconvenient).
28 | Also provided in test/nacl is the required support file, such as index.html,
29 | manifest.json, etc.
30 | SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure.
31 | This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem),
32 | hiding the asynchronous nature of the browser behind the scenes...which is not the
33 | same as making it disappear!
34 |
35 |
36 | ================================================================================
37 | Running tests
38 | ================================================================================
39 |
40 | Due to the nature of NaCl programs, building and running SDL tests is not as
41 | straightforward as one would hope. The script naclbuild.sh in build-scripts
42 | automates the process and should serve as a guide for users of SDL trying to build
43 | their own applications.
44 |
45 | Basic usage:
46 |
47 | ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
48 |
49 | This will build testgles2.c by default.
50 |
51 | If you want to build a different test, for example testrendercopyex.c:
52 |
53 | SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
54 |
55 | Once the build finishes, you have to serve the contents with a web server (the
56 | script will give you instructions on how to do that with Python).
57 |
58 | ================================================================================
59 | RWops and nacl_io
60 | ================================================================================
61 |
62 | SDL_RWops work transparently with nacl_io. Two functions control the mount points:
63 |
64 | int mount(const char* source, const char* target,
65 | const char* filesystemtype,
66 | unsigned long mountflags, const void *data);
67 | int umount(const char *target);
68 |
69 | For convenience, SDL will by default mount an httpfs tree at / before calling
70 | the app's main function. Such setting can be overridden by calling:
71 |
72 | umount("/");
73 |
74 | And then mounting a different filesystem at /
75 |
76 | It's important to consider that the asynchronous nature of file operations on a
77 | browser is hidden from the application, effectively providing the developer with
78 | a set of blocking file operations just like you get in a regular desktop
79 | environment, which eases the job of porting to Native Client, but also introduces
80 | a set of challenges of its own, in particular when big file sizes and slow
81 | connections are involved.
82 |
83 | For more information on how nacl_io and mount points work, see:
84 |
85 | https://developer.chrome.com/native-client/devguide/coding/nacl_io
86 | https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h
87 |
88 | To be able to save into the directory "/save/" (like backup of game) :
89 |
90 | mount("", "/save", "html5fs", 0, "type=PERSISTENT");
91 |
92 | And add to manifest.json :
93 |
94 | "permissions": [
95 | "unlimitedStorage"
96 | ]
97 |
98 | ================================================================================
99 | TODO - Known Issues
100 | ================================================================================
101 | * Testing of all systems with a real application (something other than SDL's tests)
102 | * Key events don't seem to work properly
103 |
104 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_touch.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 | extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID);
102 |
103 | /**
104 | * Get the number of active fingers for a given touch device.
105 | *
106 | * \param touchID the ID of a touch device
107 | * \returns the number of active fingers for a given touch device on success
108 | * or 0 on failure; call SDL_GetError() for more information.
109 | *
110 | * \since This function is available since SDL 2.0.0.
111 | *
112 | * \sa SDL_GetTouchFinger
113 | */
114 | extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
115 |
116 | /**
117 | * Get the finger object for specified touch device ID and finger index.
118 | *
119 | * The returned resource is owned by SDL and should not be deallocated.
120 | *
121 | * \param touchID the ID of the requested touch device
122 | * \param index the index of the requested finger
123 | * \returns a pointer to the SDL_Finger object or NULL if no object at the
124 | * given ID and index could be found.
125 | *
126 | * \sa SDL_RecordGesture
127 | */
128 | extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
129 |
130 | /* Ends C function definitions when using C++ */
131 | #ifdef __cplusplus
132 | }
133 | #endif
134 | #include "close_code.h"
135 |
136 | #endif /* SDL_touch_h_ */
137 |
138 | /* vi: set ts=4 sw=4 expandtab: */
139 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_config_android.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2017 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDL_config_android_h_
23 | #define SDL_config_android_h_
24 | #define SDL_config_h_
25 |
26 | #include "SDL_platform.h"
27 |
28 | /**
29 | * \file SDL_config_android.h
30 | *
31 | * This is a configuration that can be used to build SDL for Android
32 | */
33 |
34 | #include
35 |
36 | #define HAVE_GCC_ATOMICS 1
37 |
38 | #define HAVE_ALLOCA_H 1
39 | #define HAVE_SYS_TYPES_H 1
40 | #define HAVE_STDIO_H 1
41 | #define STDC_HEADERS 1
42 | #define HAVE_STRING_H 1
43 | #define HAVE_INTTYPES_H 1
44 | #define HAVE_STDINT_H 1
45 | #define HAVE_CTYPE_H 1
46 | #define HAVE_MATH_H 1
47 | #define HAVE_SIGNAL_H 1
48 |
49 | /* C library functions */
50 | #define HAVE_MALLOC 1
51 | #define HAVE_CALLOC 1
52 | #define HAVE_REALLOC 1
53 | #define HAVE_FREE 1
54 | #define HAVE_ALLOCA 1
55 | #define HAVE_GETENV 1
56 | #define HAVE_SETENV 1
57 | #define HAVE_PUTENV 1
58 | #define HAVE_SETENV 1
59 | #define HAVE_UNSETENV 1
60 | #define HAVE_QSORT 1
61 | #define HAVE_ABS 1
62 | #define HAVE_BCOPY 1
63 | #define HAVE_MEMSET 1
64 | #define HAVE_MEMCPY 1
65 | #define HAVE_MEMMOVE 1
66 | #define HAVE_MEMCMP 1
67 | #define HAVE_STRLEN 1
68 | #define HAVE_STRLCPY 1
69 | #define HAVE_STRLCAT 1
70 | #define HAVE_STRDUP 1
71 | #define HAVE_STRCHR 1
72 | #define HAVE_STRRCHR 1
73 | #define HAVE_STRSTR 1
74 | #define HAVE_STRTOL 1
75 | #define HAVE_STRTOUL 1
76 | #define HAVE_STRTOLL 1
77 | #define HAVE_STRTOULL 1
78 | #define HAVE_STRTOD 1
79 | #define HAVE_ATOI 1
80 | #define HAVE_ATOF 1
81 | #define HAVE_STRCMP 1
82 | #define HAVE_STRNCMP 1
83 | #define HAVE_STRCASECMP 1
84 | #define HAVE_STRNCASECMP 1
85 | #define HAVE_VSSCANF 1
86 | #define HAVE_VSNPRINTF 1
87 | #define HAVE_M_PI 1
88 | #define HAVE_ATAN 1
89 | #define HAVE_ATAN2 1
90 | #define HAVE_ACOS 1
91 | #define HAVE_ASIN 1
92 | #define HAVE_CEIL 1
93 | #define HAVE_COPYSIGN 1
94 | #define HAVE_COS 1
95 | #define HAVE_COSF 1
96 | #define HAVE_FABS 1
97 | #define HAVE_FLOOR 1
98 | #define HAVE_LOG 1
99 | #define HAVE_POW 1
100 | #define HAVE_SCALBN 1
101 | #define HAVE_SIN 1
102 | #define HAVE_SINF 1
103 | #define HAVE_SQRT 1
104 | #define HAVE_SQRTF 1
105 | #define HAVE_TAN 1
106 | #define HAVE_TANF 1
107 | #define HAVE_SIGACTION 1
108 | #define HAVE_SETJMP 1
109 | #define HAVE_NANOSLEEP 1
110 | #define HAVE_SYSCONF 1
111 | #define HAVE_CLOCK_GETTIME 1
112 |
113 | #define SIZEOF_VOIDP 4
114 |
115 | /* Enable various audio drivers */
116 | #define SDL_AUDIO_DRIVER_ANDROID 1
117 | #define SDL_AUDIO_DRIVER_DUMMY 1
118 |
119 | /* Enable various input drivers */
120 | #define SDL_JOYSTICK_ANDROID 1
121 | #define SDL_HAPTIC_ANDROID 1
122 |
123 | /* Enable various shared object loading systems */
124 | #define SDL_LOADSO_DLOPEN 1
125 |
126 | /* Enable various threading systems */
127 | #define SDL_THREAD_PTHREAD 1
128 | #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
129 |
130 | /* Enable various timer systems */
131 | #define SDL_TIMER_UNIX 1
132 |
133 | /* Enable various video drivers */
134 | #define SDL_VIDEO_DRIVER_ANDROID 1
135 |
136 | /* Enable OpenGL ES */
137 | #define SDL_VIDEO_OPENGL_ES 1
138 | #define SDL_VIDEO_OPENGL_ES2 1
139 | #define SDL_VIDEO_OPENGL_EGL 1
140 | #define SDL_VIDEO_RENDER_OGL_ES 1
141 | #define SDL_VIDEO_RENDER_OGL_ES2 1
142 |
143 | /* Enable Vulkan support */
144 | /* Android does not support Vulkan in native code using the "armeabi" ABI. */
145 | #if defined(__ARM_ARCH) && __ARM_ARCH < 7
146 | #define SDL_VIDEO_VULKAN 0
147 | #else
148 | #define SDL_VIDEO_VULKAN 1
149 | #endif
150 |
151 | /* Enable system power support */
152 | #define SDL_POWER_ANDROID 1
153 |
154 | /* Enable the filesystem driver */
155 | #define SDL_FILESYSTEM_ANDROID 1
156 |
157 | #endif /* SDL_config_android_h_ */
158 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_config_iphoneos.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2017 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | #ifndef SDL_config_iphoneos_h_
23 | #define SDL_config_iphoneos_h_
24 | #define SDL_config_h_
25 |
26 | #include "SDL_platform.h"
27 |
28 | #ifdef __LP64__
29 | #define SIZEOF_VOIDP 8
30 | #else
31 | #define SIZEOF_VOIDP 4
32 | #endif
33 |
34 | #define HAVE_GCC_ATOMICS 1
35 |
36 | #define HAVE_ALLOCA_H 1
37 | #define HAVE_SYS_TYPES_H 1
38 | #define HAVE_STDIO_H 1
39 | #define STDC_HEADERS 1
40 | #define HAVE_STRING_H 1
41 | #define HAVE_INTTYPES_H 1
42 | #define HAVE_STDINT_H 1
43 | #define HAVE_CTYPE_H 1
44 | #define HAVE_MATH_H 1
45 | #define HAVE_SIGNAL_H 1
46 |
47 | /* C library functions */
48 | #define HAVE_MALLOC 1
49 | #define HAVE_CALLOC 1
50 | #define HAVE_REALLOC 1
51 | #define HAVE_FREE 1
52 | #define HAVE_ALLOCA 1
53 | #define HAVE_GETENV 1
54 | #define HAVE_SETENV 1
55 | #define HAVE_PUTENV 1
56 | #define HAVE_SETENV 1
57 | #define HAVE_UNSETENV 1
58 | #define HAVE_QSORT 1
59 | #define HAVE_ABS 1
60 | #define HAVE_BCOPY 1
61 | #define HAVE_MEMSET 1
62 | #define HAVE_MEMCPY 1
63 | #define HAVE_MEMMOVE 1
64 | #define HAVE_MEMCMP 1
65 | #define HAVE_STRLEN 1
66 | #define HAVE_STRLCPY 1
67 | #define HAVE_STRLCAT 1
68 | #define HAVE_STRDUP 1
69 | #define HAVE_STRCHR 1
70 | #define HAVE_STRRCHR 1
71 | #define HAVE_STRSTR 1
72 | #define HAVE_STRTOL 1
73 | #define HAVE_STRTOUL 1
74 | #define HAVE_STRTOLL 1
75 | #define HAVE_STRTOULL 1
76 | #define HAVE_STRTOD 1
77 | #define HAVE_ATOI 1
78 | #define HAVE_ATOF 1
79 | #define HAVE_STRCMP 1
80 | #define HAVE_STRNCMP 1
81 | #define HAVE_STRCASECMP 1
82 | #define HAVE_STRNCASECMP 1
83 | #define HAVE_VSSCANF 1
84 | #define HAVE_VSNPRINTF 1
85 | #define HAVE_M_PI 1
86 | #define HAVE_ATAN 1
87 | #define HAVE_ATAN2 1
88 | #define HAVE_ACOS 1
89 | #define HAVE_ASIN 1
90 | #define HAVE_CEIL 1
91 | #define HAVE_COPYSIGN 1
92 | #define HAVE_COS 1
93 | #define HAVE_COSF 1
94 | #define HAVE_FABS 1
95 | #define HAVE_FLOOR 1
96 | #define HAVE_LOG 1
97 | #define HAVE_POW 1
98 | #define HAVE_SCALBN 1
99 | #define HAVE_SIN 1
100 | #define HAVE_SINF 1
101 | #define HAVE_SQRT 1
102 | #define HAVE_SQRTF 1
103 | #define HAVE_TAN 1
104 | #define HAVE_TANF 1
105 | #define HAVE_SIGACTION 1
106 | #define HAVE_SETJMP 1
107 | #define HAVE_NANOSLEEP 1
108 | #define HAVE_SYSCONF 1
109 | #define HAVE_SYSCTLBYNAME 1
110 |
111 | /* enable iPhone version of Core Audio driver */
112 | #define SDL_AUDIO_DRIVER_COREAUDIO 1
113 | /* Enable the dummy audio driver (src/audio/dummy/\*.c) */
114 | #define SDL_AUDIO_DRIVER_DUMMY 1
115 |
116 | /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
117 | #define SDL_HAPTIC_DUMMY 1
118 |
119 | /* Enable MFi joystick support */
120 | #define SDL_JOYSTICK_MFI 1
121 |
122 | /* Enable Unix style SO loading */
123 | #define SDL_LOADSO_DLOPEN 1
124 |
125 | /* Enable various threading systems */
126 | #define SDL_THREAD_PTHREAD 1
127 | #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
128 |
129 | /* Enable various timer systems */
130 | #define SDL_TIMER_UNIX 1
131 |
132 | /* Supported video drivers */
133 | #define SDL_VIDEO_DRIVER_UIKIT 1
134 | #define SDL_VIDEO_DRIVER_DUMMY 1
135 |
136 | /* enable OpenGL ES */
137 | #define SDL_VIDEO_OPENGL_ES2 1
138 | #define SDL_VIDEO_OPENGL_ES 1
139 | #define SDL_VIDEO_RENDER_OGL_ES 1
140 | #define SDL_VIDEO_RENDER_OGL_ES2 1
141 |
142 | /* Enable Vulkan support */
143 | #if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM // Only 64-bit devices have Metal
144 | #define SDL_VIDEO_VULKAN 1
145 | #else
146 | #define SDL_VIDEO_VULKAN 0
147 | #endif
148 |
149 | /* Enable system power support */
150 | #define SDL_POWER_UIKIT 1
151 |
152 | /* enable iPhone keyboard support */
153 | #define SDL_IPHONE_KEYBOARD 1
154 |
155 | /* enable iOS extended launch screen */
156 | #define SDL_IPHONE_LAUNCHSCREEN 1
157 |
158 | /* Set max recognized G-force from accelerometer
159 | See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
160 | */
161 | #define SDL_IPHONE_MAX_GFORCE 5.0
162 |
163 | /* enable filesystem support */
164 | #define SDL_FILESYSTEM_COCOA 1
165 |
166 | #endif /* SDL_config_iphoneos_h_ */
167 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_test_md5.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_test_harness.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 | char *name;
80 | /* !< Long name or full description "This test pushes func2() to the limit." */
81 | char *description;
82 | /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
83 | int enabled;
84 | } SDLTest_TestCaseReference;
85 |
86 | /**
87 | * Holds information about a test suite (multiple test cases).
88 | */
89 | typedef struct SDLTest_TestSuiteReference {
90 | /* !< "PlatformSuite" */
91 | char *name;
92 | /* !< The function that is run before each test. NULL skips. */
93 | SDLTest_TestCaseSetUpFp testSetUp;
94 | /* !< The test cases that are run as part of the suite. Last item should be NULL. */
95 | const SDLTest_TestCaseReference **testCases;
96 | /* !< The function that is run after each test. NULL skips. */
97 | SDLTest_TestCaseTearDownFp testTearDown;
98 | } SDLTest_TestSuiteReference;
99 |
100 |
101 | /**
102 | * \brief 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/docs/README-visualc.md:
--------------------------------------------------------------------------------
1 | Using SDL with Microsoft Visual C++
2 | ===================================
3 |
4 | ### by [Lion Kimbro](mailto:snowlion@sprynet.com) with additions by [James Turk](mailto:james@conceptofzero.net)
5 |
6 | You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL
7 | yourself.
8 |
9 | ### Building SDL
10 |
11 | 0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from
12 | the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web).
13 | _Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_
14 |
15 | 1. Open the Visual Studio solution file at `./VisualC/SDL.sln`.
16 |
17 | 2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog,
18 | all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with
19 | the `Platform Toolset`.
20 |
21 | If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`.
22 |
23 | 3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_
24 | panel in the _FileView_ tab), and selecting `Build`.
25 |
26 | You may get a few warnings, but you should not get any errors.
27 |
28 | Later, we will refer to the following `.lib` and `.dll` files that have just been generated:
29 |
30 | - `./VisualC/Win32/Debug/SDL2.dll` or `./VisualC/Win32/Release/SDL2.dll`
31 | - `./VisualC/Win32/Debug/SDL2.lib` or `./VisualC/Win32/Release/SDL2.lib`
32 | - `./VisualC/Win32/Debug/SDL2main.lib` or `./VisualC/Win32/Release/SDL2main.lib`
33 |
34 | _Note for the `x64` versions, just replace `Win32` in the path with `x64`_
35 |
36 | ### Creating a Project with SDL
37 |
38 | - Create a project as a `Win32 Application`.
39 |
40 | - Create a C++ file for your project.
41 |
42 | - Set the C runtime to `Multi-threaded DLL` in the menu:
43 | `Project|Settings|C/C++ tab|Code Generation|Runtime Library `.
44 |
45 | - Add the SDL `include` directory to your list of includes in the menu:
46 | `Project|Settings|C/C++ tab|Preprocessor|Additional include directories `
47 |
48 | *VC7 Specific: Instead of doing this, I find it easier to add the
49 | include and library directories to the list that VC7 keeps. Do this by
50 | selecting Tools|Options|Projects|VC++ Directories and under the "Show
51 | Directories For:" dropbox select "Include Files", and click the "New
52 | Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you
53 | installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the
54 | dropbox selection to "Library Files" and add [SDLROOT]\\lib.*
55 |
56 | The "include directory" I am referring to is the `./include` folder.
57 |
58 | Now we're going to use the files that we had created earlier in the *Build SDL* step.
59 |
60 | Copy the following file into your Project directory:
61 |
62 | - `SDL2.dll`
63 |
64 | Add the following files to your project (It is not necessary to copy them to your project directory):
65 |
66 | - `SDL2.lib`
67 | - `SDL2main.lib`
68 |
69 | To add them to your project, right click on your project, and select
70 | `Add files to project`.
71 |
72 | **Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line
73 | and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration
74 | (e.g. Release,Debug).**
75 |
76 | ### Hello SDL2
77 |
78 | Here's a sample SDL snippet to verify everything is setup in your IDE:
79 |
80 | ```
81 | #include "SDL.h"
82 |
83 | int main( int argc, char* argv[] )
84 | {
85 | const int WIDTH = 640;
86 | const int HEIGHT = 480;
87 | SDL_Window* window = NULL;
88 | SDL_Renderer* renderer = NULL;
89 |
90 | SDL_Init(SDL_INIT_VIDEO);
91 | window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
92 | renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
93 |
94 | SDL_DestroyRenderer(renderer);
95 | SDL_DestroyWindow(window);
96 | SDL_Quit();
97 | return 0;
98 | }
99 | ```
100 |
101 | ### That's it!
102 |
103 | I hope that this document has helped you get through the most difficult part of using the SDL: installing it.
104 | Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues).
105 |
106 | ### Credits
107 |
108 | Thanks to [Paulus Esterhazy](mailto:pesterhazy@gmx.net), for the work on VC++ port.
109 |
110 | This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:slouken@libsdl.org).
111 |
112 | Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:snowlion@sprynet.com).
113 |
114 | Minor Fixes and Visual C++ 7 Information (In Green) was added by [James Turk](mailto:james@conceptofzero.net)
115 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/begin_code.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_error.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 | * \sa SDL_ClearError
62 | * \sa SDL_GetError
63 | */
64 | extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
65 |
66 | /**
67 | * Retrieve a message about the last error that occurred on the current
68 | * thread.
69 | *
70 | * It is possible for multiple errors to occur before calling SDL_GetError().
71 | * Only the last error is returned.
72 | *
73 | * The message is only applicable when an SDL function has signaled an error.
74 | * You must check the return values of SDL function calls to determine when to
75 | * appropriately call SDL_GetError(). You should _not_ use the results of
76 | * SDL_GetError() to decide if an error has occurred! Sometimes SDL will set
77 | * an error string even when reporting success.
78 | *
79 | * SDL will _not_ clear the error string for successful API calls. You _must_
80 | * check return values for failure cases before you can assume the error
81 | * string applies.
82 | *
83 | * Error strings are set per-thread, so an error set in a different thread
84 | * will not interfere with the current thread's operation.
85 | *
86 | * The returned string is internally allocated and must not be freed by the
87 | * application.
88 | *
89 | * \returns a message with information about the specific error that occurred,
90 | * or an empty string if there hasn't been an error message set since
91 | * the last call to SDL_ClearError(). The message is only applicable
92 | * when an SDL function has signaled an error. You must check the
93 | * return values of SDL function calls to determine when to
94 | * appropriately call SDL_GetError().
95 | *
96 | * \sa SDL_ClearError
97 | * \sa SDL_SetError
98 | */
99 | extern DECLSPEC const char *SDLCALL SDL_GetError(void);
100 |
101 | /**
102 | * Get the last error message that was set for the current thread.
103 | *
104 | * This allows the caller to copy the error string into a provided buffer, but
105 | * otherwise operates exactly the same as SDL_GetError().
106 | *
107 | * \param errstr A buffer to fill with the last error message that was set for
108 | * the current thread
109 | * \param maxlen The size of the buffer pointed to by the errstr parameter
110 | * \returns the pointer passed in as the `errstr` parameter.
111 | *
112 | * \sa SDL_GetError
113 | */
114 | extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
115 |
116 | /**
117 | * Clear any previous error message for this thread.
118 | *
119 | * \sa SDL_GetError
120 | * \sa SDL_SetError
121 | */
122 | extern DECLSPEC void SDLCALL SDL_ClearError(void);
123 |
124 | /**
125 | * \name Internal error functions
126 | *
127 | * \internal
128 | * Private error reporting function - used internally.
129 | */
130 | /* @{ */
131 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
132 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
133 | #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
134 | typedef enum
135 | {
136 | SDL_ENOMEM,
137 | SDL_EFREAD,
138 | SDL_EFWRITE,
139 | SDL_EFSEEK,
140 | SDL_UNSUPPORTED,
141 | SDL_LASTERROR
142 | } SDL_errorcode;
143 | /* SDL_Error() unconditionally returns -1. */
144 | extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
145 | /* @} *//* Internal error functions */
146 |
147 | /* Ends C function definitions when using C++ */
148 | #ifdef __cplusplus
149 | }
150 | #endif
151 | #include "close_code.h"
152 |
153 | #endif /* SDL_error_h_ */
154 |
155 | /* vi: set ts=4 sw=4 expandtab: */
156 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_filesystem.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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. Fpr 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 |
--------------------------------------------------------------------------------
/vs16/cloth-simulation-2d.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | 16.0
33 | Win32Proj
34 | {0dbdc2cc-e1b4-4a56-81d5-a217f361e7b6}
35 | clothsimulation2d
36 | 10.0
37 |
38 |
39 |
40 | Application
41 | true
42 | v143
43 | Unicode
44 |
45 |
46 | Application
47 | false
48 | v143
49 | true
50 | Unicode
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | true
66 |
67 |
68 | false
69 |
70 |
71 |
72 | Level3
73 | true
74 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
75 | true
76 | stdcpp17
77 | $(ProjectDir)..\lib\SDL2-2.0.16\include
78 |
79 |
80 | Console
81 | true
82 | $(ProjectDir)..\lib\SDL2-2.0.16\lib\x64
83 | SDL2.lib;SDL2main.lib;%(AdditionalDependencies)
84 |
85 |
86 | xcopy /y $(ProjectDir)..\lib\SDL2-2.0.16\lib\x64\SDL2.dll $(TargetDir)
87 |
88 |
89 |
90 |
91 | Level3
92 | true
93 | true
94 | true
95 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
96 | true
97 | stdcpp17
98 | $(ProjectDir)..\lib\SDL2-2.0.16\include
99 |
100 |
101 | Console
102 | true
103 | true
104 | true
105 | $(ProjectDir)..\lib\SDL2-2.0.16\lib\x64
106 | SDL2.lib;SDL2main.lib;%(AdditionalDependencies)
107 |
108 |
109 | xcopy /y $(ProjectDir)..\lib\SDL2-2.0.16\lib\x64\SDL2.dll $(TargetDir)
110 |
111 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_timer.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 | * \returns an unsigned 32-bit value representing the number of milliseconds
46 | * since the SDL library initialized.
47 | *
48 | * \sa SDL_TICKS_PASSED
49 | */
50 | extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
51 |
52 | /**
53 | * Compare SDL ticks values, and return true if `A` has passed `B`.
54 | *
55 | * For example, if you want to wait 100 ms, you could do this:
56 | *
57 | * ```c++
58 | * Uint32 timeout = SDL_GetTicks() + 100;
59 | * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
60 | * // ... do work until timeout has elapsed
61 | * }
62 | * ```
63 | */
64 | #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
65 |
66 | /**
67 | * Get the current value of the high resolution counter.
68 | *
69 | * This function is typically used for profiling.
70 | *
71 | * The counter values are only meaningful relative to each other. Differences
72 | * between values can be converted to times by using
73 | * SDL_GetPerformanceFrequency().
74 | *
75 | * \returns the current counter value.
76 | *
77 | * \sa SDL_GetPerformanceFrequency
78 | */
79 | extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void);
80 |
81 | /**
82 | * Get the count per second of the high resolution counter.
83 | *
84 | * \returns a platform-specific count per second.
85 | *
86 | * \since This function is available since SDL 2.0.0.
87 | *
88 | * \sa SDL_GetPerformanceCounter
89 | */
90 | extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void);
91 |
92 | /**
93 | * Wait a specified number of milliseconds before returning.
94 | *
95 | * This function waits a specified number of milliseconds before returning. It
96 | * waits at least the specified time, but possibly longer due to OS
97 | * scheduling.
98 | *
99 | * \param ms the number of milliseconds to delay
100 | */
101 | extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
102 |
103 | /**
104 | * Function prototype for the timer callback function.
105 | *
106 | * The callback function is passed the current timer interval and returns
107 | * the next timer interval. If the returned value is the same as the one
108 | * passed in, the periodic alarm continues, otherwise a new alarm is
109 | * scheduled. If the callback returns 0, the periodic alarm is cancelled.
110 | */
111 | typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param);
112 |
113 | /**
114 | * Definition of the timer ID type.
115 | */
116 | typedef int SDL_TimerID;
117 |
118 | /**
119 | * Call a callback function at a future time.
120 | *
121 | * If you use this function, you must pass `SDL_INIT_TIMER` to SDL_Init().
122 | *
123 | * The callback function is passed the current timer interval and the user
124 | * supplied parameter from the SDL_AddTimer() call and should return the next
125 | * timer interval. If the value returned from the callback is 0, the timer is
126 | * canceled.
127 | *
128 | * The callback is run on a separate thread.
129 | *
130 | * Timers take into account the amount of time it took to execute the
131 | * callback. For example, if the callback took 250 ms to execute and returned
132 | * 1000 (ms), the timer would only wait another 750 ms before its next
133 | * iteration.
134 | *
135 | * Timing may be inexact due to OS scheduling. Be sure to note the current
136 | * time with SDL_GetTicks() or SDL_GetPerformanceCounter() in case your
137 | * callback needs to adjust for variances.
138 | *
139 | * \param interval the timer delay, in milliseconds, passed to `callback`
140 | * \param callback the SDL_TimerCallback function to call when the specified
141 | * `interval` elapses
142 | * \param param a pointer that is passed to `callback`
143 | * \returns a timer ID or 0 if an error occurs; call SDL_GetError() for more
144 | * information.
145 | *
146 | * \sa SDL_RemoveTimer
147 | */
148 | extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
149 | SDL_TimerCallback callback,
150 | void *param);
151 |
152 | /**
153 | * Remove a timer created with SDL_AddTimer().
154 | *
155 | * \param id the ID of the timer to remove
156 | * \returns SDL_TRUE if the timer is removed or SDL_FALSE if the timer wasn't
157 | * found.
158 | *
159 | * \sa SDL_AddTimer
160 | */
161 | extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
162 |
163 |
164 | /* Ends C function definitions when using C++ */
165 | #ifdef __cplusplus
166 | }
167 | #endif
168 | #include "close_code.h"
169 |
170 | #endif /* SDL_timer_h_ */
171 |
172 | /* vi: set ts=4 sw=4 expandtab: */
173 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_shape.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 | * \sa SDL_DestroyWindow
66 | */
67 | extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
68 |
69 | /**
70 | * Return whether the given window is a shaped window.
71 | *
72 | * \param window The window to query for being shaped.
73 | * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if
74 | * the window is unshaped or NULL.
75 | *
76 | * \sa SDL_CreateShapedWindow
77 | */
78 | extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
79 |
80 | /** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
81 | typedef enum {
82 | /** \brief The default mode, a binarized alpha cutoff of 1. */
83 | ShapeModeDefault,
84 | /** \brief A binarized alpha cutoff with a given integer value. */
85 | ShapeModeBinarizeAlpha,
86 | /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
87 | ShapeModeReverseBinarizeAlpha,
88 | /** \brief A color key is applied. */
89 | ShapeModeColorKey
90 | } WindowShapeMode;
91 |
92 | #define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
93 |
94 | /** \brief A union containing parameters for shaped windows. */
95 | typedef union {
96 | /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */
97 | Uint8 binarizationCutoff;
98 | SDL_Color colorKey;
99 | } SDL_WindowShapeParams;
100 |
101 | /** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
102 | typedef struct SDL_WindowShapeMode {
103 | /** \brief The mode of these window-shape parameters. */
104 | WindowShapeMode mode;
105 | /** \brief Window-shape parameters. */
106 | SDL_WindowShapeParams parameters;
107 | } SDL_WindowShapeMode;
108 |
109 | /**
110 | * Set the shape and parameters of a shaped window.
111 | *
112 | * \param window The shaped window whose parameters should be set.
113 | * \param shape A surface encoding the desired shape for the window.
114 | * \param shape_mode The parameters to set for the shaped window.
115 | * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape
116 | * argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does
117 | * not reference a valid shaped window.
118 | *
119 | * \sa SDL_WindowShapeMode
120 | * \sa SDL_GetShapedWindowMode
121 | */
122 | extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
123 |
124 | /**
125 | * Get the shape parameters of a shaped window.
126 | *
127 | * \param window The shaped window whose parameters should be retrieved.
128 | * \param shape_mode An empty shape-mode structure to fill, or NULL to check
129 | * whether the window has a shape.
130 | * \return 0 if the window has a shape and, provided shape_mode was not NULL,
131 | * shape_mode has been filled with the mode data,
132 | * SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped
133 | * window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a
134 | * shapeable window currently lacking a shape.
135 | *
136 | * \sa SDL_WindowShapeMode
137 | * \sa SDL_SetWindowShape
138 | */
139 | extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode);
140 |
141 | /* Ends C function definitions when using C++ */
142 | #ifdef __cplusplus
143 | }
144 | #endif
145 | #include "close_code.h"
146 |
147 | #endif /* SDL_shape_h_ */
148 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_main.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 | #endif
87 | #endif /* SDL_MAIN_HANDLED */
88 |
89 | #ifndef SDLMAIN_DECLSPEC
90 | #define SDLMAIN_DECLSPEC
91 | #endif
92 |
93 | /**
94 | * \file SDL_main.h
95 | *
96 | * The application's main() function must be called with C linkage,
97 | * and should be declared like this:
98 | * \code
99 | * #ifdef __cplusplus
100 | * extern "C"
101 | * #endif
102 | * int main(int argc, char *argv[])
103 | * {
104 | * }
105 | * \endcode
106 | */
107 |
108 | #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
109 | #define main SDL_main
110 | #endif
111 |
112 | #include "begin_code.h"
113 | #ifdef __cplusplus
114 | extern "C" {
115 | #endif
116 |
117 | /**
118 | * The prototype for the application's main() function
119 | */
120 | typedef int (*SDL_main_func)(int argc, char *argv[]);
121 | extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
122 |
123 |
124 | /**
125 | * Circumvent failure of SDL_Init() when not using SDL_main() as an entry
126 | * point.
127 | *
128 | * This function is defined in SDL_main.h, along with the preprocessor rule to
129 | * redefine main() as SDL_main(). Thus to ensure that your main() function
130 | * will not be changed it is necessary to define SDL_MAIN_HANDLED before
131 | * including SDL.h.
132 | *
133 | * \sa SDL_Init
134 | */
135 | extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
136 |
137 | #ifdef __WIN32__
138 |
139 | /**
140 | * This can be called to set the application class at startup
141 | */
142 | extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
143 | extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
144 |
145 | #endif /* __WIN32__ */
146 |
147 |
148 | #ifdef __WINRT__
149 |
150 | /**
151 | * Initialize and launch an SDL/WinRT application.
152 | *
153 | * \param mainFunction the SDL app's C-style main(), an SDL_main_func
154 | * \param reserved reserved for future use; should be NULL
155 | * \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve
156 | * more information on the failure.
157 | *
158 | * \since This function is available since SDL 2.0.3.
159 | */
160 | extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved);
161 |
162 | #endif /* __WINRT__ */
163 |
164 | #if defined(__IPHONEOS__)
165 |
166 | /**
167 | * Initializes and launches an SDL application.
168 | *
169 | * \param argc The argc parameter from the application's main() function
170 | * \param argv The argv parameter from the application's main() function
171 | * \param mainFunction The SDL app's C-style main(), an SDL_main_func
172 | * \return the return value from mainFunction
173 | */
174 | extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction);
175 |
176 | #endif /* __IPHONEOS__ */
177 |
178 |
179 | #ifdef __cplusplus
180 | }
181 | #endif
182 | #include "close_code.h"
183 |
184 | #endif /* SDL_main_h_ */
185 |
186 | /* vi: set ts=4 sw=4 expandtab: */
187 |
--------------------------------------------------------------------------------
/lib/SDL2-2.0.16/include/SDL_version.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2021 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 16
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 | * \sa SDL_GetRevision
122 | */
123 | extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
124 |
125 | /**
126 | * Get the code revision of SDL that is linked against your program.
127 | *
128 | * This value is the revision of the code you are linked with and may be
129 | * different from the code you are compiling with, which is found in the
130 | * constant SDL_REVISION.
131 | *
132 | * The revision is arbitrary string (a hash value) uniquely identifying the
133 | * exact revision of the SDL library in use, and is only useful in comparing
134 | * against other revisions. It is NOT an incrementing number.
135 | *
136 | * If SDL wasn't built from a git repository with the appropriate tools, this
137 | * will return an empty string.
138 | *
139 | * Prior to SDL 2.0.16, before development moved to GitHub, this returned a
140 | * hash for a Mercurial repository.
141 | *
142 | * You shouldn't use this function for anything but logging it for debugging
143 | * purposes. The string is not intended to be reliable in any way.
144 | *
145 | * \returns an arbitrary string, uniquely identifying the exact revision of
146 | * the SDL library in use.
147 | *
148 | * \sa SDL_GetVersion
149 | */
150 | extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
151 |
152 | /**
153 | * Obsolete function, do not use.
154 | *
155 | * When SDL was hosted in a Mercurial repository, and was built carefully,
156 | * this would return the revision number that the build was created from.
157 | * This number was not reliable for several reasons, but more importantly,
158 | * SDL is now hosted in a git repository, which does not offer numbers at
159 | * all, only hashes. This function only ever returns zero now. Don't use it.
160 | */
161 | extern SDL_DEPRECATED DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
162 |
163 |
164 | /* Ends C function definitions when using C++ */
165 | #ifdef __cplusplus
166 | }
167 | #endif
168 | #include "close_code.h"
169 |
170 | #endif /* SDL_version_h_ */
171 |
172 | /* vi: set ts=4 sw=4 expandtab: */
173 |
--------------------------------------------------------------------------------