├── .gitignore
├── CMakeLists.txt
├── Doxyfile
├── LICENSE
├── README.md
├── compile_commands.json
├── data
└── tile_data.json
├── dox
└── doc
│ ├── Camera.dox
│ ├── FastboiCore.dox
│ └── Gameobject.dox
├── examples
├── FastboiCore.cpp
└── Gameobject.cpp
├── inc
├── SDL
│ ├── SDL.h
│ ├── SDL_assert.h
│ ├── SDL_atomic.h
│ ├── SDL_audio.h
│ ├── SDL_bits.h
│ ├── SDL_blendmode.h
│ ├── SDL_clipboard.h
│ ├── SDL_config.h
│ ├── SDL_cpuinfo.h
│ ├── SDL_egl.h
│ ├── SDL_endian.h
│ ├── SDL_error.h
│ ├── SDL_events.h
│ ├── SDL_filesystem.h
│ ├── SDL_gamecontroller.h
│ ├── SDL_gesture.h
│ ├── SDL_haptic.h
│ ├── SDL_hints.h
│ ├── SDL_image.h
│ ├── SDL_joystick.h
│ ├── SDL_keyboard.h
│ ├── SDL_keycode.h
│ ├── SDL_loadso.h
│ ├── SDL_log.h
│ ├── SDL_main.h
│ ├── SDL_messagebox.h
│ ├── SDL_mouse.h
│ ├── SDL_mutex.h
│ ├── SDL_name.h
│ ├── SDL_opengl.h
│ ├── SDL_opengl_glext.h
│ ├── SDL_opengles.h
│ ├── SDL_opengles2.h
│ ├── SDL_opengles2_gl2.h
│ ├── SDL_opengles2_gl2ext.h
│ ├── SDL_opengles2_gl2platform.h
│ ├── SDL_opengles2_khrplatform.h
│ ├── SDL_pixels.h
│ ├── SDL_platform.h
│ ├── SDL_power.h
│ ├── SDL_quit.h
│ ├── SDL_rect.h
│ ├── SDL_render.h
│ ├── SDL_revision.h
│ ├── SDL_rwops.h
│ ├── SDL_scancode.h
│ ├── SDL_sensor.h
│ ├── SDL_shape.h
│ ├── SDL_stdinc.h
│ ├── SDL_surface.h
│ ├── SDL_system.h
│ ├── SDL_syswm.h
│ ├── SDL_test.h
│ ├── SDL_test_assert.h
│ ├── SDL_test_common.h
│ ├── SDL_test_compare.h
│ ├── SDL_test_crc32.h
│ ├── SDL_test_font.h
│ ├── SDL_test_fuzzer.h
│ ├── SDL_test_harness.h
│ ├── SDL_test_images.h
│ ├── SDL_test_log.h
│ ├── SDL_test_md5.h
│ ├── SDL_test_memory.h
│ ├── SDL_test_random.h
│ ├── SDL_thread.h
│ ├── SDL_timer.h
│ ├── SDL_touch.h
│ ├── SDL_types.h
│ ├── SDL_version.h
│ ├── SDL_video.h
│ ├── SDL_vulkan.h
│ ├── begin_code.h
│ └── close_code.h
├── Utility.h
├── ctti
│ ├── detail
│ │ ├── algorithm.hpp
│ │ ├── cstring.hpp
│ │ ├── entity_name.hpp
│ │ ├── hash.hpp
│ │ ├── language_features.hpp
│ │ ├── meta.hpp
│ │ ├── name_filters.hpp
│ │ ├── nlohmann_json.hpp
│ │ ├── preprocessor.hpp
│ │ └── pretty_function.hpp
│ ├── detailed_nameof.hpp
│ ├── hash_literal.hpp
│ ├── map.hpp
│ ├── model.hpp
│ ├── name.hpp
│ ├── nameof.hpp
│ ├── serialization.hpp
│ ├── static_value.hpp
│ ├── symbol.hpp
│ ├── symbol_from_hash.hpp
│ ├── tie.hpp
│ ├── type_id.hpp
│ └── type_tag.hpp
├── json
│ └── json.hpp
├── nano_ss
│ ├── LICENSE
│ ├── nano_function.hpp
│ ├── nano_mutex.hpp
│ ├── nano_observer.hpp
│ └── nano_signal_slot.hpp
└── soloud
│ ├── soloud.h
│ ├── soloud_audiosource.h
│ ├── soloud_bassboostfilter.h
│ ├── soloud_biquadresonantfilter.h
│ ├── soloud_bus.h
│ ├── soloud_c.h
│ ├── soloud_dcremovalfilter.h
│ ├── soloud_echofilter.h
│ ├── soloud_error.h
│ ├── soloud_fader.h
│ ├── soloud_fft.h
│ ├── soloud_fftfilter.h
│ ├── soloud_file.h
│ ├── soloud_file_hack_off.h
│ ├── soloud_file_hack_on.h
│ ├── soloud_filter.h
│ ├── soloud_flangerfilter.h
│ ├── soloud_freeverbfilter.h
│ ├── soloud_internal.h
│ ├── soloud_lofifilter.h
│ ├── soloud_misc.h
│ ├── soloud_monotone.h
│ ├── soloud_noise.h
│ ├── soloud_openmpt.h
│ ├── soloud_queue.h
│ ├── soloud_robotizefilter.h
│ ├── soloud_sfxr.h
│ ├── soloud_speech.h
│ ├── soloud_tedsid.h
│ ├── soloud_thread.h
│ ├── soloud_vic.h
│ ├── soloud_vizsn.h
│ ├── soloud_wav.h
│ ├── soloud_waveshaperfilter.h
│ └── soloud_wavstream.h
├── makefile
├── res
├── Sprite-0001.aseprite
├── images
│ ├── all_sprites.png
│ ├── brick.png
│ ├── bridge.png
│ ├── button.png
│ ├── castle.png
│ ├── chalise.png
│ ├── gate.png
│ ├── ground.jpeg
│ ├── grundle.png
│ ├── keys.png
│ ├── magnet.png
│ ├── mc_blocks.png
│ ├── pallette.png
│ ├── penguin.png
│ ├── rhindle.png
│ ├── spritemap.png
│ ├── sword.png
│ ├── tiles.png
│ ├── units.png
│ └── yorgle.png
└── sound
│ ├── chomp.mp3
│ ├── death.mp3
│ ├── drop.mp3
│ ├── pickup.mp3
│ ├── slay.mp3
│ ├── win-bad.mp3
│ └── win-good.mp3
└── src
├── AABBTree.cpp
├── AABBTree.h
├── Angles.cpp
├── Angles.h
├── Application.cpp
├── Application.h
├── Archetype.h
├── BoundingBoxRenderer.cpp
├── BoundingBoxRenderer.h
├── BoxColorRenderer.cpp
├── BoxColorRenderer.h
├── CacheLineSize.c
├── CacheLineSize.h
├── Camera.cpp
├── Camera.h
├── ChangeObserver.h
├── ClickTarget.cpp
├── ClickTarget.h
├── Collider.cpp
├── Collider.h
├── Collision.cpp
├── Collision.h
├── CollisionMask.cpp
├── CollisionMask.h
├── ColorComp.h
├── Component.h
├── ComponentReqs.h
├── Events.h
├── Exceptions.h
├── Fastboi.h
├── FastboiComps.h
├── FastboiCore.cpp
├── FastboiCore.h
├── GORef.cpp
├── GORef.h
├── Gameobject.cpp
├── Gameobject.h
├── GameobjectAllocator.cpp
├── GameobjectAllocator.h
├── Input.cpp
├── Input.h
├── Rect.h
├── RectUI.cpp
├── RectUI.h
├── RenderOrder.h
├── Renderer.cpp
├── Renderer.h
├── Rendering.cpp
├── Rendering.h
├── RepeatRenderer.cpp
├── RepeatRenderer.h
├── Resources.cpp
├── Resources.h
├── Rigidbody.cpp
├── Rigidbody.h
├── ScreenElement.cpp
├── ScreenElement.h
├── Shape.cpp
├── Shape.h
├── Slowboi
├── Button.cpp
├── Button.h
├── Game.cpp
├── Game.h
├── GroundBG.cpp
├── GroundBG.h
├── Player.cpp
├── Player.h
├── RequiresTest.cpp
└── RequiresTest.h
├── Speaker.cpp
├── Speaker.h
├── SpriteRenderer.cpp
├── SpriteRenderer.h
├── Spritesheet.h
├── Texture.cpp
├── Texture.h
├── Timer.h
├── Transform.cpp
├── Transform.h
├── UI
├── Button.cpp
├── Button.h
├── CommonLayouts.h
├── Screen.cpp
├── Screen.h
└── ScreenspaceExpression.h
├── UITexture.cpp
├── UITexture.h
├── Utility.cpp
├── Vec.h
├── WireframeRenderer.cpp
├── WireframeRenderer.h
├── adventure
├── Bridge.cpp
├── Bridge.h
├── Chalise.cpp
├── Chalise.h
├── Dragon.cpp
├── Dragon.h
├── Game.cpp
├── Game.h
├── GameManager.cpp
├── GameManager.h
├── Gate.cpp
├── Gate.h
├── Item.cpp
├── Item.h
├── Layouts.cpp
├── Layouts.h
├── Level.cpp
├── Level.h
├── Magnet.cpp
├── Magnet.h
├── Player.cpp
├── Player.h
├── Room.cpp
├── Room.h
├── RoomCamera.h
├── TestSystem.cpp
├── TestSystem.h
└── main.cpp
├── circular_vector.h
├── containmentsimulator
├── Button.cpp
├── Button.h
├── CameraController.cpp
├── CameraController.h
├── Game.cpp
├── Game.h
├── Tile.cpp
├── Tile.h
├── TileData.cpp
├── TileData.h
├── TileManager.cpp
├── TileManager.h
├── WorldEditor.cpp
└── WorldEditor.h
├── cute_c2.h
├── minecraft
├── Block.cpp
├── Block.h
├── BlockHighlighter.h
├── Game.cpp
├── Game.h
├── Inventory.cpp
├── Inventory.h
├── Item.h
├── Player.cpp
├── Player.h
├── World.cpp
├── World.h
└── main.cpp
└── test
├── Collider.cpp
├── Transform.cpp
├── Vec.cpp
├── catch.hpp
└── test_main.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | # Cmake
2 | CMakeFiles/
3 | pkg/
4 | cmake_install.cmake
5 | CMakeCache.txt
6 |
7 | # deps
8 | deps/
9 |
10 |
11 | *.exe
12 | *.ilk
13 | *.pdb
14 | *.exp
15 | *.d.lib
16 | *.lib
17 |
18 | clangd_output.json
19 | times.*
20 |
21 | .clangd/
22 | .cache/
23 |
24 | # lib/dll files
25 | *.dll
26 | lib/*
27 |
28 | # config files
29 | sdl2-config
30 |
31 | # doxygen
32 | dox/html/
33 | dox/latex/
34 |
35 | # vscode
36 | .vscode/
37 | workspace.code-workspace
38 |
39 | # visual studio debugging
40 | .vs/
41 | Debug/
42 | fastboi.sln
43 | fastboi.vcxproj
44 | fastboi.vcxproj.*
45 | src/.vs/
46 | src/CppProperties.json
47 | x64/
48 |
49 | # cmake
50 | build/
51 | cmake/
52 | .ninja_deps
53 | .ninja_log
54 | *.ninja
55 | Makefile
56 | makefile
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.20)
2 |
3 | if(NOT CMAKE_BUILD_TYPE)
4 | set(CMAKE_BUILD_TYPE Release)
5 | endif()
6 |
7 | set(CMAKE_C_COMPILER clang)
8 | set(CMAKE_CXX_COMPILER clang++)
9 | set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-parentheses-equality -Wno-unused-variable -Wno-unused-function")
10 | set(CMAKE_CXX_FLAGS_DEBUG "-g")
11 | set(CMAKE_CXX_FLAGS_RELEASE "-O3")
12 |
13 | project(FastBoi)
14 |
15 | file(GLOB SRC CONFIGURE_DEPENDS src/*.cpp src/*.hpp src/UI/*.cpp)
16 |
17 | set(CMAKE_CXX_STANDARD 20)
18 | set(CMAKE_EXPORT_COMPILE_COMMANDS True)
19 |
20 | file(GLOB SOLOUD_CORE_SRC deps/soloud/src/core/*.cpp deps/soloud/src/audiosource/wav/*.cpp deps/soloud/src/audiosource/wav/*.c)
21 | set(THIRDPARTY_SRC ${SOLOUD_CORE_SRC} deps/soloud/src/backend/sdl2_static/soloud_sdl2_static.cpp)
22 |
23 | file(GLOB APP_SRC src/adventure/*.cpp)
24 |
25 | link_directories(${CMAKE_SOURCE_DIR}/lib)
26 |
27 | add_executable(adventure ${SRC} ${THIRDPARTY_SRC} ${APP_SRC})
28 | set_target_properties(adventure PROPERTIES EXCLUDE_FROM_ALL TRUE)
29 |
30 | target_compile_options(adventure PRIVATE -flto=thin)
31 | target_link_options(adventure PRIVATE -fuse-ld=lld -flto=thin)
32 | target_include_directories(adventure PRIVATE inc src inc/soloud inc/SDL)
33 |
34 | target_link_libraries(adventure PRIVATE SDL2 SDL2main SDL2_image)
35 |
36 | target_compile_definitions(adventure PRIVATE WITH_SDL2_STATIC __cpp_lib_ranges)
37 |
38 |
39 | file(GLOB MC_SRC src/minecraft/*.cpp)
40 | add_executable(minecraft ${SRC} ${THIRDPARTY_SRC} ${MC_SRC})
41 |
42 | target_compile_options(minecraft PRIVATE -flto=thin)
43 | target_link_options(minecraft PRIVATE -fuse-ld=lld -flto=thin)
44 | target_include_directories(minecraft PRIVATE inc src inc/soloud inc/SDL)
45 |
46 | target_link_libraries(minecraft PRIVATE SDL2 SDL2main SDL2_image)
47 |
48 | target_compile_definitions(minecraft PRIVATE WITH_SDL2_STATIC __cpp_lib_ranges)
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/data/tile_data.json:
--------------------------------------------------------------------------------
1 | {
2 | "tiles": [
3 | { "id": 0, "name": "white_marble", "size": [64, 64], "corner": [1408, 512 ] },
4 | { "id": 1, "name": "grey_squares", "size": [64, 64], "corner": [1472, 512 ] },
5 | { "id": 2, "name": "orange_fur", "size": [64, 64], "corner": [1536, 512 ] },
6 | { "id": 3, "name": "white_squares", "size": [64, 64], "corner": [1408, 576 ] },
7 | { "id": 4, "name": "blue_squares", "size": [64, 64], "corner": [1472, 576 ] },
8 | { "id": 5, "name": "tan_swirls", "size": [64, 64], "corner": [1536, 576 ] }
9 | ]
10 | }
11 |
12 |
--------------------------------------------------------------------------------
/dox/doc/Camera.dox:
--------------------------------------------------------------------------------
1 | /**
2 | * @struct Fastboi::Camera
3 | * @brief Defines the viewport of Fastboi rendering. It does this by keeping track of a transform in either an owning
4 | * or watching manner.
5 | *
6 | * The camera only uses the position of the transform for its viewport calculations.
7 | */
8 |
9 | /**
10 | * @fn Fastboi::~Camera
11 | * @brief Deletes the transform from memory iff type == Camera::OWNING
12 | */
13 | /**
14 | * @fn Fastboi::Camera Fastboi::Camera::Camera(const Transform& target, CameraTarget type)
15 | *
16 | * @param target The transform to focus on
17 | * @param type Determines the owning behavior over the target transform. If type == Camera::OWNING, then
18 | * the transform will be deleted from memory upon destruction of the camera, or on Camera::SetTarget().
19 | * If type == Camera::WATCHING, then the transform will @b not be deleted.
20 | *
21 | */
22 |
23 | /**
24 | * @fn Position Camera::ScreenToWorldPos(const Position& screenPos) const
25 | * @brief Converts a given position relative to the screen (top-left corner) to its equivalent in the world.
26 | */
27 |
28 | /**
29 | * @fn Position Camera::WorldToScreenPos(const Position& worldPos) const
30 | * @brief Converts a given world positiontoits equivalent position relative to the screen (top-left corner)
31 | */
32 |
33 | /**
34 | * @fn bool Camera::IsPointVisible(const Position& worldPos) const
35 | * @brief Returns whether a given point is visible in the camera's viewport.
36 | */
37 | /**
38 | * @fn void Fastboi::SetCamera(Camera&& camera)
39 | * @brief Sets the global camera
40 | * @param camera This is moved into Fastboi::camera
41 | */
42 |
43 | /**
44 | * @var Fastboi::Camera Fastboi::camera
45 | * @brief The global camera object.
46 | *
47 | * This is defaulted to a nullptr for target. Trying to render anything in the world or get the targe will cause
48 | * a crash, as there are no checks for nullptr.
49 | */
50 |
--------------------------------------------------------------------------------
/examples/FastboiCore.cpp:
--------------------------------------------------------------------------------
1 | #include "src/Fastboi.h"
2 | #include "src/Slowboi/Game.h"
3 | #include "src/BoxColorRenderer.h"
4 |
5 | using namespace Slowboi;
6 | using namespace Fastboi;
7 | using namespace Slowboi::Componenets;
8 | using namespace Fastboi::Components;
9 |
10 | "Example Instantiate";
11 | Gameobject& go = Fastboi::Instantiate();
12 | Bullet& bullet = Fastboi::Instantiate(Position(175, 50), Size(200, 10));
13 |
14 | "Example Destroy";
15 | Gameobject& go = Fastboi::Instantiate();
16 | go.AddComponent(Position(25, 50), Size(30, 30));
17 | go.AddComponent(go);
18 |
19 | Fastboi::Destroy(go); // When go is destroyed, its Transform and BoxColorRenderer will also be destroyed
20 |
--------------------------------------------------------------------------------
/examples/Gameobject.cpp:
--------------------------------------------------------------------------------
1 | #include "FastboiCore.h"
2 | #include
3 | #include
4 | #include
5 |
6 | using namespace Fastboi;
7 | using namespace Fastboi::Components;
8 |
9 | "Example AddComponent"
10 | Gameobject gameobject;
11 |
12 | Transform& transform = gameobject.AddComponent(Position(25, 35), Size(70, 80));
13 | transform.rotation += 50_deg;
14 |
15 | gameobject.AddComponent(0, 0, 255, 255);
16 |
17 | struct Printer {
18 | GORef go;
19 | std::string s;
20 |
21 | Printer(GORef&& go, std::string s) : go(std::move(go)), s(s) { }
22 |
23 | void Start() {
24 | printf("Starting %s with message '%s'\n", go().name.c_str(), s.c_str());
25 | }
26 |
27 | void Update() {
28 | printf("Updating %s with message '%s'\n", go().name.c_str(), s.c_str());
29 | }
30 | };
31 |
32 | gameobject.AddComponent("A custom component");
33 |
34 | "Example GetComponent"
35 | Gameobject go;
36 |
37 | go.AddComponent(100, 100, 0, 255);
38 | ColorComp& color = go.GetComponent();
39 |
40 |
41 | "Example Gameobject"
42 | // The instantiation function for a bullet
43 | void BulletInst(Gameobject& go, const Position& pos, const Vecf& dir) {
44 | go.AddComponent(pos, Size(100.f, 50.f), 0_deg); // Add a transform at the given position, with Size 100, 50 and a rotation of 0 degrees
45 | go.AddComponent(250.f * dir.normalized(), 0_deg); // Give the gameobject a velocity of 250 in the given direction, and 0 rotational velocity
46 |
47 | // Add a collider with a trigger flag of the mask layer PARTICLES.
48 | // Then, only allow it to collide with colliders in the PLAYER or UNITS mask layers.
49 | go.AddComponent(Collider::TRIGGER, CollisionLayer::PARTICLES).mask.Include(CollisionLayer::PLAYER, CollisionLayer::UNITS);
50 |
51 | go.AddComponent(RenderData(RenderOrder::PARTICLES)); // Add a wireframe renderer in the PARTICLES layer
52 | go.AddComponent(255, 0, 0, 255); // Add the color red
53 | }
54 |
55 | // Instantiate a Gameobject following the steps in BulletInst
56 | Gameobject& bullet = Fastboi::Instantiate(Position(500, 350), Vecf(4.f, 1.5f));
57 |
58 | // And to destroy the bullet, simply do:
59 | Fastboi::Destroy(bullet);
--------------------------------------------------------------------------------
/inc/SDL/SDL_clipboard.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_clipboard.h
24 | *
25 | * Include file for SDL clipboard handling
26 | */
27 |
28 | #ifndef SDL_clipboard_h_
29 | #define SDL_clipboard_h_
30 |
31 | #include "SDL_stdinc.h"
32 |
33 | #include "begin_code.h"
34 | /* Set up for C function definitions, even when using C++ */
35 | #ifdef __cplusplus
36 | extern "C" {
37 | #endif
38 |
39 | /* Function prototypes */
40 |
41 | /**
42 | * \brief Put UTF-8 text into the clipboard
43 | *
44 | * \sa SDL_GetClipboardText()
45 | */
46 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
47 |
48 | /**
49 | * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
50 | *
51 | * \sa SDL_SetClipboardText()
52 | */
53 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
54 |
55 | /**
56 | * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
57 | *
58 | * \sa SDL_GetClipboardText()
59 | */
60 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
61 |
62 |
63 | /* Ends C function definitions when using C++ */
64 | #ifdef __cplusplus
65 | }
66 | #endif
67 | #include "close_code.h"
68 |
69 | #endif /* SDL_clipboard_h_ */
70 |
71 | /* vi: set ts=4 sw=4 expandtab: */
72 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_error.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_error.h
24 | *
25 | * Simple error message routines for SDL.
26 | */
27 |
28 | #ifndef SDL_error_h_
29 | #define SDL_error_h_
30 |
31 | #include "SDL_stdinc.h"
32 |
33 | #include "begin_code.h"
34 | /* Set up for C function definitions, even when using C++ */
35 | #ifdef __cplusplus
36 | extern "C" {
37 | #endif
38 |
39 | /* Public functions */
40 | /* SDL_SetError() unconditionally returns -1. */
41 | extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
42 | extern DECLSPEC const char *SDLCALL SDL_GetError(void);
43 | extern DECLSPEC void SDLCALL SDL_ClearError(void);
44 |
45 | /**
46 | * \name Internal error functions
47 | *
48 | * \internal
49 | * Private error reporting function - used internally.
50 | */
51 | /* @{ */
52 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
53 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
54 | #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
55 | typedef enum
56 | {
57 | SDL_ENOMEM,
58 | SDL_EFREAD,
59 | SDL_EFWRITE,
60 | SDL_EFSEEK,
61 | SDL_UNSUPPORTED,
62 | SDL_LASTERROR
63 | } SDL_errorcode;
64 | /* SDL_Error() unconditionally returns -1. */
65 | extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
66 | /* @} *//* Internal error functions */
67 |
68 | /* Ends C function definitions when using C++ */
69 | #ifdef __cplusplus
70 | }
71 | #endif
72 | #include "close_code.h"
73 |
74 | #endif /* SDL_error_h_ */
75 |
76 | /* vi: set ts=4 sw=4 expandtab: */
77 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_gesture.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 Sam Lantinga
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 | 2. Altered source versions must be plainly marked as such, and must not be
18 | misrepresented as being the original software.
19 | 3. This notice may not be removed or altered from any source distribution.
20 | */
21 |
22 | /**
23 | * \file SDL_gesture.h
24 | *
25 | * Include file for SDL gesture event handling.
26 | */
27 |
28 | #ifndef SDL_gesture_h_
29 | #define SDL_gesture_h_
30 |
31 | #include "SDL_stdinc.h"
32 | #include "SDL_error.h"
33 | #include "SDL_video.h"
34 |
35 | #include "SDL_touch.h"
36 |
37 |
38 | #include "begin_code.h"
39 | /* Set up for C function definitions, even when using C++ */
40 | #ifdef __cplusplus
41 | extern "C" {
42 | #endif
43 |
44 | typedef Sint64 SDL_GestureID;
45 |
46 | /* Function prototypes */
47 |
48 | /**
49 | * \brief Begin Recording a gesture on the specified touch, or all touches (-1)
50 | *
51 | *
52 | */
53 | extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
54 |
55 |
56 | /**
57 | * \brief Save all currently loaded Dollar Gesture templates
58 | *
59 | *
60 | */
61 | extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
62 |
63 | /**
64 | * \brief Save a currently loaded Dollar Gesture template
65 | *
66 | *
67 | */
68 | extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst);
69 |
70 |
71 | /**
72 | * \brief Load Dollar Gesture templates from a file
73 | *
74 | *
75 | */
76 | extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
77 |
78 |
79 | /* Ends C function definitions when using C++ */
80 | #ifdef __cplusplus
81 | }
82 | #endif
83 | #include "close_code.h"
84 |
85 | #endif /* SDL_gesture_h_ */
86 |
87 | /* vi: set ts=4 sw=4 expandtab: */
88 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_name.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 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 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_opengles.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 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 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_opengles2.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 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 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_opengles2_gl2platform.h:
--------------------------------------------------------------------------------
1 | #ifndef __gl2platform_h_
2 | #define __gl2platform_h_
3 |
4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
5 |
6 | /*
7 | * This document is licensed under the SGI Free Software B License Version
8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
9 | */
10 |
11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
12 | *
13 | * Adopters may modify khrplatform.h and this file to suit their platform.
14 | * You are encouraged to submit all modifications to the Khronos group so that
15 | * they can be included in future versions of this file. Please submit changes
16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
17 | * by filing a bug against product "OpenGL-ES" component "Registry".
18 | */
19 |
20 | /*#include */
21 |
22 | #ifndef GL_APICALL
23 | #define GL_APICALL KHRONOS_APICALL
24 | #endif
25 |
26 | #ifndef GL_APIENTRY
27 | #define GL_APIENTRY KHRONOS_APIENTRY
28 | #endif
29 |
30 | #endif /* __gl2platform_h_ */
31 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_quit.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 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 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_revision.h:
--------------------------------------------------------------------------------
1 | #define SDL_REVISION "hg-12952:bc90ce38f1e2"
2 | #define SDL_REVISION_NUMBER 12952
3 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_test.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 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 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_test_compare.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 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 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_test_images.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 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 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_test_log.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 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 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_test_memory.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 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 |
--------------------------------------------------------------------------------
/inc/SDL/SDL_types.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 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 |
--------------------------------------------------------------------------------
/inc/SDL/close_code.h:
--------------------------------------------------------------------------------
1 | /*
2 | Simple DirectMedia Layer
3 | Copyright (C) 1997-2019 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 |
--------------------------------------------------------------------------------
/inc/Utility.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | inline size_t hash_cstring(const char* p) {
7 | size_t result = 0;
8 | constexpr size_t prime = 31;
9 |
10 | for (size_t i = 0; p[i] != '\0'; i++) {
11 | result = p[i] + (result * prime);
12 | }
13 |
14 | return result;
15 | }
16 |
17 | struct cstring_hasher {
18 | std::size_t __attribute__((flatten)) operator()(const char* const& p) const {
19 | return hash_cstring(p);
20 | };
21 | };
22 |
23 | struct cstring_eq {
24 | bool operator()(const char* const& lhs, const char* const& rhs) const {
25 | return std::strcmp(lhs, rhs) == 0;
26 | }
27 | };
28 |
29 | struct SDL_Rect;
30 | struct SDL_FRect;
31 |
32 | void print_rect(const SDL_Rect& rect);
33 | void print_rect(const SDL_FRect& rect);
--------------------------------------------------------------------------------
/inc/ctti/detail/algorithm.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_DETAIL_ALGORITHM_HPP
2 | #define CTTI_DETAIL_ALGORITHM_HPP
3 |
4 | #include
5 |
6 | namespace ctti
7 | {
8 |
9 | namespace detail
10 | {
11 |
12 | template
13 | constexpr const T* begin(const T(&array)[N])
14 | {
15 | return &array[0];
16 | }
17 |
18 | template
19 | constexpr const T* end(const T(&array)[N])
20 | {
21 | return &array[N];
22 | }
23 |
24 | template
25 | constexpr bool equal_range(LhsIt lhsBegin, LhsIt lhsEnd, RhsIt rhsBegin, RhsIt rhsEnd)
26 | {
27 | return (lhsBegin != lhsEnd && rhsBegin != rhsEnd) ? *lhsBegin == *rhsBegin &&
28 | equal_range(lhsBegin + 1, lhsEnd, rhsBegin + 1, rhsEnd) : (lhsBegin == lhsEnd && rhsBegin == rhsEnd);
29 | }
30 |
31 | template
32 | constexpr const T& max(const T& lhs, const T& rhs)
33 | {
34 | return (lhs >= rhs) ? lhs : rhs;
35 | }
36 |
37 | template
38 | constexpr const T& min(const T& lhs, const T& rhs)
39 | {
40 | return (lhs <= rhs) ? lhs : rhs;
41 | }
42 |
43 | }
44 |
45 | }
46 |
47 | #endif // CTTI_DETAIL_ALGORITHM_HPP
48 |
--------------------------------------------------------------------------------
/inc/ctti/detail/entity_name.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_DETAIL_ENTITY_NAME_HPP
2 | #define CTTI_DETAIL_ENTITY_NAME_HPP
3 |
4 | #include "cstring.hpp"
5 |
6 | namespace ctti
7 | {
8 |
9 | namespace detail
10 | {
11 |
12 | class entity_name
13 | {
14 | public:
15 | constexpr entity_name(const ctti::detail::cstring& str) :
16 | _str{str}
17 | {}
18 |
19 | constexpr ctti::detail::cstring str() const
20 | {
21 | return _str;
22 | }
23 |
24 | constexpr ctti::detail::cstring operator[](std::size_t i) const
25 | {
26 | return colon_scan(_str.begin(), _str.end(), i);
27 | }
28 |
29 | private:
30 | ctti::detail::cstring _str;
31 |
32 | constexpr ctti::detail::cstring colon_scan(const char* begin, const char* end, std::size_t i) const
33 | {
34 | return (begin == end) ? {begin, end} :
35 | (i == 0) ? {begin, end}
36 | (colon_count == 0 && *begin == ':') ? colon_scan(++begin, end, i, ++colon_count) :
37 | (colon_count == 1 && *begin == ':') ? colon_scan(++begin, end, i - 1, 0)
38 | (
39 | }
40 | };
41 |
42 | }
43 |
44 | }
45 |
46 | #endif // CTTI_DETAIL_ENTITY_NAME_HPP
47 |
--------------------------------------------------------------------------------
/inc/ctti/detail/hash.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_DETAIL_HASH_HPP
2 | #define CTTI_DETAIL_HASH_HPP
3 |
4 | #include
5 |
6 | namespace ctti
7 | {
8 | namespace detail
9 | {
10 | // From https://github.com/foonathan/string_id. As usually, thanks Jonathan.
11 |
12 | using hash_t = std::uint64_t;
13 |
14 | // See http://www.isthe.com/chongo/tech/comp/fnv/#FNV-param
15 | constexpr hash_t fnv_basis = 14695981039346656037ull;
16 | constexpr hash_t fnv_prime = 1099511628211ull;
17 |
18 | // FNV-1a 64 bit hash
19 | constexpr hash_t fnv1a_hash(std::size_t n, const char *str, hash_t hash = fnv_basis)
20 | {
21 | return n > 0 ? fnv1a_hash(n - 1, str + 1, (hash ^ *str) * fnv_prime) : hash;
22 | }
23 |
24 | template
25 | constexpr hash_t fnv1a_hash(const char (&array)[N])
26 | {
27 | return fnv1a_hash(N - 1, &array[0]);
28 | }
29 | }
30 | }
31 |
32 | #endif /* CTTI_DETAIL_HASH_HPP */
33 |
--------------------------------------------------------------------------------
/inc/ctti/detail/language_features.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_LANGUAGE_FEATURES_HPP
2 | #define CTTI_LANGUAGE_FEATURES_HPP
3 |
4 | #ifdef __cpp_variable_templates
5 | #define CTTI_HAS_VARIABLE_TEMPLATES
6 | #endif // __cpp_variable_templates
7 |
8 | #define CTTI_HAS_CONSTEXPR_PRETTY_FUNCTION
9 |
10 | #if defined(__GCC__) && __GCC__ < 5
11 | #undef CTTI_HAS_CONSTEXPR_PRETTY_FUNCTION
12 | #endif // GCC 4.x
13 |
14 | #ifdef __clang__
15 | #define CTTI_HAS_ENUM_AWARE_PRETTY_FUNCTION
16 | #endif // __clang__
17 |
18 | #endif // CTTI_LANGUAGE_FEATURES_HPP
19 |
--------------------------------------------------------------------------------
/inc/ctti/detail/name_filters.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_DETAIL_NAMEFILTERS_HPP
2 | #define CTTI_DETAIL_NAMEFILTERS_HPP
3 |
4 | #include "cstring.hpp"
5 |
6 | namespace ctti
7 | {
8 |
9 | namespace detail
10 | {
11 |
12 | constexpr ctti::detail::cstring filter_prefix(const ctti::detail::cstring& str, const ctti::detail::cstring& prefix)
13 | {
14 | return str.size() >= prefix.size() ? (str(0, prefix.size()) == prefix ? str(prefix.size(), str.size()) : str) : str;
15 | }
16 |
17 | constexpr ctti::detail::cstring leftpad(const ctti::detail::cstring& str)
18 | {
19 | return (str.size() > 0 && str[0] == ' ') ? leftpad(str(1, str.size())) : str;
20 | }
21 |
22 | constexpr ctti::detail::cstring filter_class(const ctti::detail::cstring& type_name)
23 | {
24 | return leftpad(filter_prefix(leftpad(type_name), "class"));
25 | }
26 |
27 | constexpr ctti::detail::cstring filter_struct(const ctti::detail::cstring& type_name)
28 | {
29 | return leftpad(filter_prefix(leftpad(type_name), "struct"));
30 | }
31 |
32 | constexpr ctti::detail::cstring filter_typename_prefix(const ctti::detail::cstring& type_name)
33 | {
34 | return filter_struct(filter_class(type_name));
35 | }
36 |
37 | namespace
38 | {
39 |
40 | constexpr const char* find_ith_impl(const ctti::detail::cstring& name, const ctti::detail::cstring& substring, const char* res, std::size_t i, bool infinite = false)
41 | {
42 | return (name.length() >= substring.length()) ?
43 | ((name(0, substring.length()) == substring) ?
44 | ((i == 0) ?
45 | name.begin()
46 | :
47 | find_ith_impl(name(substring.length(), name.length()), substring, name.begin(), i - 1, infinite))
48 | :
49 | find_ith_impl(name(1, name.length()), substring, res, i, infinite))
50 | :
51 | (!infinite) ? name.end() : res;
52 | }
53 |
54 | }
55 |
56 | constexpr const char* find_ith(const ctti::detail::cstring& name, const ctti::detail::cstring& substring, std::size_t i)
57 | {
58 | return find_ith_impl(name, substring, name.end(), i);
59 | }
60 |
61 | constexpr const char* find_last(const ctti::detail::cstring& name, const ctti::detail::cstring& substring)
62 | {
63 | return find_ith_impl(name, substring, name.end(), -1, true);
64 | }
65 |
66 | constexpr const char* find(const ctti::detail::cstring& name, const ctti::detail::cstring& substring)
67 | {
68 | return find_ith(name, substring, 0);
69 | }
70 |
71 |
72 |
73 | }
74 |
75 | }
76 |
77 | #endif // CTTI_DETAIL_NAMEFILTERS_HPP
78 |
--------------------------------------------------------------------------------
/inc/ctti/detail/preprocessor.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_DETAIL_PREPROCESSOR_HPP
2 | #define CTTI_DETAIL_PREPROCESSOR_HPP
3 |
4 | #define CTTI_PP_STR_IMPL(x) #x
5 | #define CTTI_PP_STR(x) CTTI_PP_STR_IMPL(x)
6 |
7 | #endif // CTTI_DETAIL_PREPROCESSOR_HPP
8 |
--------------------------------------------------------------------------------
/inc/ctti/detailed_nameof.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_DETAILED_NAMEOF_HPP
2 | #define CTTI_DETAILED_NAMEOF_HPP
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | namespace ctti
9 | {
10 |
11 |
12 | template
13 | constexpr name_t detailed_nameof()
14 | {
15 | return {ctti::nameof()};
16 | }
17 |
18 | template
19 | constexpr name_t detailed_nameof()
20 | {
21 | return {ctti::nameof()};
22 | }
23 |
24 | #ifdef CTTI_HAS_VARIABLE_TEMPLATES
25 | template
26 | constexpr ctti::name_t detailed_nameof_v = ctti::detailed_nameof();
27 |
28 | // CONSIDER USING detailed_nameof_v INSTEAD
29 | template
30 | constexpr ctti::name_t detailed_nameof_value_v = ctti::detailed_nameof();
31 | #endif // CTTI_HAS_VARIABLE_TEMPLATES
32 |
33 | }
34 |
35 | #endif // CTTI_DETAILED_NAMEOF_HPP
36 |
--------------------------------------------------------------------------------
/inc/ctti/hash_literal.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_HASH_LITERAL_HPP
2 | #define CTTI_HASH_LITERAL_HPP
3 |
4 | #include
5 |
6 | #ifdef CTI_HASH_LITERAL_NAMESPACE
7 | namespace CTTI_HASH_LITERAL_NAMESPACE
8 | {
9 | #endif // CTTI_HASH_LITERAL_NAMESPACE
10 |
11 | constexpr std::uint64_t operator"" _sh(const char* str, std::size_t length)
12 | {
13 | return ctti::detail::cstring{str, length}.hash();
14 | }
15 |
16 | #ifdef CTTI_HASH_LITERAL_NAMESPACE
17 | }
18 | #endif // CTTI_HASH_LITERAL_NAMESPACE
19 |
20 | #endif // CTTI_HASH_LITERAL_HPP
21 |
--------------------------------------------------------------------------------
/inc/ctti/model.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_MODEL_HPP
2 | #define CTTI_MODEL_HPP
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | namespace ctti
9 | {
10 |
11 | template
12 | struct model
13 | {
14 | using symbols = ctti::meta::list;
15 | };
16 |
17 | template
18 | ctti::model<> ctti_model(ctti::type_tag);
19 |
20 | namespace detail
21 | {
22 | template
23 | struct get_model
24 | {
25 | using type = decltype(ctti_model(ctti::type_tag()));
26 | };
27 |
28 | template
29 | struct get_model>
30 | {
31 | using type = typename T::ctti_model;
32 | };
33 | }
34 |
35 | template
36 | using get_model = typename ctti::detail::get_model::type;
37 |
38 | template
39 | struct has_model : public ctti::meta::bool_<
40 | (ctti::meta::list_size>() > 0)
41 | > {};
42 |
43 | }
44 |
45 | #endif // CTTI_MODEL_HPP
46 |
--------------------------------------------------------------------------------
/inc/ctti/static_value.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_DETAIL_STATIC_VALUE_HPP
2 | #define CTTI_DETAIL_STATIC_VALUE_HPP
3 |
4 | namespace ctti
5 | {
6 |
7 | template
8 | struct static_value
9 | {
10 | constexpr static_value() = default;
11 | using value_type = T;
12 | static constexpr value_type value = Value;
13 |
14 | constexpr operator value_type() const
15 | {
16 | return Value;
17 | }
18 |
19 | constexpr value_type get() const
20 | {
21 | return Value;
22 | }
23 |
24 | friend constexpr bool operator==(const static_value& lhs, const value_type rhs)
25 | {
26 | return lhs.get() == rhs;
27 | }
28 |
29 | friend constexpr bool operator==(const value_type lhs, const static_value& rhs)
30 | {
31 | return rhs == lhs;
32 | }
33 |
34 | friend constexpr bool operator!=(const static_value& lhs, const value_type rhs)
35 | {
36 | return !(lhs == rhs);
37 | }
38 |
39 | friend constexpr bool operator!=(const value_type lhs, const static_value& rhs)
40 | {
41 | return !(lhs == rhs);
42 | }
43 | };
44 |
45 | template
46 | constexpr T static_value::value;
47 |
48 | }
49 |
50 | #define CTTI_STATIC_VALUE(x) ::ctti::static_value
51 |
52 | #endif // CTTI_DETAIL_STATIC_VALUE_HPP
53 |
--------------------------------------------------------------------------------
/inc/ctti/symbol_from_hash.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_SYMBOL_FROM_HASH_HPP
2 | #define CTTI_SYMBOL_FROM_HASH_HPP
3 |
4 | #include
5 |
6 | namespace ctti
7 | {
8 |
9 | template
10 | using symbol_from_hash = decltype(ctti_symbol_from_hash(ctti::meta::uint64_t()));
11 |
12 | }
13 |
14 |
15 | #endif // CTTI_SYMBOL_FROM_HASH_HPP
16 |
--------------------------------------------------------------------------------
/inc/ctti/tie.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_TIE_HPP
2 | #define CTTI_TIE_HPP
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | namespace ctti
9 | {
10 |
11 | namespace detail
12 | {
13 |
14 | template
15 | struct tie_t;
16 |
17 | template
18 | struct tie_t, ctti::meta::list>
19 | {
20 | constexpr tie_t(Refs&... refs) :
21 | _refs{refs...}
22 | {}
23 |
24 | template
25 | void operator=(const T& object)
26 | {
27 | assign(object, ctti::meta::make_index_sequence_for());
28 | }
29 |
30 | private:
31 | template
32 | using Symbol = ctti::meta::pack_get_t;
33 |
34 |
35 | template::template is_member_of()
37 | >::type>
38 | void assign_member(const T& object)
39 | {
40 | std::get(_refs) = ctti::get_member_value>(object);
41 | }
42 |
43 | template::template is_member_of()
45 | >::type>
46 | void assign_member(const T& object)
47 | {}
48 |
49 | template
50 | void assign(const T& object, ctti::meta::index_sequence)
51 | {
52 | [](...){}((tie_t::assign_member(object), 42)...);
53 | }
54 |
55 | std::tuple _refs;
56 | };
57 |
58 | }
59 |
60 | template
61 | constexpr ctti::detail::tie_t<
62 | ctti::meta::list, ctti::meta::list
63 | > tie(Refs&... refs)
64 | {
65 | return {refs...};
66 | }
67 |
68 | }
69 |
70 | #endif // CTTI_TIE_HPP
71 |
--------------------------------------------------------------------------------
/inc/ctti/type_tag.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CTTI_TYPE_TAG_HPP
2 | #define CTTI_TYPE_TAG_HPP
3 |
4 | namespace ctti
5 | {
6 |
7 | template
8 | struct type_tag
9 | {
10 | constexpr type_tag() = default;
11 | using type = T;
12 | };
13 |
14 | }
15 |
16 | #endif // CTTI_TYPE_TAG_HPP
17 |
--------------------------------------------------------------------------------
/inc/nano_ss/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2012-2019 ApEk, NoAvailableAlias, Nano-signal-slot Contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/inc/nano_ss/nano_function.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace Nano
7 | {
8 |
9 | using Delegate_Key = std::array;
10 |
11 | template class Function;
12 | template
13 | class Function