├── .gitattributes ├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── docs └── README.md ├── examples └── README.md ├── include ├── Feather │ ├── Components │ │ ├── AnimationComponent.cpp │ │ ├── AnimationComponent.h │ │ ├── Collider.cpp │ │ ├── Collider.h │ │ ├── Component.cpp │ │ ├── Component.h │ │ ├── Drawable.cpp │ │ ├── Drawable.h │ │ ├── KeyboardControl.cpp │ │ ├── KeyboardControl.h │ │ ├── SoundEmitter.cpp │ │ ├── SoundEmitter.h │ │ ├── Sprite.cpp │ │ ├── Sprite.h │ │ ├── Transform.cpp │ │ ├── Transform.h │ │ ├── Velocity.cpp │ │ └── Velocity.h │ ├── Debug │ │ ├── Debug.cpp │ │ └── Debug.h │ ├── Entities │ │ ├── Entity.cpp │ │ ├── Entity.h │ │ └── SharedContext.h │ ├── Game.cpp │ ├── Game.h │ ├── Main.cpp │ ├── ResourceManager.cpp │ ├── ResourceManager.h │ ├── Systems │ │ ├── AnimationSystem.cpp │ │ ├── AnimationSystem.h │ │ ├── CollisionSystem.cpp │ │ ├── CollisionSystem.h │ │ ├── ComponentSystem.cpp │ │ ├── ComponentSystem.h │ │ ├── EntityManager.cpp │ │ ├── EntityManager.h │ │ ├── InputManager.cpp │ │ ├── InputManager.h │ │ ├── KeyboardControlSystem.cpp │ │ ├── KeyboardControlSystem.h │ │ ├── MovementSystem.cpp │ │ ├── MovementSystem.h │ │ ├── RenderSystem.cpp │ │ └── RenderSystem.h │ ├── Utilities │ │ ├── Color.h │ │ ├── Color.inl │ │ ├── Rect.h │ │ ├── Rect.inl │ │ ├── Types.h │ │ ├── Vector2.h │ │ └── Vector2.inl │ ├── Windows │ │ ├── View.cpp │ │ ├── View.h │ │ ├── Window.cpp │ │ └── Window.h │ ├── rigidentity.cpp │ ├── rigidentity.h │ ├── text.cpp │ ├── text.h │ ├── timer.cpp │ └── timer.h ├── Unix │ └── SDL2 │ │ ├── SDL.h │ │ ├── SDL_assert.h │ │ ├── SDL_atomic.h │ │ ├── SDL_audio.h │ │ ├── SDL_bits.h │ │ ├── SDL_blendmode.h │ │ ├── SDL_clipboard.h │ │ ├── SDL_config.h │ │ ├── SDL_config.h.cmake │ │ ├── SDL_config.h.in │ │ ├── SDL_config_android.h │ │ ├── SDL_config_iphoneos.h │ │ ├── SDL_config_macosx.h │ │ ├── SDL_config_macosx.h.orig │ │ ├── SDL_config_minimal.h │ │ ├── SDL_config_pandora.h │ │ ├── SDL_config_psp.h │ │ ├── SDL_config_windows.h │ │ ├── SDL_config_winrt.h │ │ ├── SDL_config_wiz.h │ │ ├── SDL_copying.h │ │ ├── SDL_cpuinfo.h │ │ ├── SDL_egl.h │ │ ├── SDL_endian.h │ │ ├── SDL_error.h │ │ ├── SDL_events.h │ │ ├── SDL_filesystem.h │ │ ├── SDL_gamecontroller.h │ │ ├── SDL_gesture.h │ │ ├── SDL_guid.h │ │ ├── SDL_haptic.h │ │ ├── SDL_hidapi.h │ │ ├── SDL_hints.h │ │ ├── SDL_image.h │ │ ├── SDL_joystick.h │ │ ├── SDL_keyboard.h │ │ ├── SDL_keycode.h │ │ ├── SDL_loadso.h │ │ ├── SDL_locale.h │ │ ├── SDL_log.h │ │ ├── SDL_main.h │ │ ├── SDL_messagebox.h │ │ ├── SDL_metal.h │ │ ├── SDL_misc.h │ │ ├── SDL_mixer.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_ttf.h │ │ ├── SDL_types.h │ │ ├── SDL_version.h │ │ ├── SDL_video.h │ │ ├── SDL_vulkan.h │ │ ├── begin_code.h │ │ └── close_code.h └── Windows │ └── SDL2 │ ├── SDL.h │ ├── SDL_assert.h │ ├── SDL_atomic.h │ ├── SDL_audio.h │ ├── SDL_bits.h │ ├── SDL_blendmode.h │ ├── SDL_clipboard.h │ ├── SDL_config.h │ ├── SDL_config.h.cmake │ ├── SDL_config.h.in │ ├── SDL_config_android.h │ ├── SDL_config_iphoneos.h │ ├── SDL_config_macosx.h │ ├── SDL_config_macosx.h.orig │ ├── SDL_config_minimal.h │ ├── SDL_config_pandora.h │ ├── SDL_config_psp.h │ ├── SDL_config_windows.h │ ├── SDL_config_winrt.h │ ├── SDL_config_wiz.h │ ├── SDL_copying.h │ ├── SDL_cpuinfo.h │ ├── SDL_egl.h │ ├── SDL_endian.h │ ├── SDL_error.h │ ├── SDL_events.h │ ├── SDL_filesystem.h │ ├── SDL_gamecontroller.h │ ├── SDL_gesture.h │ ├── SDL_guid.h │ ├── SDL_haptic.h │ ├── SDL_hidapi.h │ ├── SDL_hints.h │ ├── SDL_image.h │ ├── SDL_joystick.h │ ├── SDL_keyboard.h │ ├── SDL_keycode.h │ ├── SDL_loadso.h │ ├── SDL_locale.h │ ├── SDL_log.h │ ├── SDL_main.h │ ├── SDL_messagebox.h │ ├── SDL_metal.h │ ├── SDL_misc.h │ ├── SDL_mixer.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_ttf.h │ ├── SDL_types.h │ ├── SDL_version.h │ ├── SDL_video.h │ ├── SDL_vulkan.h │ ├── begin_code.h │ └── close_code.h └── lib ├── Unix ├── lib │ ├── cmake │ │ └── SDL2 │ │ │ ├── sdl2-config-version.cmake │ │ │ └── sdl2-config.cmake │ ├── libSDL2-2.0.0.dylib │ ├── libSDL2.a │ ├── libSDL2.dylib │ ├── libSDL2_test.a │ ├── libSDL2main.a │ └── pkgconfig │ │ └── sdl2.pc ├── lib_image │ ├── cmake │ │ └── SDL2_image │ │ │ ├── sdl2_image-config-version.cmake │ │ │ └── sdl2_image-config.cmake │ ├── libSDL2_image-2.0.0.dylib │ ├── libSDL2_image.a │ ├── libSDL2_image.dylib │ └── pkgconfig │ │ └── SDL2_image.pc ├── lib_mixer │ ├── cmake │ │ └── SDL2_mixer │ │ │ ├── sdl2_mixer-config-version.cmake │ │ │ └── sdl2_mixer-config.cmake │ ├── libSDL2_mixer-2.0.0.dylib │ ├── libSDL2_mixer.a │ ├── libSDL2_mixer.dylib │ └── pkgconfig │ │ └── SDL2_mixer.pc └── lib_ttf │ ├── cmake │ └── SDL2_ttf │ │ ├── sdl2_ttf-config-version.cmake │ │ └── sdl2_ttf-config.cmake │ ├── libSDL2_ttf-2.0.0.dylib │ ├── libSDL2_ttf.a │ ├── libSDL2_ttf.dylib │ └── pkgconfig │ └── SDL2_ttf.pc └── Windows └── lib ├── LICENSE.freetype.txt ├── LICENSE.harfbuzz.txt ├── LICENSE.modplug.txt ├── LICENSE.ogg-vorbis.txt ├── LICENSE.opus.txt ├── LICENSE.opusfile.txt ├── LICENSE.tiff.txt ├── LICENSE.webp.txt ├── LICENSE.zlib.txt ├── SDL2.dll ├── SDL2.lib ├── SDL2_image.lib ├── SDL2_mixer.lib ├── SDL2_ttf.lib ├── SDL2main.lib ├── SDL2test.lib ├── libmodplug-1.dll ├── libogg-0.dll ├── libopus-0.dll ├── libopusfile-0.dll ├── libtiff-5.dll └── libwebp-7.dll /.gitattributes: -------------------------------------------------------------------------------- 1 | lib/** linguist-vendored 2 | include/Unix/** linguist-vendored 3 | include/Windows/** linguist-vendored 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.idea 2 | *.xml 3 | *.iml 4 | .vscode/* 5 | /build/ 6 | /cmake-build-debug/ 7 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1...3.24) 2 | 3 | project( 4 | Feather-Engine 5 | VERSION 1.0 6 | LANGUAGES CXX 7 | ) 8 | 9 | set(CMAKE_CXX_STANDARD 20) 10 | 11 | option(DEBUG_ON "Enables DEBUG_MODE macro" ON) 12 | option(DEBUG_TO_FILE "If DEBUG_MODE is on, outputs stream to file Log.txt" OFF) 13 | 14 | if(DEBUG_ON) 15 | add_compile_definitions(DEBUG_MODE) 16 | if(DEBUG_TO_FILE) 17 | add_compile_definitions(LOG_TO_FILE) 18 | endif() 19 | endif() 20 | 21 | 22 | set(SOURCES 23 | include/Feather/Components/AnimationComponent.cpp 24 | include/Feather/Components/Component.cpp 25 | include/Feather/Components/Drawable.cpp 26 | include/Feather/Components/KeyboardControl.cpp 27 | include/Feather/Components/SoundEmitter.cpp 28 | include/Feather/Components/Sprite.cpp 29 | include/Feather/Components/Transform.cpp 30 | include/Feather/Components/Velocity.cpp 31 | include/Feather/Components/Collider.cpp 32 | include/Feather/Debug/Debug.cpp 33 | include/Feather/Entities/Entity.cpp 34 | include/Feather/Systems/AnimationSystem.cpp 35 | include/Feather/Systems/ComponentSystem.cpp 36 | include/Feather/Systems/EntityManager.cpp 37 | include/Feather/Systems/InputManager.cpp 38 | include/Feather/Systems/KeyboardControlSystem.cpp 39 | include/Feather/Systems/MovementSystem.cpp 40 | include/Feather/Systems/RenderSystem.cpp 41 | include/Feather/Systems/CollisionSystem.cpp 42 | include/Feather/Windows/View.cpp 43 | include/Feather/Windows/Window.cpp 44 | include/Feather/Main.cpp 45 | include/Feather/ResourceManager.cpp 46 | include/Feather/Game.cpp 47 | ) 48 | 49 | find_library(LIB_IMAGE SDL2_image ./lib/Unix/lib_image) 50 | find_library(LIB_MIXER SDL2_mixer ./lib/Unix/lib_mixer) 51 | find_library(LIB_TTF SDL2_ttf ./lib/Unix/lib_ttf) 52 | 53 | find_path(LIB_INCLUDES SDL_image.h ./include/Unix/SDL2) 54 | message(${LIB_INCLUDES}) 55 | include_directories(${LIB_INCLUDES}) 56 | 57 | add_executable(game 58 | ${SOURCES} 59 | ) 60 | 61 | target_include_directories(game 62 | PRIVATE 63 | ${PROJECT_SOURCE_DIR}/include/ 64 | ) 65 | 66 | target_link_libraries(game 67 | SDL2 68 | ${LIB_IMAGE} 69 | ${LIB_MIXER} 70 | ${LIB_TTF} 71 | ) 72 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022 feather engine developers 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Feather Engine 2 | 3 | **CURRENTLY IN EARLY ALPHA. THE ENGINE IS SUBJECT TO CHANGE, AND BUGS MAY BE VERY COMMON.** 4 | 5 | A simple, lightweight, open-source C++ game engine 6 | 7 | It currently has full rendering, text, input, sound, and physics systems set up, although it is still in active development, so things may be changed, added, or removed. 8 | 9 | ## Installing 10 | 11 | To use the Feather Engine, WIP 12 | 13 | ## Developers 14 | 15 | This project is developed by me (formerlybased) in my spare time. Feel free to open a PR or make an issue if you wish to contribute! 16 | 17 | If you do contribute, you may place your name/username here 18 | 19 | - formerlybased (aka IAMACAR) 20 | - BoogeyMan 21 | - drakemj 22 | - JavinalCharles 23 | 24 | ## Documentation 25 | 26 | New documentation is being made for the engine. See the docs/ repository for more information. 27 | 28 | ## Building 29 | 30 | The project uses cmake as its buildsystem. Install cmake, cd into the build/ directory, and then run cmake .. 31 | 32 | ## Shipping a game 33 | 34 | Shipping a game is still a WIP. 35 | 36 | ## Planned Features 37 | 38 | As features are introduced and planned, they will appear here. Not all features listed here will make it into the final engine, nor will every future feature be listed here. **If you are looking to contribute to development, this could be a good place to start**. 39 | 40 | - A more advanced collision / physics system 41 | - Some kind of state manager to make managing different scenes/levels easy 42 | - A timing system 43 | - Window resizing (game scales with it) & fullscreen windows 44 | - Simple serialization (saving & loading funcs) 45 | - Finished documentation 46 | - Reworking examples 47 | 48 | If you want to suggest a feature, open an issue. 49 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Placeholder documentation folder while docs are being rewritten 2 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # A possible location for example projects in the future. 2 | -------------------------------------------------------------------------------- /include/Feather/Components/AnimationComponent.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | namespace fl { 6 | 7 | AnimationComponent::AnimationComponent(Entity* owner) : 8 | Component(owner) 9 | { 10 | 11 | } 12 | 13 | void AnimationComponent::awake() { 14 | m_sprite = m_owner->getComponent().get(); 15 | if(m_sprite == nullptr) 16 | throw std::runtime_error("Error! Sprite Component required when using AnimationComponent Component."); 17 | this->setAnimation(m_currentAnimationID); 18 | } 19 | 20 | void AnimationComponent::addAnimation(IDtype animationID, Animation animation) { 21 | m_animationMap.insert_or_assign(animationID, animation); 22 | 23 | if(m_sprite != nullptr && !m_sprite->hasTexture()) { 24 | setAnimation(animationID); 25 | } 26 | } 27 | 28 | void AnimationComponent::setAnimation(IDtype animationID) { 29 | if (!m_animationMap.contains(animationID)) { 30 | throw std::invalid_argument("INVALID! No matching animation ID found"); 31 | } 32 | m_currentAnimationID = animationID; 33 | 34 | if (m_sprite == nullptr) { 35 | return; 36 | } 37 | 38 | FrameData& frame = m_animationMap.at(m_currentAnimationID).frames[0]; 39 | m_sprite->setTexture(frame.textureID, frame.textureRect); 40 | 41 | m_currentFrame = 0; 42 | m_currentFrameTime = 0; 43 | } 44 | 45 | IDtype AnimationComponent::getCurrentAnimationID() const { 46 | return m_currentAnimationID; 47 | } 48 | 49 | const Animation& AnimationComponent::getCurrentAnimation() const { 50 | return m_animationMap.at(m_currentAnimationID); 51 | } 52 | 53 | void AnimationComponent::updateFrame(float deltaTime) { 54 | const Animation& a = this->getCurrentAnimation(); 55 | 56 | if ((a.frames.size() > 1) && (a.loop || m_currentFrame < a.frames.size() - 1)) { 57 | m_currentFrameTime += deltaTime; 58 | 59 | if (m_currentFrameTime >= a.frames[m_currentFrame].displaySeconds) { 60 | m_currentFrameTime = 0.f; 61 | 62 | m_currentFrame = ((m_currentFrame + 1) % a.frames.size()); 63 | m_sprite->setTexture(a.frames[m_currentFrame].textureID, a.frames[m_currentFrame].textureRect); 64 | 65 | if (!a.frames[m_currentFrame].actionList.empty()) { 66 | for (auto& action : a.frames[m_currentFrame].actionList) { 67 | action(); 68 | } 69 | } 70 | } 71 | } 72 | } 73 | 74 | } // namepsace fl -------------------------------------------------------------------------------- /include/Feather/Components/AnimationComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace fl { 15 | 16 | class AnimationSystem; 17 | 18 | using FrameAction = std::function; 19 | using ActionList = std::forward_list; 20 | 21 | struct FrameData { 22 | IDtype textureID; 23 | IntRect textureRect; 24 | float displaySeconds; 25 | ActionList actionList{}; 26 | }; // struct FrameData 27 | 28 | struct Animation { 29 | std::vector frames; 30 | bool loop = false; 31 | }; // struct Animation 32 | 33 | class AnimationComponent : public Component { 34 | 35 | friend class AnimationSystem; 36 | 37 | public: 38 | AnimationComponent(Entity* owner); 39 | 40 | virtual void awake(); 41 | 42 | void addAnimation(IDtype animationID, Animation animation); 43 | 44 | void setAnimation(IDtype animationID); 45 | 46 | IDtype getCurrentAnimationID() const; 47 | const Animation& getCurrentAnimation() const; 48 | private: 49 | void updateFrame(float deltaTime); 50 | 51 | std::unordered_map m_animationMap; 52 | 53 | IDtype m_currentAnimationID{}; 54 | 55 | std::size_t m_currentFrame{}; 56 | 57 | float m_currentFrameTime{}; 58 | 59 | Sprite* m_sprite = nullptr; 60 | 61 | }; // class AnimationComponent 62 | 63 | } // namespace ba -------------------------------------------------------------------------------- /include/Feather/Components/Collider.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace fl { 5 | 6 | Collider::Collider(fl::Entity* owner) 7 | : Component(owner) 8 | { 9 | 10 | } 11 | 12 | 13 | void Collider::setHitbox(int w, int h) { 14 | hitbox_w = w; 15 | hitbox_h = h; 16 | } 17 | 18 | SDL_Rect& Collider::getHitbox() { 19 | m_hitbox.x = m_owner->getComponent()->getPosition().x; 20 | m_hitbox.y = m_owner->getComponent()->getPosition().y; 21 | m_hitbox.w = hitbox_w; 22 | m_hitbox.h = hitbox_h; 23 | return m_hitbox; 24 | } 25 | 26 | bool Collider::isColliding() { 27 | return m_colliding; 28 | } 29 | 30 | std::vector Collider::getCollisions() { 31 | return m_collisions; 32 | } 33 | 34 | void Collider::setColliding(bool b) { 35 | m_colliding = b; 36 | } 37 | 38 | void Collider::addCollision(Entity* e) { 39 | m_collisions.push_back(e); 40 | } 41 | 42 | void Collider::clearCollisions() { 43 | m_collisions.clear(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /include/Feather/Components/Collider.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace fl { 7 | 8 | class Collider : public fl::Component { 9 | public: 10 | Collider(fl::Entity* owner); 11 | 12 | void setHitbox(int w, int h); 13 | SDL_Rect& getHitbox(); 14 | 15 | bool isColliding(); 16 | std::vector getCollisions(); 17 | 18 | void setColliding(bool b); 19 | void addCollision(Entity* e); 20 | void clearCollisions(); 21 | 22 | private: 23 | int hitbox_w; 24 | int hitbox_h; 25 | SDL_Rect m_hitbox; 26 | bool m_colliding; 27 | std::vector m_collisions; 28 | 29 | }; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /include/Feather/Components/Component.cpp: -------------------------------------------------------------------------------- 1 | #include "Feather/Components/Component.h" 2 | 3 | namespace fl { 4 | 5 | Component::Component(fl::Entity* owner) 6 | : m_owner(owner) 7 | { 8 | 9 | } 10 | 11 | Component::~Component() { 12 | 13 | } 14 | 15 | void Component::awake() { 16 | 17 | } 18 | 19 | fl::Entity* Component::getOwner() { 20 | return m_owner; 21 | } 22 | 23 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Components/Component.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace fl { 4 | 5 | /* Forward Declaration. Every non-virtual subclass of fl::Component should be declared in a file that imports "feather/entities/entity.h"*/ 6 | class Entity; 7 | 8 | class Component { 9 | public: // METHODS & CONSTRUCTORS 10 | Component(fl::Entity* owner); 11 | virtual ~Component(); 12 | 13 | virtual void awake(); 14 | 15 | fl::Entity* getOwner(); 16 | protected: // ATTRIBUTES 17 | fl::Entity* m_owner; 18 | 19 | }; // class Component 20 | 21 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Components/Drawable.cpp: -------------------------------------------------------------------------------- 1 | #include "Feather/Components/Drawable.h" 2 | 3 | namespace fl { 4 | 5 | Drawable::Drawable(fl::Entity* owner, unsigned drawLayer, unsigned sortOrder) 6 | : fl::Component(owner), 7 | m_drawLayer(drawLayer), 8 | m_sortOrder(sortOrder) 9 | { 10 | 11 | } 12 | 13 | void Drawable::setDrawLayer(unsigned drawLayer) { 14 | m_drawLayer = drawLayer; 15 | } 16 | 17 | unsigned Drawable::getDrawLayer() const { 18 | return m_drawLayer; 19 | } 20 | 21 | void Drawable::setSortOrder(unsigned sortOrder) { 22 | m_sortOrder = sortOrder; 23 | } 24 | 25 | unsigned Drawable::getSortOrder() const { 26 | return m_sortOrder; 27 | } 28 | 29 | } // namespace -------------------------------------------------------------------------------- /include/Feather/Components/Drawable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace fl { 8 | 9 | class Drawable : public fl::Component { 10 | public: 11 | Drawable(fl::Entity* owner, unsigned drawLayer = 0, unsigned sortOrder = 0); 12 | 13 | virtual void draw(fl::Window& window) = 0; 14 | 15 | void setDrawLayer(unsigned drawLayer); 16 | unsigned getDrawLayer() const; 17 | 18 | void setSortOrder(unsigned sortOrder); 19 | unsigned getSortOrder() const; 20 | 21 | virtual FloatRect getGlobalBounds() const = 0; 22 | 23 | protected: 24 | // Determines at which layer the drawable will be drawn (i.e. Background, Objects, GUI etc.) 25 | unsigned m_drawLayer; 26 | 27 | // Determines how this Drawable will be sorted within its respective layer. Lower sortOrder are drawn first. 28 | unsigned m_sortOrder; 29 | 30 | }; // class Drawable 31 | 32 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Components/KeyboardControl.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace fl { 5 | 6 | KeyboardControl::KeyboardControl(Entity* owner) : 7 | Component(owner) 8 | { 9 | 10 | } 11 | 12 | void KeyboardControl::bindOnKeyActive(SDL_Keycode key, KeyAction action) { 13 | if(m_keyHeldActions.contains(key)) { 14 | m_keyHeldActions.at(key).push_back(action); 15 | } 16 | else { 17 | m_keyHeldActions.insert(std::make_pair(key, std::vector{action})); 18 | } 19 | } 20 | 21 | void KeyboardControl::bindOnKeyReleased(SDL_Keycode key, KeyAction action) { 22 | if (m_keyReleasedActions.contains(key)) { 23 | m_keyReleasedActions.at(key).push_back(action); 24 | } 25 | else { 26 | m_keyReleasedActions.insert(std::make_pair(key, std::vector{action})); 27 | } 28 | } 29 | 30 | void KeyboardControl::bindOnKeyPressed(SDL_Keycode key, KeyAction action) { 31 | if (m_keyPressedActions.contains(key)) { 32 | m_keyPressedActions.at(key).push_back(action); 33 | } 34 | else { 35 | m_keyPressedActions.insert(std::make_pair(key, std::vector{action})); 36 | } 37 | } 38 | 39 | const KeyBindings& KeyboardControl::getBindingsOnKeyPressed() const { 40 | return m_keyPressedActions; 41 | } 42 | 43 | const KeyBindings& KeyboardControl::getBindingsOnKeyReleased() const { 44 | return m_keyReleasedActions; 45 | } 46 | 47 | const KeyBindings& KeyboardControl::getBindingsOnKeyHeld() const { 48 | return m_keyHeldActions; 49 | } 50 | 51 | 52 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Components/KeyboardControl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace fl { 11 | 12 | using KeyAction = std::function; 13 | 14 | using KeyBindings = std::unordered_map>; 15 | 16 | 17 | class KeyboardControl : public Component { 18 | public: 19 | KeyboardControl(Entity* owner); 20 | 21 | void bindOnKeyActive(SDL_Keycode key, KeyAction action); 22 | void bindOnKeyReleased(SDL_Keycode key, KeyAction action); 23 | void bindOnKeyPressed(SDL_Keycode key, KeyAction action); 24 | 25 | const KeyBindings& getBindingsOnKeyPressed() const; 26 | const KeyBindings& getBindingsOnKeyReleased() const; 27 | const KeyBindings& getBindingsOnKeyHeld() const; 28 | 29 | private: 30 | KeyBindings m_keyPressedActions; 31 | KeyBindings m_keyHeldActions; 32 | KeyBindings m_keyReleasedActions; 33 | }; // class KeyboardControl 34 | 35 | 36 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Components/SoundEmitter.cpp: -------------------------------------------------------------------------------- 1 | #include "Feather/Components/SoundEmitter.h" 2 | 3 | namespace fl { 4 | 5 | SoundEmitter::SoundEmitter(fl::Entity* owner) 6 | : Component(owner) { 7 | 8 | } 9 | 10 | unsigned SoundEmitter::loadSoundFromFile(const std::string &path) { 11 | m_soundID = m_owner->CONTEXT->resources->loadSound(path); 12 | 13 | return m_soundID; 14 | } 15 | 16 | void SoundEmitter::play() { 17 | Mix_PlayChannel(-1, m_owner->CONTEXT->resources->getSound(m_soundID), 0); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /include/Feather/Components/SoundEmitter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "Feather/Components/Component.h" 6 | #include "Feather/Entities/Entity.h" 7 | 8 | namespace fl { 9 | 10 | class SoundEmitter : public fl::Component { 11 | public: 12 | SoundEmitter(fl::Entity* owner); 13 | 14 | unsigned loadSoundFromFile(const std::string& path); 15 | void play(); 16 | private: 17 | unsigned m_soundID; 18 | 19 | 20 | }; // class SoundEmmitter 21 | 22 | }; // namespace fl 23 | -------------------------------------------------------------------------------- /include/Feather/Components/Sprite.cpp: -------------------------------------------------------------------------------- 1 | #include "Feather/Components/Sprite.h" 2 | #include "Feather/Entities/Entity.h" 3 | 4 | #include 5 | 6 | namespace fl { 7 | 8 | Sprite::Sprite(fl::Entity* owner, unsigned drawLayer, unsigned sortOrder) 9 | : fl::Drawable(owner, drawLayer, sortOrder), 10 | m_textureID(0u) // 0 == no texture 11 | { 12 | 13 | } 14 | 15 | void Sprite::awake() { 16 | // Ensure that Owner Entity has a Transform component 17 | m_transform = m_owner->getComponent(); 18 | if (m_transform == nullptr) 19 | throw std::logic_error("Sprite component needs a Transform component."); 20 | } 21 | 22 | void Sprite::draw(fl::Window& window) { 23 | window.draw(m_owner->CONTEXT->resources->getTexture(m_textureID), m_textureRect, this->getGlobalBounds()); 24 | } 25 | 26 | unsigned Sprite::loadTextureFromFile(const std::string& path) { 27 | m_textureID = m_owner->CONTEXT->resources->loadTexture(path); 28 | 29 | SDL_Texture* textureObj = m_owner->CONTEXT->resources->getTexture(m_textureID); 30 | 31 | int width = 0; 32 | int height = 0; 33 | SDL_QueryTexture(textureObj, NULL, NULL, &width, &height); 34 | // Initial textureRect becomes {0, 0, width, height}; ie. The whole size of the texture. 35 | m_textureRect.w = width; 36 | m_textureRect.h = height; 37 | 38 | return m_textureID; 39 | } 40 | 41 | void Sprite::setTexture(IDtype textureID) { 42 | SDL_Texture* textureObj = getOwner()->CONTEXT->resources->getTexture(textureID); 43 | if(textureObj == nullptr) 44 | throw std::invalid_argument("Invalid. Non-existent texture ID given,"); 45 | m_textureID = textureID; 46 | 47 | m_textureRect.l = 0; 48 | m_textureRect.t = 0; 49 | SDL_QueryTexture(textureObj, NULL, NULL, &m_textureRect.w, &m_textureRect.h); 50 | } 51 | 52 | void Sprite::setTexture(IDtype textureID, const IntRect& rect) { 53 | SDL_Texture* textureObj = getOwner()->CONTEXT->resources->getTexture(textureID); 54 | if(textureObj == nullptr) 55 | throw std::invalid_argument("Invalid. Non-existent texture ID given,"); 56 | m_textureID = textureID; 57 | 58 | m_textureRect = rect; 59 | } 60 | 61 | void Sprite::setTextureRect(const fl::IntRect& rect) { 62 | m_textureRect = rect; 63 | } 64 | 65 | bool Sprite::hasTexture() const { 66 | return m_textureID > 0; 67 | } 68 | 69 | fl::IntRect Sprite::getTextureRect() const { 70 | return m_textureRect; 71 | } 72 | 73 | fl::FloatRect Sprite::getGlobalBounds() const { 74 | Vector2f scale = m_transform->getScale(); 75 | Vector2f origin = m_transform->getOrigin(); 76 | Vector2f scaledOrigin{ 77 | origin.x * scale.x, 78 | origin.y * scale.y 79 | }; 80 | 81 | return FloatRect( 82 | { 83 | m_transform->getPosition() - scaledOrigin 84 | }, 85 | { 86 | static_cast(m_textureRect.w * scale.x), 87 | static_cast(m_textureRect.h * scale.y) 88 | } 89 | ); 90 | } 91 | 92 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Components/Sprite.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "Feather/Components/Drawable.h" 7 | #include "Feather/Components/Transform.h" 8 | #include "Feather/Utilities/Rect.h" 9 | #include "Feather/Utilities/Types.h" 10 | 11 | namespace fl { 12 | 13 | class Sprite : public fl::Drawable { 14 | public: 15 | Sprite(fl::Entity* owner, unsigned drawLayer = 0, unsigned sortOrder = 0); 16 | 17 | virtual void awake(); 18 | 19 | virtual void draw(fl::Window& window); 20 | 21 | unsigned loadTextureFromFile(const std::string& path); 22 | 23 | void setTexture(IDtype textureID); 24 | void setTexture(IDtype textureID, const IntRect& rect); 25 | void setTextureRect(const fl::IntRect& rect); 26 | fl::IntRect getTextureRect() const; 27 | 28 | bool hasTexture() const; 29 | /** 30 | * getGlobalBounds() 31 | * @brief get the bounding rectangle of the entity in relation to the global coordinates after taking into account transformations. 32 | * @return global bounding rectangle of the entity. 33 | * */ 34 | virtual FloatRect getGlobalBounds() const; 35 | private: 36 | unsigned m_textureID; 37 | 38 | IntRect m_textureRect; 39 | std::shared_ptr m_transform; 40 | }; // class Sprite 41 | 42 | }; // namespace fl -------------------------------------------------------------------------------- /include/Feather/Components/Transform.cpp: -------------------------------------------------------------------------------- 1 | #include "Feather/Components/Transform.h" 2 | #include "Feather/Entities/Entity.h" 3 | 4 | namespace fl { 5 | 6 | Transform::Transform(fl::Entity* owner) 7 | : fl::Component(owner) 8 | { 9 | 10 | } 11 | 12 | Transform& Transform::translate(float x, float y){ 13 | m_position.x += x; 14 | m_position.y += y; 15 | return *this; 16 | } 17 | 18 | Transform& Transform::translate(Vector2f direction){ 19 | m_position += direction; 20 | return *this; 21 | } 22 | 23 | Transform& Transform::scale(float x, float y){ 24 | m_scale.x *= x; 25 | m_scale.y *= y; 26 | return *this; 27 | } 28 | 29 | Transform& Transform::scale(Vector2f factor){ 30 | m_scale.x *= factor.x; 31 | m_scale.y *= factor.y; 32 | return *this; 33 | } 34 | 35 | Transform& Transform::setPosition(const Vector2f& position) { 36 | m_position = position; 37 | return *this; 38 | } 39 | 40 | Transform& Transform::setOrigin(const Vector2f& origin) { 41 | m_origin = origin; 42 | return *this; 43 | } 44 | 45 | Transform& Transform::setScale(const Vector2f& magnitude) { 46 | m_scale = magnitude; 47 | return *this; 48 | } 49 | 50 | Transform& Transform::setRotation(double angle) { 51 | m_angle = angle; 52 | return *this; 53 | } 54 | 55 | const Vector2f& Transform::getPosition() const{ 56 | return m_position; 57 | } 58 | const Vector2f& Transform::getScale() const{ 59 | return m_scale; 60 | } 61 | const Vector2f& Transform::getOrigin() const{ 62 | return m_origin; 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /include/Feather/Components/Transform.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Feather/Components/Component.h" 4 | #include "Feather/Utilities/Vector2.h" 5 | 6 | namespace fl { 7 | 8 | class Transform : public fl::Component 9 | { 10 | public: 11 | Transform(fl::Entity* owner); 12 | 13 | Transform& translate(float x, float y); 14 | Transform& translate(Vector2f direction); 15 | 16 | Transform& scale(float x, float y); 17 | Transform& scale(Vector2f factor); 18 | 19 | Transform& setPosition(const Vector2f& position); 20 | Transform& setOrigin(const Vector2f& origin); 21 | Transform& setScale(const Vector2f& magnitude); 22 | Transform& setRotation(double angle); 23 | 24 | const Vector2f& getPosition() const; 25 | const Vector2f& getScale() const; 26 | const Vector2f& getOrigin() const; 27 | private: 28 | Vector2f m_position{0,0}; 29 | Vector2f m_scale{1,1}; 30 | Vector2f m_origin{0,0}; 31 | double m_angle{}; 32 | }; // class Transform 33 | 34 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Components/Velocity.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace fl { 5 | 6 | Velocity::Velocity(Entity* owner) : 7 | Component(owner) 8 | { 9 | 10 | } 11 | 12 | void Velocity::awake() { 13 | auto transform = m_owner->getComponent(); 14 | if (transform == nullptr) { 15 | throw std::logic_error("Velocity Component requires a Transform component"); 16 | } 17 | } 18 | 19 | void Velocity::set(const Vector2f& vel) 20 | { 21 | m_velocity = vel; 22 | clampVelocity(); 23 | } 24 | 25 | void Velocity::set(float x, float y) 26 | { 27 | m_velocity.x = x; 28 | m_velocity.y = y; 29 | clampVelocity(); 30 | } 31 | 32 | void Velocity::setX(float x) 33 | { 34 | m_velocity.x = x; 35 | clampVelocity(); 36 | } 37 | 38 | void Velocity::setY(float y) 39 | { 40 | m_velocity.y = y; 41 | clampVelocity(); 42 | } 43 | 44 | const Vector2f& Velocity::get() const 45 | { 46 | return m_velocity; 47 | } 48 | 49 | void Velocity::clampVelocity() 50 | { 51 | if (fabs(m_velocity.x) > m_maxVelocity.x) 52 | { 53 | if(m_velocity.x > 0) 54 | { 55 | m_velocity.x = m_maxVelocity.x; 56 | } 57 | else 58 | { 59 | m_velocity.x = -m_maxVelocity.x; 60 | } 61 | } 62 | 63 | if (fabs(m_velocity.y) > m_maxVelocity.y) 64 | { 65 | if (m_velocity.y > 0.f) 66 | { 67 | m_velocity.y = m_maxVelocity.y; 68 | } 69 | else 70 | { 71 | m_velocity.y = - m_maxVelocity.y; 72 | } 73 | } 74 | } 75 | 76 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Components/Velocity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace fl { 9 | 10 | class Velocity : public Component { 11 | public: 12 | Velocity(Entity* entity); 13 | 14 | virtual void awake() override; 15 | 16 | void set(const Vector2f& vel); 17 | void set(float x, float y); 18 | void setX(float x); 19 | void setY(float y); 20 | const Vector2f& get() const; 21 | 22 | private: 23 | void clampVelocity(); 24 | 25 | Vector2f m_velocity{0.f, 0.f}; 26 | Vector2f m_maxVelocity{1000.f, 1000.f}; 27 | }; // class Velocity 28 | 29 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Debug/Debug.cpp: -------------------------------------------------------------------------------- 1 | #include "Feather/Debug/Debug.h" 2 | 3 | 4 | namespace fl { 5 | #ifdef LOG_TO_FILE 6 | stream log("Log.txt"); 7 | #else 8 | stream log = std::clog; 9 | #endif 10 | } 11 | -------------------------------------------------------------------------------- /include/Feather/Debug/Debug.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef LOG_TO_FILE 4 | #include 5 | using stream = std::ofstream; 6 | #else 7 | #include 8 | using stream = std::ostream&; 9 | #endif 10 | 11 | namespace fl { 12 | 13 | extern stream log; 14 | 15 | } // namespace fl 16 | -------------------------------------------------------------------------------- /include/Feather/Entities/Entity.cpp: -------------------------------------------------------------------------------- 1 | #include "Entity.h" 2 | 3 | fl::IDtype fl::Entity::count = 0; 4 | 5 | namespace fl { 6 | 7 | Entity::Entity(fl::SharedContext* context) 8 | : ID(fl::Entity::count++), 9 | CONTEXT(context) 10 | { 11 | 12 | } 13 | 14 | void Entity::awake() { 15 | for (const auto& component: m_components) { 16 | component->awake(); 17 | } 18 | } 19 | 20 | bool Entity::isStatic() const { 21 | return m_static; 22 | } 23 | 24 | void Entity::setStatic(bool isStatic) { 25 | m_static = isStatic; 26 | } 27 | 28 | bool Entity::isQueuedForRemoval() const { 29 | return m_queuedForRemoval; 30 | } 31 | 32 | void Entity::queueForRemoval(bool remove) { 33 | m_queuedForRemoval = remove; 34 | } 35 | 36 | std::shared_ptr Entity::getDrawable() const { 37 | return m_drawable; 38 | } 39 | 40 | std::string Entity::addLabel(std::string label) { 41 | m_labels.push_back(label); 42 | return label; 43 | } 44 | 45 | bool Entity::hasLabel(std::string label) { 46 | for(auto l : m_labels) { 47 | if(l == label) { 48 | return true; 49 | } 50 | } 51 | return false; 52 | } 53 | 54 | } // namespace fl 55 | -------------------------------------------------------------------------------- /include/Feather/Entities/Entity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace fl { 11 | 12 | class Entity { 13 | public: // ATTRIBUTES 14 | static IDtype count; 15 | const IDtype ID; 16 | 17 | const fl::SharedContext* CONTEXT; 18 | public: // METHODS & CONSTRUCTORS 19 | Entity(fl::SharedContext* context); 20 | 21 | /** 22 | * awake() 23 | * Use to ensure that all components are present and all attributes are initialized. 24 | */ 25 | virtual void awake(); 26 | 27 | bool isStatic() const; 28 | void setStatic(bool isStatic); 29 | 30 | bool isQueuedForRemoval() const; 31 | void queueForRemoval(bool remove = true); 32 | 33 | /** 34 | * addComponent() 35 | * - Creates a Component of Type T and stores it into this entity's Component array. T must be a subclass of fl::Component. Returns a shared_ptr of the created Component. 36 | */ 37 | template 38 | std::shared_ptr addComponent(); 39 | 40 | 41 | /** 42 | * getComponent() 43 | * - Searches the Component array for an object of type T and return a smart_ptr to it. Returns nullptr if none exist. 44 | */ 45 | template 46 | std::shared_ptr getComponent(); 47 | 48 | std::shared_ptr getDrawable() const; 49 | 50 | /* Labelling an entity */ 51 | std::string addLabel(std::string label); 52 | 53 | bool hasLabel(std::string label); 54 | 55 | 56 | private: // ATTRIBUTES 57 | 58 | /* Boolean attribute to signal the systems if this entity is subject for destruction. */ 59 | bool m_queuedForRemoval = false; 60 | bool m_static = false; 61 | // TODO: Pointer to Game Context here. 62 | 63 | std::vector> m_components; 64 | 65 | std::shared_ptr m_drawable = nullptr; 66 | 67 | std::vector m_labels; 68 | 69 | }; // class Entity 70 | 71 | template 72 | std::shared_ptr Entity::addComponent() { 73 | // Prevents this method from continuing if T is not a derivation of fl::Component 74 | static_assert(std::is_base_of::value, "Error. T must be a derived type of fl::Component. Assertion returned false"); 75 | 76 | // Checks m_components for any type T object stored. Returns it if it does. 77 | std::shared_ptr existingComponent = this->getComponent(); 78 | if(existingComponent != nullptr) 79 | return existingComponent; 80 | 81 | // T does not exist. Create one and store it into memory. 82 | std::shared_ptr newComponent = std::make_shared(this); 83 | m_components.push_back(newComponent); 84 | 85 | // Checks if the object is also a drawable. 86 | if(std::dynamic_pointer_cast(newComponent)) { 87 | m_drawable = std::dynamic_pointer_cast(newComponent); 88 | } 89 | 90 | return newComponent; 91 | } 92 | 93 | template 94 | std::shared_ptr Entity::getComponent() { 95 | for (auto& existingComponent : m_components) 96 | { 97 | if (std::dynamic_pointer_cast(existingComponent)) 98 | { 99 | return std::dynamic_pointer_cast(existingComponent); 100 | } 101 | } 102 | 103 | return nullptr; 104 | } 105 | 106 | 107 | } // namespace fl 108 | -------------------------------------------------------------------------------- /include/Feather/Entities/SharedContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace fl { 8 | 9 | class EntityManager; 10 | 11 | struct SharedContext { 12 | fl::EntityManager* entities; 13 | fl::ResourceManager* resources; 14 | fl::Window* window; 15 | fl::InputManager* inputs; 16 | }; // struct SharedContext 17 | 18 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Game.cpp: -------------------------------------------------------------------------------- 1 | #include "Feather/Game.h" 2 | #include 3 | 4 | namespace fl { 5 | 6 | Game::Game(const std::string& name) : 7 | win(name), 8 | rs(NULL) 9 | { 10 | if(SDL_Init(SDL_INIT_EVERYTHING) < 0) { 11 | std::cout << "SDL cannot be initialized. Got Error: " << SDL_GetError() << std::endl; 12 | return; 13 | } 14 | int imgFlags = IMG_INIT_PNG | IMG_INIT_JPG; 15 | if(!(IMG_Init(imgFlags) & imgFlags)) { 16 | std::cout << "SDL_image cannot be initialized. Caught Error: " << IMG_GetError() << std::endl; 17 | return; 18 | } 19 | if(TTF_Init() < 0) { 20 | std::cout << "SDL_ttf cannot be initialized. Caught Error: " << TTF_GetError() << std::endl; 21 | return; 22 | } 23 | if(Mix_Init(MIX_INIT_MP3) < 0) { 24 | std::cout << "SDL_mixer cannot be initialised. Caught error: " << Mix_GetError() << std::endl; 25 | return; 26 | } 27 | 28 | std::cout << "SDL initialized successfully." << std::endl; 29 | //open audio, temporary solution until proper audio system is created 30 | Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 2048); 31 | 32 | // actually start the window. 33 | win.init(); 34 | rs.setRenderer(win.getRenderer()); 35 | 36 | context.entities = &em; 37 | context.resources = &rs; 38 | context.window = &win; 39 | context.inputs = &im; 40 | } 41 | 42 | void Game::loop() { 43 | const float countPerSecond = SDL_GetPerformanceFrequency(); 44 | const float timePerFrame = countPerSecond / m_fps; 45 | 46 | std::uint64_t NOW = SDL_GetPerformanceCounter(); 47 | std::uint64_t PREV = 0; 48 | std::uint64_t elapsedTime = 0; 49 | 50 | do { 51 | PREV = NOW; 52 | NOW = SDL_GetPerformanceCounter(); 53 | elapsedTime = NOW - PREV; 54 | while(elapsedTime < timePerFrame) { 55 | NOW = SDL_GetPerformanceCounter(); 56 | elapsedTime = NOW - PREV; 57 | } 58 | float deltaTime = elapsedTime / static_cast(countPerSecond); 59 | 60 | this->handleEvents(); 61 | if(win.isOpen()) { 62 | this->update(deltaTime); 63 | this->postUpdate(deltaTime); 64 | this->draw(); 65 | } 66 | 67 | } while(win.isOpen()); 68 | } 69 | 70 | void Game::handleEvents() { 71 | SDL_PumpEvents(); 72 | win.handleEvents(); 73 | im.handleEvents(); 74 | } 75 | 76 | 77 | void Game::update(float deltaTime) { 78 | em.update(deltaTime); 79 | } 80 | 81 | void Game::postUpdate(float deltaTime) { 82 | em.postUpdate(deltaTime); 83 | } 84 | 85 | void Game::draw() { 86 | win.clear(m_clearColor); 87 | em.draw(win); 88 | win.display(); 89 | } 90 | 91 | void Game::quit() { 92 | Mix_Quit(); 93 | TTF_Quit(); 94 | IMG_Quit(); 95 | SDL_Quit(); 96 | } 97 | 98 | void Game::changeClearColor(fl::Color c) { 99 | m_clearColor = c; 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /include/Feather/Game.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "Feather/Windows/Window.h" 9 | #include "Feather/Systems/EntityManager.h" 10 | #include "Feather/ResourceManager.h" 11 | #include "Feather/Entities/SharedContext.h" 12 | #include "Feather/Utilities/Color.h" 13 | 14 | namespace fl { 15 | 16 | class Game { 17 | public: 18 | Game(const std::string& name); 19 | 20 | void loop(); 21 | 22 | void setFrameRateLimit(float fps); 23 | void changeClearColor(fl::Color c); 24 | void quit(); 25 | protected: 26 | void handleEvents(); 27 | void update(float deltaTime); 28 | void postUpdate(float deltaTime); 29 | void draw(); 30 | 31 | public: 32 | fl::Window win; 33 | fl::EntityManager em; 34 | fl::ResourceManager rs; 35 | fl::InputManager im; 36 | 37 | fl::SharedContext context; 38 | 39 | 40 | 41 | private: 42 | float m_fps{60.f}; 43 | fl::Color m_clearColor = fl::Color::Cyan; 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /include/Feather/ResourceManager.cpp: -------------------------------------------------------------------------------- 1 | #include "Feather/ResourceManager.h" 2 | #include 3 | #include 4 | 5 | namespace fl { 6 | ResourceManager::ResourceManager(SDL_Renderer* rend) 7 | : renderer(rend) 8 | { 9 | 10 | } 11 | 12 | void ResourceManager::setRenderer(SDL_Renderer* rend) { 13 | renderer = rend; 14 | } 15 | 16 | unsigned int ResourceManager::loadTexture(const std::string& path) { 17 | SDL_Texture* newTexture = NULL; 18 | SDL_Surface* loadedSurface = IMG_Load(path.c_str()); 19 | if (loadedSurface == NULL) { 20 | throw std::invalid_argument(IMG_GetError()); 21 | } 22 | 23 | newTexture = SDL_CreateTextureFromSurface(renderer, loadedSurface); 24 | if (newTexture == NULL) { 25 | throw std::runtime_error(SDL_GetError()); 26 | } 27 | SDL_FreeSurface(loadedSurface); 28 | unsigned int id = ++textureCount; 29 | texturesMap.insert_or_assign(id, newTexture); 30 | 31 | return id; 32 | } 33 | 34 | unsigned int ResourceManager::loadFont(const std::string& path, int fontSize) { 35 | TTF_Font* newFont = TTF_OpenFont(path.c_str(), fontSize); 36 | if (newFont == NULL) { 37 | throw std::invalid_argument(TTF_GetError()); 38 | } 39 | 40 | unsigned int id = ++fontCount; 41 | fontsMap.insert_or_assign(id, newFont); 42 | 43 | return id; 44 | } 45 | 46 | unsigned int ResourceManager::loadSound(const std::string &path) { 47 | Mix_Chunk* newSound = Mix_LoadWAV(path.c_str()); 48 | 49 | if (NULL == newSound) { 50 | throw std::invalid_argument(Mix_GetError()); 51 | } 52 | 53 | unsigned int id = ++soundCount; 54 | soundsMap.insert_or_assign(id, newSound); 55 | 56 | return id; 57 | } 58 | 59 | SDL_Texture* ResourceManager::getTexture(unsigned int id) const { 60 | if (texturesMap.contains(id)) 61 | return texturesMap.at(id); 62 | return nullptr; 63 | } 64 | 65 | TTF_Font* ResourceManager::getFont(unsigned int id) const { 66 | if (fontsMap.contains(id)) 67 | return fontsMap.at(id); 68 | return nullptr; 69 | } 70 | 71 | Mix_Chunk* ResourceManager::getSound(unsigned int id) const { 72 | if (soundsMap.contains(id)) 73 | return soundsMap.at(id); 74 | return nullptr; 75 | } 76 | 77 | } // namespace fl 78 | -------------------------------------------------------------------------------- /include/Feather/ResourceManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace fl { 11 | 12 | class ResourceManager { 13 | public: // Methods and Constructors 14 | ResourceManager() = delete; 15 | ResourceManager(SDL_Renderer* rend); 16 | 17 | /** 18 | * loadTexture() 19 | * - Creates an SDL_Texture* object from path and stores it into memory. 20 | * Returns the id of the loaded SDL_Texture for future access. 21 | */ 22 | unsigned int loadTexture(const std::string& path); 23 | /** 24 | * loadFont() 25 | * - Creates a TTF_Font* object from path and stores it into memory. 26 | * Returns the id of the loaded TTF_Font for future access. 27 | */ 28 | unsigned int loadFont(const std::string& path, int fontSize); 29 | /** 30 | * loadSound() 31 | * - Creates a Mix_Chunk* from a path and stores it in memory. 32 | * Returns the id of the loaded Mix_Chunk for future access 33 | */ 34 | unsigned int loadSound(const std::string& path); 35 | 36 | /** 37 | * getTexture() 38 | * - Returns a pointer to SDL_Texture referred to by given id. Returns NULL for invalid id. 39 | */ 40 | SDL_Texture* getTexture(unsigned int id) const; 41 | /** 42 | * getFont() 43 | * - Returns a pointer to TTF_Font referred to by given id. Returns NULL for invalid id. 44 | */ 45 | TTF_Font* getFont(unsigned int id) const; 46 | /** 47 | * getSound() 48 | * - Returns a pointer to Mix_Chunk referred to by given id. Returns NULL for invalid id. 49 | */ 50 | Mix_Chunk* getSound(unsigned int id) const; 51 | 52 | 53 | void setRenderer(SDL_Renderer* rend); 54 | 55 | private: 56 | std::unordered_map texturesMap; 57 | unsigned int textureCount = 0; 58 | std::unordered_map fontsMap; 59 | unsigned int fontCount = 0; 60 | std::unordered_map soundsMap; 61 | unsigned int soundCount = 0; 62 | 63 | 64 | SDL_Renderer* renderer; 65 | }; // class ResourceManager 66 | 67 | } // namespace fl 68 | -------------------------------------------------------------------------------- /include/Feather/Systems/AnimationSystem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | namespace fl { 6 | 7 | AnimationSystem::AnimationSystem(EntityManager* entityManager) : 8 | ComponentSystem(entityManager) 9 | { 10 | 11 | } 12 | 13 | void AnimationSystem::postUpdate(float deltaTime) { 14 | for(IDtype ID : m_entityIDs) { 15 | auto ac = m_entities->at(ID)->getComponent(); 16 | 17 | ac->updateFrame(deltaTime); 18 | 19 | } 20 | } 21 | 22 | void AnimationSystem::addEntity(std::shared_ptr& entity) { 23 | auto a = entity->getComponent(); 24 | 25 | if (a != nullptr) { 26 | m_entityIDs.insert(entity->ID); 27 | } 28 | } 29 | 30 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Systems/AnimationSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace fl { 7 | 8 | class AnimationSystem : public ComponentSystem { 9 | public: 10 | AnimationSystem(EntityManager* entityManager); 11 | 12 | virtual void postUpdate(float deltaTime) override; 13 | 14 | virtual void addEntity(std::shared_ptr& entity) override; 15 | private: 16 | 17 | }; // class AnimationSystem 18 | 19 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Systems/CollisionSystem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace fl { 5 | 6 | CollisionSystem::CollisionSystem(EntityManager* entityManager) : 7 | ComponentSystem(entityManager) 8 | { 9 | 10 | } 11 | 12 | void CollisionSystem::update(float deltaTime) { 13 | for(const unsigned& ID : m_entityIDs) { 14 | auto e = m_entities->at(ID); 15 | auto c = e->getComponent(); 16 | for(const unsigned& ID2 : m_entityIDs) { 17 | if(ID2 == e->ID) continue; 18 | auto e2 = m_entities->at(ID2); 19 | auto c2 = e2->getComponent(); 20 | if(SDL_HasIntersection(&c->getHitbox(), &c2->getHitbox())) { 21 | c->setColliding(true); 22 | c2->setColliding(true); 23 | c->addCollision(e2.get()); 24 | c2->addCollision(e.get()); 25 | } 26 | } 27 | } 28 | } 29 | 30 | void CollisionSystem::postUpdate(float deltaTime) { 31 | for(const unsigned& ID : m_entityIDs) { 32 | auto c = m_entities->at(ID)->getComponent(); 33 | if(c->isColliding()) { 34 | for(const unsigned& ID2 : m_entityIDs) { 35 | if(ID2 == ID) continue; 36 | auto e2 = m_entities->at(ID2); 37 | auto c2 = e2->getComponent(); 38 | if(SDL_HasIntersection(&c->getHitbox(), &c2->getHitbox())) { 39 | continue; 40 | } 41 | else { 42 | c->setColliding(false); 43 | c->clearCollisions(); 44 | } 45 | } 46 | } 47 | } 48 | 49 | } 50 | 51 | void CollisionSystem::addEntity(std::shared_ptr& entity) { 52 | auto collider = entity->getComponent(); 53 | if(collider != nullptr) { 54 | this->m_entityIDs.insert(entity->ID); 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /include/Feather/Systems/CollisionSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace fl { 7 | 8 | class CollisionSystem : public ComponentSystem { 9 | public: 10 | CollisionSystem(EntityManager* entityManager); 11 | 12 | virtual void update(float deltaTime); 13 | virtual void postUpdate(float deltaTime); 14 | 15 | virtual void addEntity(std::shared_ptr& entity); 16 | 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /include/Feather/Systems/ComponentSystem.cpp: -------------------------------------------------------------------------------- 1 | #include "Feather/Systems/ComponentSystem.h" 2 | 3 | namespace fl { 4 | 5 | ComponentSystem::ComponentSystem(fl::EntityManager* entityManager) 6 | : m_entities(entityManager) 7 | { 8 | 9 | } 10 | 11 | void ComponentSystem::update(float) { 12 | 13 | } 14 | 15 | void ComponentSystem::postUpdate(float) { 16 | 17 | } 18 | 19 | void ComponentSystem::remove(unsigned entityID) { 20 | m_entityIDs.extract(entityID); 21 | } 22 | 23 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Systems/ComponentSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace fl { 7 | 8 | // Forward Declaration 9 | class EntityManager; 10 | class Entity; 11 | 12 | class ComponentSystem { 13 | public: 14 | ComponentSystem(fl::EntityManager* entityManager); 15 | 16 | virtual void update(float deltaTime); 17 | virtual void postUpdate(float deltaTime); 18 | 19 | virtual void addEntity(std::shared_ptr& entity) = 0; 20 | virtual void remove(unsigned entityID); 21 | 22 | protected: 23 | std::set m_entityIDs; 24 | 25 | // Where the actual entities are stored. 26 | fl::EntityManager* m_entities; 27 | 28 | }; // class ComponentSystem 29 | 30 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Systems/EntityManager.cpp: -------------------------------------------------------------------------------- 1 | #include "Feather/Systems/EntityManager.h" 2 | 3 | namespace fl { 4 | 5 | EntityManager::EntityManager() : 6 | m_drawables(this) 7 | { 8 | 9 | } 10 | 11 | EntityManager::~EntityManager() { 12 | m_entities.clear(); 13 | m_newEntities.clear(); 14 | } 15 | 16 | void EntityManager::add(std::vector>& newEntities) { 17 | m_newEntities.insert(m_newEntities.end(), newEntities.begin(), newEntities.end()); 18 | } 19 | 20 | void EntityManager::add(std::shared_ptr entity) { 21 | m_newEntities.push_back(entity); 22 | } 23 | 24 | void EntityManager::update(float deltaTime) { 25 | processNewObjects(); 26 | for (auto& system : m_componentSystems) { 27 | system->update(deltaTime); 28 | } 29 | } 30 | 31 | void EntityManager::postUpdate(float deltaTime) { 32 | for (auto& system : m_componentSystems) { 33 | system->postUpdate(deltaTime); 34 | } 35 | processRemovals(); 36 | } 37 | 38 | void EntityManager::draw(fl::Window& window) { 39 | m_drawables.draw(window); 40 | } 41 | 42 | void EntityManager::processNewObjects() { 43 | if (m_newEntities.size() <= 0) { 44 | // No new objects. terminate function. 45 | return; 46 | } 47 | 48 | for (auto& e: m_newEntities) { 49 | e->awake(); 50 | 51 | const unsigned ID = e->ID; 52 | m_entities.insert_or_assign(ID, e); 53 | 54 | m_drawables.add(e); 55 | 56 | for (auto& system: m_componentSystems) { 57 | system->addEntity(e); 58 | } 59 | } 60 | 61 | m_newEntities.clear(); 62 | } 63 | 64 | void EntityManager::processRemovals() { 65 | auto iter = m_entities.begin(); 66 | while(iter != m_entities.end()) { 67 | if(iter->second->isQueuedForRemoval()) { 68 | m_drawables.remove(iter->first); 69 | for(auto& componentSystem : m_componentSystems) { 70 | componentSystem->remove(iter->first); 71 | } 72 | 73 | iter = m_entities.erase(iter); 74 | } 75 | else { 76 | ++iter; 77 | } 78 | } 79 | } 80 | 81 | std::shared_ptr& EntityManager::operator[](unsigned entityID) { 82 | return m_entities.at(entityID); 83 | } 84 | 85 | std::shared_ptr& EntityManager::at(unsigned entityID) { 86 | return m_entities.at(entityID); 87 | } 88 | 89 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Systems/EntityManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace fl { 13 | 14 | class EntityManager { 15 | public: // METHODS 16 | EntityManager(); 17 | ~EntityManager(); 18 | 19 | void add(std::vector> &otherEntities); 20 | void add(std::shared_ptr entity); 21 | 22 | template 23 | void includeSystem(); 24 | 25 | void update(float deltaTime); 26 | void postUpdate(float deltaTime); 27 | 28 | void draw(fl::Window& window); 29 | 30 | void processNewObjects(); 31 | 32 | void processRemovals(); 33 | 34 | std::shared_ptr& operator[](unsigned entityID); 35 | std::shared_ptr& at(unsigned entityID); 36 | 37 | private: 38 | std::map> m_entities; 39 | std::vector> m_newEntities; 40 | 41 | RenderSystem m_drawables; 42 | 43 | std::vector> m_componentSystems; 44 | }; // class EntityManager 45 | 46 | 47 | template 48 | void EntityManager::includeSystem() { 49 | static_assert(std::is_base_of::value, "Error. EntityManager::includeSystem(). T must be a derived type of fl::ComponentSystem. Assertion returned false."); 50 | 51 | for (auto& existingSystem : m_componentSystems) { 52 | if (std::dynamic_pointer_cast(existingSystem)) { 53 | return; 54 | } 55 | } 56 | 57 | std::shared_ptr newComponentSystem = std::make_shared(this); 58 | m_componentSystems.push_back(newComponentSystem); 59 | } 60 | 61 | 62 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Systems/InputManager.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace fl { 4 | 5 | void InputManager::handleEvents() { 6 | m_prevKeys = m_currKeys; 7 | m_currKeys.reset(); 8 | 9 | int numkeys = 0; 10 | const std::uint8_t* keys = SDL_GetKeyboardState(&numkeys); 11 | 12 | for(int i = 0; i < numkeys; ++i) { 13 | if(keys[i] != 0) { 14 | m_currKeys.set(i); 15 | } 16 | } 17 | 18 | SDL_Event e; 19 | while(SDL_PollEvent(&e)) { 20 | // switch(e.type) { 21 | // case SDL_KEYDOWN: 22 | // SDL_Scancode code = SDL_GetScancodeFromKey(e.key.keysym.sym); 23 | // m_currKeys.set(code); 24 | // break; 25 | // } 26 | } 27 | } 28 | 29 | bool InputManager::isKeyUp(SDL_Keycode key) { 30 | SDL_Scancode code = SDL_GetScancodeFromKey(key); 31 | return m_prevKeys[code] && !m_currKeys[code]; 32 | } 33 | 34 | bool InputManager::isKeyDown(SDL_Keycode key) { 35 | SDL_Scancode code = SDL_GetScancodeFromKey(key); 36 | return !m_prevKeys[code] && m_currKeys[code]; 37 | } 38 | 39 | bool InputManager::isKeyActive(SDL_Keycode key) { 40 | SDL_Scancode code = SDL_GetScancodeFromKey(key); 41 | return m_currKeys[code]; 42 | } 43 | 44 | Vector2i InputManager::getMousePos() const { 45 | Vector2i res; 46 | SDL_GetMouseState(&res.x, &res.y); 47 | 48 | return res; 49 | } 50 | 51 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Systems/InputManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace fl { 9 | 10 | class InputManager { 11 | public: 12 | void handleEvents(); 13 | 14 | bool isKeyUp(SDL_Keycode key); 15 | bool isKeyDown(SDL_Keycode key); 16 | bool isKeyActive(SDL_Keycode key); 17 | 18 | Vector2i getMousePos() const; 19 | private: 20 | std::bitset<256> m_prevKeys; 21 | std::bitset<256> m_currKeys; 22 | 23 | }; // class InputManager 24 | 25 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Systems/KeyboardControlSystem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace fl { 5 | 6 | KeyboardControlSystem::KeyboardControlSystem(EntityManager* entities) : 7 | ComponentSystem(entities) 8 | { 9 | 10 | } 11 | 12 | void KeyboardControlSystem::update(float) { 13 | for(unsigned ID : m_entityIDs) { 14 | auto& e = m_entities->at(ID); 15 | 16 | auto kcs = e->getComponent(); 17 | auto& keyPressedBindings = kcs->getBindingsOnKeyPressed(); 18 | for(auto& [key, actions] : keyPressedBindings) { 19 | if(e->CONTEXT->inputs->isKeyDown(key)) { 20 | for(auto& action: actions) { 21 | action(); 22 | } 23 | } 24 | } 25 | auto& keyReleasedBindings = kcs->getBindingsOnKeyReleased(); 26 | for(auto& [key, actions] : keyReleasedBindings) { 27 | if(e->CONTEXT->inputs->isKeyUp(key)) { 28 | for(auto& action: actions) { 29 | action(); 30 | } 31 | } 32 | } 33 | auto& keyHeldBindings = kcs->getBindingsOnKeyHeld(); 34 | for(auto& [key, actions] : keyHeldBindings) { 35 | if(e->CONTEXT->inputs->isKeyActive(key)) { 36 | for(auto& action: actions) { 37 | action(); 38 | } 39 | } 40 | } 41 | } 42 | } 43 | 44 | void KeyboardControlSystem::addEntity(std::shared_ptr& entity) { 45 | auto keyboardControl = entity->getComponent(); 46 | if (keyboardControl != nullptr) { 47 | m_entityIDs.insert(entity->ID); 48 | } 49 | } 50 | 51 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Systems/KeyboardControlSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace fl { 7 | 8 | class KeyboardControlSystem : public ComponentSystem { 9 | public: 10 | KeyboardControlSystem(EntityManager* entityManager); 11 | 12 | virtual void update(float deltaTime); 13 | 14 | virtual void addEntity(std::shared_ptr& entity); 15 | 16 | }; // class KeyboardControlSystem 17 | 18 | } // namespace fl 19 | -------------------------------------------------------------------------------- /include/Feather/Systems/MovementSystem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace fl { 5 | 6 | MovementSystem::MovementSystem(EntityManager* entityManager) : 7 | ComponentSystem(entityManager) 8 | { 9 | 10 | } 11 | 12 | void MovementSystem::update(float deltaTime) { 13 | for(const unsigned& ID : m_entityIDs) { 14 | auto e = m_entities->at(ID); 15 | auto v = e->getComponent(); 16 | auto t = e->getComponent(); 17 | 18 | Vector2f displacement = v->get() * deltaTime; 19 | t->translate(displacement); 20 | } 21 | } 22 | 23 | void MovementSystem::postUpdate(float deltaTime) { 24 | for(const unsigned& ID : m_entityIDs) { 25 | m_entities->at(ID)->getComponent()->set(0.f, 0.f); 26 | } 27 | 28 | } 29 | 30 | void MovementSystem::addEntity(std::shared_ptr& entity) { 31 | auto velocity = entity->getComponent(); 32 | if(velocity != nullptr) { 33 | this->m_entityIDs.insert(entity->ID); 34 | } 35 | } 36 | 37 | } // namespace fl 38 | -------------------------------------------------------------------------------- /include/Feather/Systems/MovementSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace fl { 7 | 8 | class MovementSystem : public ComponentSystem { 9 | public: 10 | MovementSystem(EntityManager* entityManager); 11 | 12 | virtual void update(float deltaTime); 13 | virtual void postUpdate(float deltaTime); 14 | 15 | virtual void addEntity(std::shared_ptr& entity); 16 | 17 | }; // class MovementSystem 18 | 19 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Systems/RenderSystem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace fl { 5 | 6 | RenderSystem::RenderSystem(EntityManager* entities) : 7 | m_entities(entities) 8 | { 9 | 10 | } 11 | 12 | void RenderSystem::add(std::vector> entities) { 13 | for(auto& e : entities) { 14 | this->add(e); 15 | } 16 | } 17 | 18 | void RenderSystem::add(std::shared_ptr entity) { 19 | auto drawable = entity->getDrawable(); 20 | if (drawable == nullptr) 21 | return; 22 | DrawLayer layer = drawable->getDrawLayer(); 23 | if(m_drawables.contains(layer)) { 24 | m_drawables.at(layer).push_back(entity->ID); 25 | } 26 | else { 27 | m_drawables.insert_or_assign(layer, std::vector{entity->ID}); 28 | } 29 | 30 | } 31 | 32 | void RenderSystem::remove(IDtype entityID) { 33 | for(auto& v: m_drawables) { 34 | std::erase(v.second, entityID); 35 | } 36 | } 37 | 38 | void RenderSystem::update(float) { 39 | sort(); 40 | } 41 | 42 | void RenderSystem::draw(Window& window) { 43 | FloatRect viewSpace = window.getViewSpace(); 44 | 45 | for(auto& v : m_drawables) { 46 | for(auto& id : v.second) { 47 | auto drawable = m_entities->at(id)->getDrawable(); 48 | if(viewSpace.intersects(drawable->getGlobalBounds()).has_value()) { 49 | drawable->draw(window); 50 | } 51 | } 52 | } 53 | } 54 | 55 | void RenderSystem::sort() { 56 | EntityManager* entities = m_entities; 57 | auto layerSort = [entities](IDtype a, IDtype b) -> bool { 58 | return entities->at(a)->getDrawable()->getSortOrder() < entities->at(b)->getDrawable()->getSortOrder(); 59 | }; 60 | 61 | for(auto& layer : m_drawables) { 62 | if(!std::is_sorted(layer.second.begin(), layer.second.end(), layerSort)) { 63 | std::sort(layer.second.begin(), layer.second.end(), layerSort); 64 | } 65 | } 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /include/Feather/Systems/RenderSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | namespace fl { 12 | 13 | class EntityManager; 14 | 15 | using DrawLayer = unsigned; 16 | 17 | class RenderSystem { 18 | public: 19 | RenderSystem(EntityManager* entities); 20 | 21 | void add(std::vector> entities); 22 | void add(std::shared_ptr entity); 23 | 24 | void remove(IDtype entityID); 25 | 26 | void update(float deltaTime); 27 | void draw(Window& window); 28 | 29 | private: 30 | void sort(); 31 | 32 | std::map> m_drawables; 33 | 34 | EntityManager* m_entities; 35 | }; // class RenderSystem 36 | 37 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Utilities/Color.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace fl { 6 | 7 | class Color { 8 | public: // static attributes 9 | static const Color Black; 10 | static const Color White; 11 | static const Color Red; 12 | static const Color Green; 13 | static const Color Blue; 14 | static const Color Yellow; 15 | static const Color Magenta; 16 | static const Color Cyan; 17 | static const Color Transparent; 18 | 19 | public: // attributes 20 | std::uint8_t r{}; 21 | std::uint8_t g{}; 22 | std::uint8_t b{}; 23 | std::uint8_t a{}; 24 | 25 | public: 26 | constexpr Color(); 27 | 28 | constexpr Color(std::uint8_t red, std::uint8_t green, std::uint8_t blue, std::uint8_t alpha = 255); 29 | constexpr Color(std::uint32_t color); 30 | 31 | }; // class Color 32 | 33 | #include "Feather/Utilities/Color.inl" 34 | 35 | } // namespace fl 36 | 37 | 38 | -------------------------------------------------------------------------------- /include/Feather/Utilities/Color.inl: -------------------------------------------------------------------------------- 1 | constexpr Color::Color() = default; 2 | 3 | constexpr Color::Color(std::uint8_t red, std::uint8_t green, std::uint8_t blue, std::uint8_t alpha) 4 | : r(red), 5 | g(green), 6 | b(blue), 7 | a(alpha) 8 | { 9 | 10 | } 11 | 12 | constexpr Color::Color(std::uint32_t color) 13 | : r(static_cast((color & 0xff000000) >> 24)), 14 | g(static_cast((color & 0x00ff0000) >> 16)), 15 | b(static_cast((color & 0x0000ff00) >> 8)), 16 | a(static_cast(color & 0x000000ff)) 17 | { 18 | 19 | } 20 | 21 | constexpr Color Color::Black(0, 0, 0); 22 | constexpr Color Color::White(255, 255, 255); 23 | constexpr Color Color::Red(255, 0, 0); 24 | constexpr Color Color::Green(0, 255, 0); 25 | constexpr Color Color::Blue(0, 0, 255); 26 | constexpr Color Color::Yellow(255, 255, 0); 27 | constexpr Color Color::Magenta(255, 0, 255); 28 | constexpr Color Color::Cyan(0, 255, 255); 29 | constexpr Color Color::Transparent(0, 0, 0, 0); 30 | -------------------------------------------------------------------------------- /include/Feather/Utilities/Rect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace fl { 8 | 9 | template 10 | class Rect { 11 | public: // ATTRIBUTES 12 | T l = T(); // left 13 | T t = T(); // top 14 | T w = T(); // width 15 | T h = T(); // height 16 | 17 | public: // METHODS & CONSTRUCTORS 18 | constexpr Rect(); 19 | constexpr Rect(T left, T top, T width, T height); 20 | constexpr Rect(Vector2 topLeft, Vector2 size); 21 | template 22 | constexpr Rect(const Rect& otherRect); 23 | 24 | template 25 | constexpr Rect& operator=(const Rect& rhs); 26 | 27 | constexpr bool contains(const Vector2& point) const; 28 | constexpr std::optional> intersects(const Rect& rect) const; 29 | 30 | constexpr SDL_Rect toSDL_Rect() const; 31 | }; // class Rect 32 | 33 | 34 | #include "Feather/Utilities/Rect.inl" 35 | 36 | // COMMON TYPEDEFS 37 | using FloatRect = fl::Rect; 38 | using IntRect = fl::Rect; 39 | 40 | }; // namespace fl -------------------------------------------------------------------------------- /include/Feather/Utilities/Rect.inl: -------------------------------------------------------------------------------- 1 | // Helper anonymous functions to avoid including 2 | namespace { 3 | template 4 | constexpr T min(const T& a, const T& b) { 5 | return a < b ? a : b; 6 | } 7 | 8 | template 9 | constexpr T max(const T& a, const T& b) { 10 | return a > b ? a : b; 11 | } 12 | } 13 | 14 | 15 | 16 | template 17 | constexpr Rect::Rect() = default; 18 | 19 | template 20 | constexpr Rect::Rect(T left, T top, T width, T height) : 21 | l(left), 22 | t(top), 23 | w(width), 24 | h(height) 25 | { 26 | 27 | } 28 | 29 | template 30 | constexpr Rect::Rect(Vector2 topLeft, Vector2 size) : 31 | l(topLeft.x), 32 | t(topLeft.y), 33 | w(size.x), 34 | h(size.y) 35 | { 36 | 37 | } 38 | 39 | template 40 | template 41 | constexpr Rect::Rect(const Rect& otherRect) : 42 | l(static_cast(otherRect.l)), 43 | t(static_cast(otherRect.t)), 44 | w(static_cast(otherRect.w)), 45 | h(static_cast(otherRect.h)) 46 | { 47 | 48 | } 49 | 50 | template 51 | template 52 | constexpr Rect& Rect::operator=(const Rect& rhs) { 53 | l = static_cast(rhs.l); 54 | t = static_cast(rhs.t); 55 | w = static_cast(rhs.w); 56 | h = static_cast(rhs.h); 57 | 58 | return *this; 59 | } 60 | 61 | template 62 | constexpr bool Rect::contains(const Vector2& point) const { 63 | const T minX = min(l, static_cast(l + w)); 64 | const T maxX = max(l, static_cast(l + w)); 65 | const T minY = min(t, static_cast(t + h)); 66 | const T maxY = max(t, static_cast(t + h)); 67 | 68 | return (point.x >= minX) && (point.x < maxX) && (point.y >= minY) && (point.y < maxY); 69 | } 70 | 71 | template 72 | constexpr std::optional> Rect::intersects(const Rect& rect) const { 73 | const T r1minX = min(l, static_cast(l + w)); 74 | const T r1maxX = max(l, static_cast(l + w)); 75 | const T r1minY = min(t, static_cast(t + h)); 76 | const T r1maxY = max(t, static_cast(t + h)); 77 | 78 | const T r2minX = min(rect.l, static_cast(rect.l + rect.w)); 79 | const T r2maxX = max(rect.l, static_cast(rect.l + rect.w)); 80 | const T r2minY = min(rect.t, static_cast(rect.t + rect.h)); 81 | const T r2maxY = max(rect.t, static_cast(rect.t + rect.h)); 82 | 83 | const T interLeft = max(r1minX, r2minX); 84 | const T interTop = max(r1minY, r2minY); 85 | const T interRight = min(r1maxX, r2maxX); 86 | const T interBottom = min(r1maxY, r2maxY); 87 | 88 | if (interLeft < interRight && interTop < interBottom) { 89 | return std::make_optional>({ 90 | {interLeft, interTop}, 91 | {interRight - interLeft, interBottom - interTop} 92 | }); 93 | } 94 | else { 95 | return std::nullopt; 96 | } 97 | } 98 | 99 | 100 | template 101 | constexpr SDL_Rect Rect::toSDL_Rect() const { 102 | return SDL_Rect{ 103 | static_cast((l <= (l+w)) ? l : l+w), 104 | static_cast((t <= (t+h)) ? t : t+h), 105 | static_cast((w >= 0) ? w : -w), 106 | static_cast((h >= 0) ? h : -h) 107 | }; 108 | } -------------------------------------------------------------------------------- /include/Feather/Utilities/Types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace fl { 7 | 8 | using int8 = std::int8_t; 9 | using uint8 = std::uint8_t; 10 | using int16 = std::int16_t; 11 | using uint16 = std::uint16_t; 12 | using int32 = std::int32_t; 13 | using uint32 = std::uint32_t; 14 | using int64 = std::int64_t; 15 | using uint64 = std::uint64_t; 16 | 17 | using IDtype = std::size_t; 18 | 19 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Utilities/Vector2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace fl { 6 | 7 | template 8 | class Vector2 { 9 | public: 10 | T x{}; 11 | T y{}; 12 | 13 | public: // Constructors and Methods 14 | constexpr Vector2(T X, T Y); 15 | constexpr Vector2(); 16 | 17 | template 18 | constexpr explicit Vector2(const Vector2& other); 19 | 20 | /** 21 | * Convers this Vector to an SDL_Point type. 22 | */ 23 | constexpr SDL_Point toSDL_Point() const; 24 | }; // class Vector2 25 | 26 | // OPERATORS 27 | template 28 | constexpr Vector2 operator-(const Vector2 &rhs); 29 | 30 | template 31 | constexpr Vector2 &operator+=(Vector2 &lhs, const Vector2 &rhs); 32 | 33 | template 34 | constexpr Vector2 &operator-=(Vector2 &lhs, const Vector2 &rhs); 35 | 36 | template 37 | constexpr Vector2 operator+(const Vector2 &lhs, const Vector2 &rhs); 38 | 39 | template 40 | constexpr Vector2 operator-(const Vector2 &lhs, const Vector2 &rhs); 41 | 42 | template 43 | constexpr Vector2 operator*(const Vector2 &lhs, T rhs); 44 | 45 | template 46 | constexpr Vector2 operator*(T lhs, const Vector2 &rhs); 47 | 48 | template 49 | constexpr Vector2 &operator*=(Vector2 &lhs, T rhs); 50 | 51 | template 52 | constexpr Vector2 operator/(const Vector2 &lhs, T rhs); 53 | 54 | template 55 | constexpr Vector2 &operator/=(Vector2 &lhs, T rhs); 56 | 57 | template 58 | constexpr Vector2 operator==(const Vector2 &lhs, const Vector2 &rhs); 59 | 60 | template 61 | constexpr Vector2 operator!=(const Vector2 &lhs, const Vector2 &rhs); 62 | 63 | /*************************************** 64 | * IMPLEMENTATIONS 65 | ***************************************/ 66 | #include 67 | 68 | using Vector2i = Vector2; 69 | using Vector2f = Vector2; 70 | using Vector2u = Vector2; 71 | using Vector2d = Vector2; 72 | 73 | } // namespace fl -------------------------------------------------------------------------------- /include/Feather/Utilities/Vector2.inl: -------------------------------------------------------------------------------- 1 | template 2 | constexpr Vector2::Vector2() = default; 3 | 4 | template 5 | constexpr Vector2::Vector2(T X, T Y) : 6 | x(X), 7 | y(Y) 8 | { 9 | 10 | } 11 | 12 | template 13 | template 14 | constexpr Vector2::Vector2(const Vector2& other) : 15 | x(static_cast(other.x)), 16 | y(static_cast(other.y)) 17 | { 18 | 19 | } 20 | 21 | template 22 | constexpr SDL_Point Vector2::toSDL_Point() const { 23 | return SDL_Point{ 24 | static_cast(x), 25 | static_cast(y) 26 | }; 27 | } 28 | 29 | /************************************ 30 | * Vector2 OPERATORS 31 | ************************************/ 32 | template 33 | constexpr Vector2 operator-(const Vector2& rhs) { 34 | return Vector2(-rhs.x, -rhs.y); 35 | } 36 | 37 | template 38 | constexpr Vector2& operator+=(Vector2& lhs, const Vector2& rhs) { 39 | lhs.x += rhs.x; 40 | lhs.y += rhs.y; 41 | return lhs; 42 | } 43 | 44 | template 45 | constexpr Vector2& operator-=(Vector2& lhs, const Vector2& rhs) { 46 | lhs.x -= rhs.x; 47 | lhs.y -= rhs.y; 48 | return lhs; 49 | } 50 | 51 | template 52 | constexpr Vector2 operator+(const Vector2& lhs, const Vector2& rhs) { 53 | return Vector2(lhs.x + rhs.x, lhs.y + rhs.y); 54 | } 55 | 56 | template 57 | constexpr Vector2 operator-(const Vector2& lhs, const Vector2& rhs) { 58 | return Vector2(lhs.x - rhs.x, lhs.y - rhs.y); 59 | } 60 | 61 | template 62 | constexpr Vector2 operator*(const Vector2& lhs, T rhs) { 63 | return Vector2(lhs.x * rhs, lhs.y * rhs); 64 | } 65 | 66 | template 67 | constexpr Vector2 operator*(T lhs, const Vector2& rhs) { 68 | return Vector2(rhs.x * lhs, rhs.y * lhs); 69 | } 70 | 71 | template 72 | constexpr Vector2& operator*=(Vector2& lhs, T rhs) { 73 | lhs.x *= rhs; 74 | lhs.y *= rhs; 75 | 76 | return lhs; 77 | } 78 | 79 | template 80 | constexpr Vector2 operator/(const Vector2& lhs, T rhs) { 81 | return Vector2(lhs.x / rhs, lhs.y / rhs); 82 | } 83 | 84 | template 85 | constexpr Vector2 operator/=(Vector2& lhs, T rhs) { 86 | lhs.x /= rhs; 87 | lhs.y /= rhs; 88 | return lhs; 89 | } 90 | 91 | template 92 | bool operator==(const Vector2& lhs, const Vector2& rhs) { 93 | return lhs.x == rhs.x && lhs.y == rhs.y; 94 | } 95 | 96 | template 97 | bool operator!=(const Vector2& lhs, const Vector2& rhs) { 98 | return lhs.x != rhs.x || lhs.y != rhs.y; 99 | } 100 | -------------------------------------------------------------------------------- /include/Feather/Windows/View.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifdef DEBUG_MODE 5 | #include 6 | #endif 7 | 8 | namespace fl { 9 | 10 | View::View() : 11 | View({0.f, 0.f, 1000.f, 1000.f}) 12 | { 13 | } 14 | 15 | View::View(const Vector2f& area, const Vector2f& center) : 16 | m_center(center), 17 | m_area(area) 18 | { 19 | #ifdef DEBUG_MODE 20 | fl::log << "Created a View with Center: " << center.x << ", " << center.y << " ;Area: " << area.x << ", " << area.y << " ;" << "\n"; 21 | #endif 22 | } 23 | 24 | View::View(const FloatRect& rect) : 25 | m_center(rect.l + (rect.w * 0.5f), rect.t + (rect.h * 0.5f)), 26 | m_area(rect.w, rect.h) 27 | { 28 | 29 | #ifdef DEBUG_MODE 30 | fl::log << "Created View: " << static_cast(rect.l) << ", " << static_cast(rect.t) << ", " << rect.w << ", " << rect.h << "\n"; 31 | #endif 32 | } 33 | 34 | const Vector2f& View::getCenter() const { 35 | return m_center; 36 | } 37 | 38 | const Vector2f& View::getArea() const { 39 | return m_area; 40 | } 41 | 42 | const FloatRect& View::getViewport() const { 43 | return m_viewport; 44 | } 45 | 46 | FloatRect View::getViewSpace() const { 47 | return FloatRect({ 48 | m_center - (m_area * 0.5f), 49 | m_area 50 | }); 51 | } 52 | 53 | void View::setCenter(const Vector2f& center) { 54 | m_center = center; 55 | } 56 | 57 | void View::setArea(const Vector2f& area) { 58 | m_area = area; 59 | } 60 | 61 | void View::setViewport(const FloatRect& viewport) { 62 | m_viewport = viewport; 63 | } 64 | 65 | void View::move(const Vector2f& offset) { 66 | m_center += offset; 67 | } 68 | 69 | FloatRect View::mapToView(const FloatRect& rect) { 70 | return FloatRect{ 71 | mapToView({rect.l, rect.t}), 72 | {rect.w, rect.h} 73 | }; 74 | } 75 | 76 | Vector2f View::mapToView(const Vector2f& coord) { 77 | Vector2f screenTL = m_center - (m_area * 0.5f); 78 | 79 | return Vector2f{coord - screenTL}; 80 | } 81 | 82 | } // namespace fl 83 | -------------------------------------------------------------------------------- /include/Feather/Windows/View.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace fl { 7 | 8 | class View { 9 | public: 10 | View(); 11 | View(const Vector2f& area, const Vector2f& center); 12 | View(const FloatRect& rectangle); 13 | 14 | const Vector2f& getCenter() const; 15 | const Vector2f& getArea() const; 16 | const FloatRect& getViewport() const; 17 | // const Angle& getRotation() const; 18 | 19 | FloatRect getViewSpace() const; 20 | 21 | void setCenter(const Vector2f& center); 22 | void setArea(const Vector2f& area); 23 | // void setRotation(const Angle& angle); 24 | void setViewport(const FloatRect& viewport); 25 | 26 | // void reset(const FloatRect& rectangle); 27 | void move(const Vector2f& offset); 28 | // void rotate(Angle angle); 29 | // void zoom(float factor); 30 | 31 | /******************************************* 32 | * @brief maps the given rect in relation to this view. 33 | * 34 | * This method accepts a rectangle oriented in world coordinates and transform it to a rectangle oriented more towards this view (i.e. screen coordinates). 35 | * @param rect rectangle to be mapped. 36 | * @return a rectangle mapped relatively to the view. 37 | *******************************************/ 38 | FloatRect mapToView(const FloatRect& rect); 39 | 40 | /****************************************** 41 | * @brief maps the given vector in relation to this view 42 | * 43 | * @param coord vector to be mapped. 44 | * @return a vector mapped to the view. 45 | ******************************************/ 46 | Vector2f mapToView(const Vector2f& coord); 47 | 48 | private: 49 | Vector2f m_center; 50 | Vector2f m_area; 51 | // Angle m_rotation; 52 | 53 | FloatRect m_viewport{{0, 0}, {1, 1}}; 54 | 55 | }; // class View 56 | 57 | 58 | } // namespace fl 59 | -------------------------------------------------------------------------------- /include/Feather/Windows/Window.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | const int DEFAULT_SCREEN_WIDTH = 640; 11 | const int DEFAULT_SCREEN_HEIGHT = 480; 12 | 13 | namespace fl { 14 | class Window { 15 | public: 16 | Window(const std::string& title, int x = SDL_WINDOWPOS_UNDEFINED, int y = SDL_WINDOWPOS_UNDEFINED, int w = DEFAULT_SCREEN_WIDTH, int h = DEFAULT_SCREEN_HEIGHT, std::uint32_t flags = SDL_WINDOW_SHOWN); 17 | 18 | void init(); 19 | bool isOpen() const; 20 | void close(); 21 | 22 | void handleEvents(); 23 | 24 | // TODO: OTHER METHODS 25 | void clear(fl::Color color = fl::Color::Black); 26 | 27 | void draw(SDL_Texture* texture, const fl::FloatRect& srcRect, const fl::FloatRect& destRect); 28 | void draw(SDL_Texture* texture, const fl::FloatRect& destRect); 29 | 30 | void display(); 31 | 32 | SDL_Window* getWindow() const; 33 | SDL_Renderer* getRenderer() const; 34 | const View& getView() const; 35 | const View& getDefaultView() const; 36 | FloatRect getViewSpace() const; 37 | 38 | void setView(const View& view); 39 | 40 | 41 | private: // Attributes 42 | SDL_Window* m_window; 43 | SDL_Renderer* m_renderer; 44 | 45 | std::string m_title; 46 | IntRect m_area; 47 | std::uint32_t m_flags; 48 | 49 | View m_defaultView; 50 | View m_view; 51 | 52 | bool m_open; 53 | }; // class Window 54 | 55 | } // namespace fl 56 | -------------------------------------------------------------------------------- /include/Feather/rigidentity.cpp: -------------------------------------------------------------------------------- 1 | #include "rigidentity.h" 2 | #include 3 | 4 | //using namespace std; 5 | 6 | int RigidEntity::Update(float deltaTime) { 7 | float time = deltaTime; 8 | 9 | acceleration.x = (force.x / mass); 10 | acceleration.y = ((force.y - gravity * mass) / mass); 11 | force.x = 0; 12 | force.y = 0; 13 | 14 | velocity += acceleration * time * 200; 15 | Vector delta = velocity * time; 16 | 17 | testMove(delta); 18 | 19 | return 0; 20 | } 21 | 22 | RigidEntity* RigidEntity::Clone() { 23 | Transform t = transform; 24 | return RigidEntity::Clone(t); 25 | } 26 | 27 | RigidEntity* RigidEntity::Clone(Transform t) { 28 | RigidEntity *cloneEntity = new RigidEntity; 29 | cloneEntity->Create(this->getSprite(), t); 30 | cloneEntity->setHitbox(this->hitbox.x, this->hitbox.y, this->hitbox.w, this->hitbox.h); 31 | cloneEntity->setClone(); 32 | return cloneEntity; 33 | } 34 | 35 | int RigidEntity::setHitbox(int x, int y, int w, int h) { 36 | hitbox.x = x; 37 | hitbox.y = y; 38 | hitbox.w = w; 39 | hitbox.h = h; 40 | return 0; 41 | } 42 | 43 | int RigidEntity::addForce(Vector forceVec) { 44 | force.x += forceVec.x; 45 | force.y += forceVec.y; 46 | return 0; 47 | } 48 | 49 | int RigidEntity::addForceX(float xForce) { 50 | force.x += xForce; 51 | return 0; 52 | } 53 | 54 | int RigidEntity::addForceY(float yForce) { 55 | force.y += yForce; 56 | return 0; 57 | } 58 | 59 | int RigidEntity::testMove(Vector delta) { 60 | for (auto element : entityTracker) { 61 | if (element.first == Entity::id) continue; 62 | if (dynamic_cast(element.second)) { 63 | RigidEntity* rigidEntity = dynamic_cast(element.second); 64 | SDL_Rect dst1 = { (int)(transform.position.x + hitbox.x + delta.x), (int)(transform.position.y + hitbox.y + delta.y), hitbox.w, hitbox.h }; 65 | SDL_Rect dst2 = { (int)rigidEntity->transform.position.x + rigidEntity->hitbox.x, (int)rigidEntity->transform.position.y + rigidEntity->hitbox.y, rigidEntity->hitbox.w, rigidEntity->hitbox.h }; 66 | if (SDL_HasIntersection(&dst1, &dst2)) { 67 | velocity = (0, 0); 68 | return 1; 69 | } 70 | } 71 | } 72 | transform.position += delta; 73 | return 0; 74 | } 75 | -------------------------------------------------------------------------------- /include/Feather/rigidentity.h: -------------------------------------------------------------------------------- 1 | #ifndef RIGIDENTITY_H 2 | #define RIGIDENTITY_H 3 | #include "core.h" 4 | #include "transform.h" 5 | #include "entity.h" 6 | #include 7 | 8 | class RigidEntity : public Entity { 9 | private: 10 | SDL_Texture *sprite; 11 | public: 12 | bool rigid = true; 13 | 14 | RigidEntity* Clone(); 15 | RigidEntity* Clone(Transform t); 16 | 17 | Vector velocity; 18 | Vector acceleration; 19 | 20 | SDL_Rect hitbox; 21 | int setHitbox(int x = 0, int y = 0, int w = 1, int h = 1); 22 | 23 | float gravity = -9.8; 24 | float mass = 1; 25 | Vector force = Vector(0, 0); 26 | 27 | int addForce(Vector force); 28 | int addForceX(float x); 29 | int addForceY(float Y); 30 | 31 | int testMove(Vector delta); 32 | 33 | int Update(float deltaTime); 34 | }; 35 | 36 | extern std::unordered_map entityTracker; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /include/Feather/text.cpp: -------------------------------------------------------------------------------- 1 | #include "text.h" 2 | 3 | int drawText(std::string s, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int x, int y){ 4 | SDL_Color tcolor = { r, g, b, a }; 5 | const char *text= s.c_str(); 6 | SDL_Surface *image = TTF_RenderText_Solid(font, text, tcolor); 7 | SDL_Texture *texture = SDL_CreateTextureFromSurface(rend, image); 8 | int sprw; 9 | int sprh; 10 | SDL_QueryTexture(texture, NULL, NULL, &sprw, &sprh); 11 | SDL_Rect dst = { x, y, sprw, sprh }; 12 | SDL_RenderCopy(rend, texture, NULL, &dst); 13 | SDL_FreeSurface(image); 14 | SDL_DestroyTexture(texture); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /include/Feather/text.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXT_H 2 | #define TEXT_H 3 | #include "core.h" 4 | 5 | extern TTF_Font *font; 6 | 7 | int drawText(std::string s, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int x, int y); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /include/Feather/timer.cpp: -------------------------------------------------------------------------------- 1 | #include "timer.h" 2 | 3 | Timer::Timer(Uint32 total, bool newOneshot){ 4 | endTime = total; 5 | oneshot = newOneshot; 6 | } 7 | 8 | int Timer::Start(){ 9 | startTime = SDL_GetTicks(); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /include/Feather/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef TIMER_H 2 | #define TIMER_H 3 | #include "core.h" 4 | 5 | class Timer{ 6 | private: 7 | bool active; 8 | Uint32 startTime; 9 | Uint32 endTime; 10 | public: 11 | bool oneshot; 12 | 13 | Timer(Uint32 total, bool newOneshot = false); 14 | int Start(); 15 | bool isFinished(); 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_bits.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_bits.h 24 | * 25 | * Functions for fiddling with bits and bitmasks. 26 | */ 27 | 28 | #ifndef SDL_bits_h_ 29 | #define SDL_bits_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * \file SDL_bits.h 41 | */ 42 | 43 | /** 44 | * Get the index of the most significant bit. Result is undefined when called 45 | * with 0. This operation can also be stated as "count leading zeroes" and 46 | * "log base 2". 47 | * 48 | * \return the index of the most significant bit, or -1 if the value is 0. 49 | */ 50 | #if defined(__WATCOMC__) && defined(__386__) 51 | extern __inline int _SDL_bsr_watcom(Uint32); 52 | #pragma aux _SDL_bsr_watcom = \ 53 | "bsr eax, eax" \ 54 | parm [eax] nomemory \ 55 | value [eax] \ 56 | modify exact [eax] nomemory; 57 | #endif 58 | 59 | SDL_FORCE_INLINE int 60 | SDL_MostSignificantBitIndex32(Uint32 x) 61 | { 62 | #if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 63 | /* Count Leading Zeroes builtin in GCC. 64 | * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html 65 | */ 66 | if (x == 0) { 67 | return -1; 68 | } 69 | return 31 - __builtin_clz(x); 70 | #elif defined(__WATCOMC__) && defined(__386__) 71 | if (x == 0) { 72 | return -1; 73 | } 74 | return _SDL_bsr_watcom(x); 75 | #elif defined(_MSC_VER) 76 | unsigned long index; 77 | if (_BitScanReverse(&index, x)) { 78 | return index; 79 | } 80 | return -1; 81 | #else 82 | /* Based off of Bit Twiddling Hacks by Sean Eron Anderson 83 | * , released in the public domain. 84 | * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog 85 | */ 86 | const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; 87 | const int S[] = {1, 2, 4, 8, 16}; 88 | 89 | int msbIndex = 0; 90 | int i; 91 | 92 | if (x == 0) { 93 | return -1; 94 | } 95 | 96 | for (i = 4; i >= 0; i--) 97 | { 98 | if (x & b[i]) 99 | { 100 | x >>= S[i]; 101 | msbIndex |= S[i]; 102 | } 103 | } 104 | 105 | return msbIndex; 106 | #endif 107 | } 108 | 109 | SDL_FORCE_INLINE SDL_bool 110 | SDL_HasExactlyOneBitSet32(Uint32 x) 111 | { 112 | if (x && !(x & (x - 1))) { 113 | return SDL_TRUE; 114 | } 115 | return SDL_FALSE; 116 | } 117 | 118 | /* Ends C function definitions when using C++ */ 119 | #ifdef __cplusplus 120 | } 121 | #endif 122 | #include "close_code.h" 123 | 124 | #endif /* SDL_bits_h_ */ 125 | 126 | /* vi: set ts=4 sw=4 expandtab: */ 127 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_clipboard.h 24 | * 25 | * Include file for SDL clipboard handling 26 | */ 27 | 28 | #ifndef SDL_clipboard_h_ 29 | #define SDL_clipboard_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | /** 42 | * Put UTF-8 text into the clipboard. 43 | * 44 | * \param text the text to store in the clipboard 45 | * \returns 0 on success or a negative error code on failure; call 46 | * SDL_GetError() for more information. 47 | * 48 | * \since This function is available since SDL 2.0.0. 49 | * 50 | * \sa SDL_GetClipboardText 51 | * \sa SDL_HasClipboardText 52 | */ 53 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); 54 | 55 | /** 56 | * Get UTF-8 text from the clipboard, which must be freed with SDL_free(). 57 | * 58 | * This functions returns empty string if there was not enough memory left for 59 | * a copy of the clipboard's content. 60 | * 61 | * \returns the clipboard text on success or an empty string on failure; call 62 | * SDL_GetError() for more information. Caller must call SDL_free() 63 | * on the returned pointer when done with it (even if there was an 64 | * error). 65 | * 66 | * \since This function is available since SDL 2.0.0. 67 | * 68 | * \sa SDL_HasClipboardText 69 | * \sa SDL_SetClipboardText 70 | */ 71 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); 72 | 73 | /** 74 | * Query whether the clipboard exists and contains a non-empty text string. 75 | * 76 | * \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not. 77 | * 78 | * \since This function is available since SDL 2.0.0. 79 | * 80 | * \sa SDL_GetClipboardText 81 | * \sa SDL_SetClipboardText 82 | */ 83 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); 84 | 85 | 86 | /* Ends C function definitions when using C++ */ 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | #include "close_code.h" 91 | 92 | #endif /* SDL_clipboard_h_ */ 93 | 94 | /* vi: set ts=4 sw=4 expandtab: */ 95 | -------------------------------------------------------------------------------- /include/Unix/SDL2/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 | -------------------------------------------------------------------------------- /include/Unix/SDL2/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 | -------------------------------------------------------------------------------- /include/Unix/SDL2/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 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_guid.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_guid.h 24 | * 25 | * Include file for handling ::SDL_GUID values. 26 | */ 27 | 28 | #ifndef SDL_guid_h_ 29 | #define SDL_guid_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 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * An SDL_GUID is a 128-bit identifier for an input device that 42 | * identifies that device across runs of SDL programs on the same 43 | * platform. If the device is detached and then re-attached to a 44 | * different port, or if the base system is rebooted, the device 45 | * should still report the same GUID. 46 | * 47 | * GUIDs are as precise as possible but are not guaranteed to 48 | * distinguish physically distinct but equivalent devices. For 49 | * example, two game controllers from the same vendor with the same 50 | * product ID and revision may have the same GUID. 51 | * 52 | * GUIDs may be platform-dependent (i.e., the same device may report 53 | * different GUIDs on different operating systems). 54 | */ 55 | typedef struct { 56 | Uint8 data[16]; 57 | } SDL_GUID; 58 | 59 | /* Function prototypes */ 60 | 61 | /** 62 | * Get an ASCII string representation for a given ::SDL_GUID. 63 | * 64 | * You should supply at least 33 bytes for pszGUID. 65 | * 66 | * \param guid the ::SDL_GUID you wish to convert to string 67 | * \param pszGUID buffer in which to write the ASCII string 68 | * \param cbGUID the size of pszGUID 69 | * 70 | * \since This function is available since SDL 2.24.0. 71 | * 72 | * \sa SDL_GUIDFromString 73 | */ 74 | extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID); 75 | 76 | /** 77 | * Convert a GUID string into a ::SDL_GUID structure. 78 | * 79 | * Performs no error checking. If this function is given a string containing 80 | * an invalid GUID, the function will silently succeed, but the GUID generated 81 | * will not be useful. 82 | * 83 | * \param pchGUID string containing an ASCII representation of a GUID 84 | * \returns a ::SDL_GUID structure. 85 | * 86 | * \since This function is available since SDL 2.24.0. 87 | * 88 | * \sa SDL_GUIDToString 89 | */ 90 | extern DECLSPEC SDL_GUID SDLCALL SDL_GUIDFromString(const char *pchGUID); 91 | 92 | /* Ends C function definitions when using C++ */ 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | #include "close_code.h" 97 | 98 | #endif /* SDL_guid_h_ */ 99 | 100 | /* vi: set ts=4 sw=4 expandtab: */ 101 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_misc.h 24 | * 25 | * \brief Include file for SDL API functions that don't fit elsewhere. 26 | */ 27 | 28 | #ifndef SDL_misc_h_ 29 | #define SDL_misc_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * Open a URL/URI in the browser or other appropriate external application. 42 | * 43 | * Open a URL in a separate, system-provided application. How this works will 44 | * vary wildly depending on the platform. This will likely launch what makes 45 | * sense to handle a specific URL's protocol (a web browser for `http://`, 46 | * etc), but it might also be able to launch file managers for directories and 47 | * other things. 48 | * 49 | * What happens when you open a URL varies wildly as well: your game window 50 | * may lose focus (and may or may not lose focus if your game was fullscreen 51 | * or grabbing input at the time). On mobile devices, your app will likely 52 | * move to the background or your process might be paused. Any given platform 53 | * may or may not handle a given URL. 54 | * 55 | * If this is unimplemented (or simply unavailable) for a platform, this will 56 | * fail with an error. A successful result does not mean the URL loaded, just 57 | * that we launched _something_ to handle it (or at least believe we did). 58 | * 59 | * All this to say: this function can be useful, but you should definitely 60 | * test it on every platform you target. 61 | * 62 | * \param url A valid URL/URI to open. Use `file:///full/path/to/file` for 63 | * local files, if supported. 64 | * \returns 0 on success, or -1 on error; call SDL_GetError() for more 65 | * information. 66 | * 67 | * \since This function is available since SDL 2.0.14. 68 | */ 69 | extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url); 70 | 71 | /* Ends C function definitions when using C++ */ 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | #include "close_code.h" 76 | 77 | #endif /* SDL_misc_h_ */ 78 | 79 | /* vi: set ts=4 sw=4 expandtab: */ 80 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDLname_h_ 23 | #define SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef APIENTRY 38 | #define APIENTRY 39 | #endif 40 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) 30 | 31 | #ifdef __IPHONEOS__ 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #include 38 | #endif 39 | 40 | #else /* _MSC_VER */ 41 | 42 | /* OpenGL ES2 headers for Visual Studio */ 43 | #include "SDL_opengles2_khrplatform.h" 44 | #include "SDL_opengles2_gl2platform.h" 45 | #include "SDL_opengles2_gl2.h" 46 | #include "SDL_opengles2_gl2ext.h" 47 | 48 | #endif /* _MSC_VER */ 49 | 50 | #ifndef APIENTRY 51 | #define APIENTRY GL_APIENTRY 52 | #endif 53 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | /*#include */ 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_power.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_power_h_ 23 | #define SDL_power_h_ 24 | 25 | /** 26 | * \file SDL_power.h 27 | * 28 | * Header for the SDL power management routines. 29 | */ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * The basic state for the system's power supply. 41 | */ 42 | typedef enum 43 | { 44 | SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ 45 | SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ 46 | SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ 47 | SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ 48 | SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ 49 | } SDL_PowerState; 50 | 51 | 52 | /** 53 | * Get the current power supply details. 54 | * 55 | * You should never take a battery status as absolute truth. Batteries 56 | * (especially failing batteries) are delicate hardware, and the values 57 | * reported here are best estimates based on what that hardware reports. It's 58 | * not uncommon for older batteries to lose stored power much faster than it 59 | * reports, or completely drain when reporting it has 20 percent left, etc. 60 | * 61 | * Battery status can change at any time; if you are concerned with power 62 | * state, you should call this function frequently, and perhaps ignore changes 63 | * until they seem to be stable for a few seconds. 64 | * 65 | * It's possible a platform can only report battery percentage or time left 66 | * but not both. 67 | * 68 | * \param secs seconds of battery life left, you can pass a NULL here if you 69 | * don't care, will return -1 if we can't determine a value, or 70 | * we're not running on a battery 71 | * \param pct percentage of battery life left, between 0 and 100, you can pass 72 | * a NULL here if you don't care, will return -1 if we can't 73 | * determine a value, or we're not running on a battery 74 | * \returns an SDL_PowerState enum representing the current battery state. 75 | * 76 | * \since This function is available since SDL 2.0.0. 77 | */ 78 | extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); 79 | 80 | /* Ends C function definitions when using C++ */ 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | #include "close_code.h" 85 | 86 | #endif /* SDL_power_h_ */ 87 | 88 | /* vi: set ts=4 sw=4 expandtab: */ 89 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_quit.h 24 | * 25 | * Include file for SDL quit event handling. 26 | */ 27 | 28 | #ifndef SDL_quit_h_ 29 | #define SDL_quit_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | /** 35 | * \file SDL_quit.h 36 | * 37 | * An ::SDL_QUIT event is generated when the user tries to close the application 38 | * window. If it is ignored or filtered out, the window will remain open. 39 | * If it is not ignored or filtered, it is queued normally and the window 40 | * is allowed to close. When the window is closed, screen updates will 41 | * complete, but have no effect. 42 | * 43 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 44 | * and SIGTERM (system termination request), if handlers do not already 45 | * exist, that generate ::SDL_QUIT events as well. There is no way 46 | * to determine the cause of an ::SDL_QUIT event, but setting a signal 47 | * handler in your application will override the default generation of 48 | * quit events for that signal. 49 | * 50 | * \sa SDL_Quit() 51 | */ 52 | 53 | /* There are no functions directly affecting the quit event */ 54 | 55 | #define SDL_QuitRequested() \ 56 | (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) 57 | 58 | #endif /* SDL_quit_h_ */ 59 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_revision.h: -------------------------------------------------------------------------------- 1 | #define SDL_REVISION "https://github.com/libsdl-org/SDL.git@8c9beb0c873f6ca5efbd88f1ad2648bfc793b2ac" 2 | #define SDL_REVISION_NUMBER 0 3 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_h_ 31 | #define SDL_test_h_ 32 | 33 | #include "SDL.h" 34 | #include "SDL_test_assert.h" 35 | #include "SDL_test_common.h" 36 | #include "SDL_test_compare.h" 37 | #include "SDL_test_crc32.h" 38 | #include "SDL_test_font.h" 39 | #include "SDL_test_fuzzer.h" 40 | #include "SDL_test_harness.h" 41 | #include "SDL_test_images.h" 42 | #include "SDL_test_log.h" 43 | #include "SDL_test_md5.h" 44 | #include "SDL_test_memory.h" 45 | #include "SDL_test_random.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /* Global definitions */ 54 | 55 | /* 56 | * Note: Maximum size of SDLTest log message is less than SDL's limit 57 | * to ensure we can fit additional information such as the timestamp. 58 | */ 59 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_test_assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_assert.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Assert API for test code and test cases 33 | * 34 | */ 35 | 36 | #ifndef SDL_test_assert_h_ 37 | #define SDL_test_assert_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Fails the assert. 47 | */ 48 | #define ASSERT_FAIL 0 49 | 50 | /** 51 | * \brief Passes the assert. 52 | */ 53 | #define ASSERT_PASS 1 54 | 55 | /** 56 | * \brief Assert that logs and break execution flow on failures. 57 | * 58 | * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). 59 | * \param assertDescription Message to log with the assert describing it. 60 | */ 61 | void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); 62 | 63 | /** 64 | * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. 65 | * 66 | * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). 67 | * \param assertDescription Message to log with the assert describing it. 68 | * 69 | * \returns the assertCondition so it can be used to externally to break execution flow if desired. 70 | */ 71 | int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); 72 | 73 | /** 74 | * \brief Explicitly pass without checking an assertion condition. Updates assertion counter. 75 | * 76 | * \param assertDescription Message to log with the assert describing it. 77 | */ 78 | void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1); 79 | 80 | /** 81 | * \brief Resets the assert summary counters to zero. 82 | */ 83 | void SDLTest_ResetAssertSummary(void); 84 | 85 | /** 86 | * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. 87 | */ 88 | void SDLTest_LogAssertSummary(void); 89 | 90 | 91 | /** 92 | * \brief Converts the current assert summary state to a test result. 93 | * 94 | * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT 95 | */ 96 | int SDLTest_AssertSummaryToTestResult(void); 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | #include "close_code.h" 102 | 103 | #endif /* SDL_test_assert_h_ */ 104 | 105 | /* vi: set ts=4 sw=4 expandtab: */ 106 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_test_compare.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_compare.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines comparison functions (i.e. for surfaces). 33 | 34 | */ 35 | 36 | #ifndef SDL_test_compare_h_ 37 | #define SDL_test_compare_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "SDL_test_images.h" 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * \brief Compares a surface and with reference image data for equality 51 | * 52 | * \param surface Surface used in comparison 53 | * \param referenceSurface Test Surface used in comparison 54 | * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. 55 | * 56 | * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. 57 | */ 58 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); 59 | 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_compare_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_test_images.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_images.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines some images for tests. 33 | 34 | */ 35 | 36 | #ifndef SDL_test_images_h_ 37 | #define SDL_test_images_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "begin_code.h" 42 | /* Set up for C function definitions, even when using C++ */ 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /** 48 | *Type for test images. 49 | */ 50 | typedef struct SDLTest_SurfaceImage_s { 51 | int width; 52 | int height; 53 | unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ 54 | const char *pixel_data; 55 | } SDLTest_SurfaceImage_t; 56 | 57 | /* Test images */ 58 | SDL_Surface *SDLTest_ImageBlit(void); 59 | SDL_Surface *SDLTest_ImageBlitColor(void); 60 | SDL_Surface *SDLTest_ImageBlitAlpha(void); 61 | SDL_Surface *SDLTest_ImageBlitBlendAdd(void); 62 | SDL_Surface *SDLTest_ImageBlitBlend(void); 63 | SDL_Surface *SDLTest_ImageBlitBlendMod(void); 64 | SDL_Surface *SDLTest_ImageBlitBlendNone(void); 65 | SDL_Surface *SDLTest_ImageBlitBlendAll(void); 66 | SDL_Surface *SDLTest_ImageFace(void); 67 | SDL_Surface *SDLTest_ImagePrimitives(void); 68 | SDL_Surface *SDLTest_ImagePrimitivesBlend(void); 69 | 70 | /* Ends C function definitions when using C++ */ 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | #include "close_code.h" 75 | 76 | #endif /* SDL_test_images_h_ */ 77 | 78 | /* vi: set ts=4 sw=4 expandtab: */ 79 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_test_log.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_log.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Wrapper to log in the TEST category 33 | * 34 | */ 35 | 36 | #ifndef SDL_test_log_h_ 37 | #define SDL_test_log_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority. 47 | * 48 | * \param fmt Message to be logged 49 | */ 50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 51 | 52 | /** 53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. 54 | * 55 | * \param fmt Message to be logged 56 | */ 57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 58 | 59 | /* Ends C function definitions when using C++ */ 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #include "close_code.h" 64 | 65 | #endif /* SDL_test_log_h_ */ 66 | 67 | /* vi: set ts=4 sw=4 expandtab: */ 68 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_memory.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_memory_h_ 31 | #define SDL_test_memory_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | /** 41 | * \brief Start tracking SDL memory allocations 42 | * 43 | * \note This should be called before any other SDL functions for complete tracking coverage 44 | */ 45 | int SDLTest_TrackAllocations(void); 46 | 47 | /** 48 | * \brief Print a log of any outstanding allocations 49 | * 50 | * \note This can be called after SDL_Quit() 51 | */ 52 | void SDLTest_LogAllocations(void); 53 | 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* SDL_test_memory_h_ */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_test_random.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_random.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | A "32-bit Multiply with carry random number generator. Very fast. 33 | Includes a list of recommended multipliers. 34 | 35 | multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32. 36 | period: (a*2^31)-1 37 | 38 | */ 39 | 40 | #ifndef SDL_test_random_h_ 41 | #define SDL_test_random_h_ 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /* --- Definitions */ 50 | 51 | /* 52 | * Macros that return a random number in a specific format. 53 | */ 54 | #define SDLTest_RandomInt(c) ((int)SDLTest_Random(c)) 55 | 56 | /* 57 | * Context structure for the random number generator state. 58 | */ 59 | typedef struct { 60 | unsigned int a; 61 | unsigned int x; 62 | unsigned int c; 63 | unsigned int ah; 64 | unsigned int al; 65 | } SDLTest_RandomContext; 66 | 67 | 68 | /* --- Function prototypes */ 69 | 70 | /** 71 | * \brief Initialize random number generator with two integers. 72 | * 73 | * Note: The random sequence of numbers returned by ...Random() is the 74 | * same for the same two integers and has a period of 2^31. 75 | * 76 | * \param rndContext pointer to context structure 77 | * \param xi integer that defines the random sequence 78 | * \param ci integer that defines the random sequence 79 | * 80 | */ 81 | void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, 82 | unsigned int ci); 83 | 84 | /** 85 | * \brief Initialize random number generator based on current system time. 86 | * 87 | * \param rndContext pointer to context structure 88 | * 89 | */ 90 | void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext); 91 | 92 | 93 | /** 94 | * \brief Initialize random number generator based on current system time. 95 | * 96 | * Note: ...RandomInit() or ...RandomInitTime() must have been called 97 | * before using this function. 98 | * 99 | * \param rndContext pointer to context structure 100 | * 101 | * \returns a random number (32bit unsigned integer) 102 | * 103 | */ 104 | unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext); 105 | 106 | 107 | /* Ends C function definitions when using C++ */ 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | #include "close_code.h" 112 | 113 | #endif /* SDL_test_random_h_ */ 114 | 115 | /* vi: set ts=4 sw=4 expandtab: */ 116 | -------------------------------------------------------------------------------- /include/Unix/SDL2/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /include/Unix/SDL2/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #ifndef _begin_code_h 30 | #error close_code.h included without matching begin_code.h 31 | #endif 32 | #undef _begin_code_h 33 | 34 | /* Reset structure packing at previous byte alignment */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #pragma pack(pop) 40 | #endif /* Compiler needs structure packing set */ 41 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_bits.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_bits.h 24 | * 25 | * Functions for fiddling with bits and bitmasks. 26 | */ 27 | 28 | #ifndef SDL_bits_h_ 29 | #define SDL_bits_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * \file SDL_bits.h 41 | */ 42 | 43 | /** 44 | * Get the index of the most significant bit. Result is undefined when called 45 | * with 0. This operation can also be stated as "count leading zeroes" and 46 | * "log base 2". 47 | * 48 | * \return the index of the most significant bit, or -1 if the value is 0. 49 | */ 50 | #if defined(__WATCOMC__) && defined(__386__) 51 | extern __inline int _SDL_bsr_watcom(Uint32); 52 | #pragma aux _SDL_bsr_watcom = \ 53 | "bsr eax, eax" \ 54 | parm [eax] nomemory \ 55 | value [eax] \ 56 | modify exact [eax] nomemory; 57 | #endif 58 | 59 | SDL_FORCE_INLINE int 60 | SDL_MostSignificantBitIndex32(Uint32 x) 61 | { 62 | #if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 63 | /* Count Leading Zeroes builtin in GCC. 64 | * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html 65 | */ 66 | if (x == 0) { 67 | return -1; 68 | } 69 | return 31 - __builtin_clz(x); 70 | #elif defined(__WATCOMC__) && defined(__386__) 71 | if (x == 0) { 72 | return -1; 73 | } 74 | return _SDL_bsr_watcom(x); 75 | #elif defined(_MSC_VER) 76 | unsigned long index; 77 | if (_BitScanReverse(&index, x)) { 78 | return index; 79 | } 80 | return -1; 81 | #else 82 | /* Based off of Bit Twiddling Hacks by Sean Eron Anderson 83 | * , released in the public domain. 84 | * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog 85 | */ 86 | const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; 87 | const int S[] = {1, 2, 4, 8, 16}; 88 | 89 | int msbIndex = 0; 90 | int i; 91 | 92 | if (x == 0) { 93 | return -1; 94 | } 95 | 96 | for (i = 4; i >= 0; i--) 97 | { 98 | if (x & b[i]) 99 | { 100 | x >>= S[i]; 101 | msbIndex |= S[i]; 102 | } 103 | } 104 | 105 | return msbIndex; 106 | #endif 107 | } 108 | 109 | SDL_FORCE_INLINE SDL_bool 110 | SDL_HasExactlyOneBitSet32(Uint32 x) 111 | { 112 | if (x && !(x & (x - 1))) { 113 | return SDL_TRUE; 114 | } 115 | return SDL_FALSE; 116 | } 117 | 118 | /* Ends C function definitions when using C++ */ 119 | #ifdef __cplusplus 120 | } 121 | #endif 122 | #include "close_code.h" 123 | 124 | #endif /* SDL_bits_h_ */ 125 | 126 | /* vi: set ts=4 sw=4 expandtab: */ 127 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_clipboard.h 24 | * 25 | * Include file for SDL clipboard handling 26 | */ 27 | 28 | #ifndef SDL_clipboard_h_ 29 | #define SDL_clipboard_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | /** 42 | * Put UTF-8 text into the clipboard. 43 | * 44 | * \param text the text to store in the clipboard 45 | * \returns 0 on success or a negative error code on failure; call 46 | * SDL_GetError() for more information. 47 | * 48 | * \since This function is available since SDL 2.0.0. 49 | * 50 | * \sa SDL_GetClipboardText 51 | * \sa SDL_HasClipboardText 52 | */ 53 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); 54 | 55 | /** 56 | * Get UTF-8 text from the clipboard, which must be freed with SDL_free(). 57 | * 58 | * This functions returns empty string if there was not enough memory left for 59 | * a copy of the clipboard's content. 60 | * 61 | * \returns the clipboard text on success or an empty string on failure; call 62 | * SDL_GetError() for more information. Caller must call SDL_free() 63 | * on the returned pointer when done with it (even if there was an 64 | * error). 65 | * 66 | * \since This function is available since SDL 2.0.0. 67 | * 68 | * \sa SDL_HasClipboardText 69 | * \sa SDL_SetClipboardText 70 | */ 71 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); 72 | 73 | /** 74 | * Query whether the clipboard exists and contains a non-empty text string. 75 | * 76 | * \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not. 77 | * 78 | * \since This function is available since SDL 2.0.0. 79 | * 80 | * \sa SDL_GetClipboardText 81 | * \sa SDL_SetClipboardText 82 | */ 83 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); 84 | 85 | 86 | /* Ends C function definitions when using C++ */ 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | #include "close_code.h" 91 | 92 | #endif /* SDL_clipboard_h_ */ 93 | 94 | /* vi: set ts=4 sw=4 expandtab: */ 95 | -------------------------------------------------------------------------------- /include/Windows/SDL2/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 | -------------------------------------------------------------------------------- /include/Windows/SDL2/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 | -------------------------------------------------------------------------------- /include/Windows/SDL2/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 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_guid.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_guid.h 24 | * 25 | * Include file for handling ::SDL_GUID values. 26 | */ 27 | 28 | #ifndef SDL_guid_h_ 29 | #define SDL_guid_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 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * An SDL_GUID is a 128-bit identifier for an input device that 42 | * identifies that device across runs of SDL programs on the same 43 | * platform. If the device is detached and then re-attached to a 44 | * different port, or if the base system is rebooted, the device 45 | * should still report the same GUID. 46 | * 47 | * GUIDs are as precise as possible but are not guaranteed to 48 | * distinguish physically distinct but equivalent devices. For 49 | * example, two game controllers from the same vendor with the same 50 | * product ID and revision may have the same GUID. 51 | * 52 | * GUIDs may be platform-dependent (i.e., the same device may report 53 | * different GUIDs on different operating systems). 54 | */ 55 | typedef struct { 56 | Uint8 data[16]; 57 | } SDL_GUID; 58 | 59 | /* Function prototypes */ 60 | 61 | /** 62 | * Get an ASCII string representation for a given ::SDL_GUID. 63 | * 64 | * You should supply at least 33 bytes for pszGUID. 65 | * 66 | * \param guid the ::SDL_GUID you wish to convert to string 67 | * \param pszGUID buffer in which to write the ASCII string 68 | * \param cbGUID the size of pszGUID 69 | * 70 | * \since This function is available since SDL 2.24.0. 71 | * 72 | * \sa SDL_GUIDFromString 73 | */ 74 | extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID); 75 | 76 | /** 77 | * Convert a GUID string into a ::SDL_GUID structure. 78 | * 79 | * Performs no error checking. If this function is given a string containing 80 | * an invalid GUID, the function will silently succeed, but the GUID generated 81 | * will not be useful. 82 | * 83 | * \param pchGUID string containing an ASCII representation of a GUID 84 | * \returns a ::SDL_GUID structure. 85 | * 86 | * \since This function is available since SDL 2.24.0. 87 | * 88 | * \sa SDL_GUIDToString 89 | */ 90 | extern DECLSPEC SDL_GUID SDLCALL SDL_GUIDFromString(const char *pchGUID); 91 | 92 | /* Ends C function definitions when using C++ */ 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | #include "close_code.h" 97 | 98 | #endif /* SDL_guid_h_ */ 99 | 100 | /* vi: set ts=4 sw=4 expandtab: */ 101 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_misc.h 24 | * 25 | * \brief Include file for SDL API functions that don't fit elsewhere. 26 | */ 27 | 28 | #ifndef SDL_misc_h_ 29 | #define SDL_misc_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * Open a URL/URI in the browser or other appropriate external application. 42 | * 43 | * Open a URL in a separate, system-provided application. How this works will 44 | * vary wildly depending on the platform. This will likely launch what makes 45 | * sense to handle a specific URL's protocol (a web browser for `http://`, 46 | * etc), but it might also be able to launch file managers for directories and 47 | * other things. 48 | * 49 | * What happens when you open a URL varies wildly as well: your game window 50 | * may lose focus (and may or may not lose focus if your game was fullscreen 51 | * or grabbing input at the time). On mobile devices, your app will likely 52 | * move to the background or your process might be paused. Any given platform 53 | * may or may not handle a given URL. 54 | * 55 | * If this is unimplemented (or simply unavailable) for a platform, this will 56 | * fail with an error. A successful result does not mean the URL loaded, just 57 | * that we launched _something_ to handle it (or at least believe we did). 58 | * 59 | * All this to say: this function can be useful, but you should definitely 60 | * test it on every platform you target. 61 | * 62 | * \param url A valid URL/URI to open. Use `file:///full/path/to/file` for 63 | * local files, if supported. 64 | * \returns 0 on success, or -1 on error; call SDL_GetError() for more 65 | * information. 66 | * 67 | * \since This function is available since SDL 2.0.14. 68 | */ 69 | extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url); 70 | 71 | /* Ends C function definitions when using C++ */ 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | #include "close_code.h" 76 | 77 | #endif /* SDL_misc_h_ */ 78 | 79 | /* vi: set ts=4 sw=4 expandtab: */ 80 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDLname_h_ 23 | #define SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef APIENTRY 38 | #define APIENTRY 39 | #endif 40 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) 30 | 31 | #ifdef __IPHONEOS__ 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #include 38 | #endif 39 | 40 | #else /* _MSC_VER */ 41 | 42 | /* OpenGL ES2 headers for Visual Studio */ 43 | #include "SDL_opengles2_khrplatform.h" 44 | #include "SDL_opengles2_gl2platform.h" 45 | #include "SDL_opengles2_gl2.h" 46 | #include "SDL_opengles2_gl2ext.h" 47 | 48 | #endif /* _MSC_VER */ 49 | 50 | #ifndef APIENTRY 51 | #define APIENTRY GL_APIENTRY 52 | #endif 53 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | /*#include */ 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_power.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_power_h_ 23 | #define SDL_power_h_ 24 | 25 | /** 26 | * \file SDL_power.h 27 | * 28 | * Header for the SDL power management routines. 29 | */ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * The basic state for the system's power supply. 41 | */ 42 | typedef enum 43 | { 44 | SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ 45 | SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ 46 | SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ 47 | SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ 48 | SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ 49 | } SDL_PowerState; 50 | 51 | 52 | /** 53 | * Get the current power supply details. 54 | * 55 | * You should never take a battery status as absolute truth. Batteries 56 | * (especially failing batteries) are delicate hardware, and the values 57 | * reported here are best estimates based on what that hardware reports. It's 58 | * not uncommon for older batteries to lose stored power much faster than it 59 | * reports, or completely drain when reporting it has 20 percent left, etc. 60 | * 61 | * Battery status can change at any time; if you are concerned with power 62 | * state, you should call this function frequently, and perhaps ignore changes 63 | * until they seem to be stable for a few seconds. 64 | * 65 | * It's possible a platform can only report battery percentage or time left 66 | * but not both. 67 | * 68 | * \param secs seconds of battery life left, you can pass a NULL here if you 69 | * don't care, will return -1 if we can't determine a value, or 70 | * we're not running on a battery 71 | * \param pct percentage of battery life left, between 0 and 100, you can pass 72 | * a NULL here if you don't care, will return -1 if we can't 73 | * determine a value, or we're not running on a battery 74 | * \returns an SDL_PowerState enum representing the current battery state. 75 | * 76 | * \since This function is available since SDL 2.0.0. 77 | */ 78 | extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); 79 | 80 | /* Ends C function definitions when using C++ */ 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | #include "close_code.h" 85 | 86 | #endif /* SDL_power_h_ */ 87 | 88 | /* vi: set ts=4 sw=4 expandtab: */ 89 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_quit.h 24 | * 25 | * Include file for SDL quit event handling. 26 | */ 27 | 28 | #ifndef SDL_quit_h_ 29 | #define SDL_quit_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | /** 35 | * \file SDL_quit.h 36 | * 37 | * An ::SDL_QUIT event is generated when the user tries to close the application 38 | * window. If it is ignored or filtered out, the window will remain open. 39 | * If it is not ignored or filtered, it is queued normally and the window 40 | * is allowed to close. When the window is closed, screen updates will 41 | * complete, but have no effect. 42 | * 43 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 44 | * and SIGTERM (system termination request), if handlers do not already 45 | * exist, that generate ::SDL_QUIT events as well. There is no way 46 | * to determine the cause of an ::SDL_QUIT event, but setting a signal 47 | * handler in your application will override the default generation of 48 | * quit events for that signal. 49 | * 50 | * \sa SDL_Quit() 51 | */ 52 | 53 | /* There are no functions directly affecting the quit event */ 54 | 55 | #define SDL_QuitRequested() \ 56 | (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) 57 | 58 | #endif /* SDL_quit_h_ */ 59 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_revision.h: -------------------------------------------------------------------------------- 1 | #define SDL_REVISION "https://github.com/libsdl-org/SDL.git@8c9beb0c873f6ca5efbd88f1ad2648bfc793b2ac" 2 | #define SDL_REVISION_NUMBER 0 3 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_h_ 31 | #define SDL_test_h_ 32 | 33 | #include "SDL.h" 34 | #include "SDL_test_assert.h" 35 | #include "SDL_test_common.h" 36 | #include "SDL_test_compare.h" 37 | #include "SDL_test_crc32.h" 38 | #include "SDL_test_font.h" 39 | #include "SDL_test_fuzzer.h" 40 | #include "SDL_test_harness.h" 41 | #include "SDL_test_images.h" 42 | #include "SDL_test_log.h" 43 | #include "SDL_test_md5.h" 44 | #include "SDL_test_memory.h" 45 | #include "SDL_test_random.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /* Global definitions */ 54 | 55 | /* 56 | * Note: Maximum size of SDLTest log message is less than SDL's limit 57 | * to ensure we can fit additional information such as the timestamp. 58 | */ 59 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_test_assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_assert.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Assert API for test code and test cases 33 | * 34 | */ 35 | 36 | #ifndef SDL_test_assert_h_ 37 | #define SDL_test_assert_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Fails the assert. 47 | */ 48 | #define ASSERT_FAIL 0 49 | 50 | /** 51 | * \brief Passes the assert. 52 | */ 53 | #define ASSERT_PASS 1 54 | 55 | /** 56 | * \brief Assert that logs and break execution flow on failures. 57 | * 58 | * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). 59 | * \param assertDescription Message to log with the assert describing it. 60 | */ 61 | void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); 62 | 63 | /** 64 | * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. 65 | * 66 | * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). 67 | * \param assertDescription Message to log with the assert describing it. 68 | * 69 | * \returns the assertCondition so it can be used to externally to break execution flow if desired. 70 | */ 71 | int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); 72 | 73 | /** 74 | * \brief Explicitly pass without checking an assertion condition. Updates assertion counter. 75 | * 76 | * \param assertDescription Message to log with the assert describing it. 77 | */ 78 | void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1); 79 | 80 | /** 81 | * \brief Resets the assert summary counters to zero. 82 | */ 83 | void SDLTest_ResetAssertSummary(void); 84 | 85 | /** 86 | * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. 87 | */ 88 | void SDLTest_LogAssertSummary(void); 89 | 90 | 91 | /** 92 | * \brief Converts the current assert summary state to a test result. 93 | * 94 | * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT 95 | */ 96 | int SDLTest_AssertSummaryToTestResult(void); 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | #include "close_code.h" 102 | 103 | #endif /* SDL_test_assert_h_ */ 104 | 105 | /* vi: set ts=4 sw=4 expandtab: */ 106 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_test_compare.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_compare.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines comparison functions (i.e. for surfaces). 33 | 34 | */ 35 | 36 | #ifndef SDL_test_compare_h_ 37 | #define SDL_test_compare_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "SDL_test_images.h" 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * \brief Compares a surface and with reference image data for equality 51 | * 52 | * \param surface Surface used in comparison 53 | * \param referenceSurface Test Surface used in comparison 54 | * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. 55 | * 56 | * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. 57 | */ 58 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); 59 | 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_compare_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_test_images.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_images.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines some images for tests. 33 | 34 | */ 35 | 36 | #ifndef SDL_test_images_h_ 37 | #define SDL_test_images_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "begin_code.h" 42 | /* Set up for C function definitions, even when using C++ */ 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /** 48 | *Type for test images. 49 | */ 50 | typedef struct SDLTest_SurfaceImage_s { 51 | int width; 52 | int height; 53 | unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ 54 | const char *pixel_data; 55 | } SDLTest_SurfaceImage_t; 56 | 57 | /* Test images */ 58 | SDL_Surface *SDLTest_ImageBlit(void); 59 | SDL_Surface *SDLTest_ImageBlitColor(void); 60 | SDL_Surface *SDLTest_ImageBlitAlpha(void); 61 | SDL_Surface *SDLTest_ImageBlitBlendAdd(void); 62 | SDL_Surface *SDLTest_ImageBlitBlend(void); 63 | SDL_Surface *SDLTest_ImageBlitBlendMod(void); 64 | SDL_Surface *SDLTest_ImageBlitBlendNone(void); 65 | SDL_Surface *SDLTest_ImageBlitBlendAll(void); 66 | SDL_Surface *SDLTest_ImageFace(void); 67 | SDL_Surface *SDLTest_ImagePrimitives(void); 68 | SDL_Surface *SDLTest_ImagePrimitivesBlend(void); 69 | 70 | /* Ends C function definitions when using C++ */ 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | #include "close_code.h" 75 | 76 | #endif /* SDL_test_images_h_ */ 77 | 78 | /* vi: set ts=4 sw=4 expandtab: */ 79 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_test_log.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_log.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Wrapper to log in the TEST category 33 | * 34 | */ 35 | 36 | #ifndef SDL_test_log_h_ 37 | #define SDL_test_log_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority. 47 | * 48 | * \param fmt Message to be logged 49 | */ 50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 51 | 52 | /** 53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. 54 | * 55 | * \param fmt Message to be logged 56 | */ 57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 58 | 59 | /* Ends C function definitions when using C++ */ 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #include "close_code.h" 64 | 65 | #endif /* SDL_test_log_h_ */ 66 | 67 | /* vi: set ts=4 sw=4 expandtab: */ 68 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_memory.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_memory_h_ 31 | #define SDL_test_memory_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | /** 41 | * \brief Start tracking SDL memory allocations 42 | * 43 | * \note This should be called before any other SDL functions for complete tracking coverage 44 | */ 45 | int SDLTest_TrackAllocations(void); 46 | 47 | /** 48 | * \brief Print a log of any outstanding allocations 49 | * 50 | * \note This can be called after SDL_Quit() 51 | */ 52 | void SDLTest_LogAllocations(void); 53 | 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* SDL_test_memory_h_ */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_test_random.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_random.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | A "32-bit Multiply with carry random number generator. Very fast. 33 | Includes a list of recommended multipliers. 34 | 35 | multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32. 36 | period: (a*2^31)-1 37 | 38 | */ 39 | 40 | #ifndef SDL_test_random_h_ 41 | #define SDL_test_random_h_ 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /* --- Definitions */ 50 | 51 | /* 52 | * Macros that return a random number in a specific format. 53 | */ 54 | #define SDLTest_RandomInt(c) ((int)SDLTest_Random(c)) 55 | 56 | /* 57 | * Context structure for the random number generator state. 58 | */ 59 | typedef struct { 60 | unsigned int a; 61 | unsigned int x; 62 | unsigned int c; 63 | unsigned int ah; 64 | unsigned int al; 65 | } SDLTest_RandomContext; 66 | 67 | 68 | /* --- Function prototypes */ 69 | 70 | /** 71 | * \brief Initialize random number generator with two integers. 72 | * 73 | * Note: The random sequence of numbers returned by ...Random() is the 74 | * same for the same two integers and has a period of 2^31. 75 | * 76 | * \param rndContext pointer to context structure 77 | * \param xi integer that defines the random sequence 78 | * \param ci integer that defines the random sequence 79 | * 80 | */ 81 | void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, 82 | unsigned int ci); 83 | 84 | /** 85 | * \brief Initialize random number generator based on current system time. 86 | * 87 | * \param rndContext pointer to context structure 88 | * 89 | */ 90 | void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext); 91 | 92 | 93 | /** 94 | * \brief Initialize random number generator based on current system time. 95 | * 96 | * Note: ...RandomInit() or ...RandomInitTime() must have been called 97 | * before using this function. 98 | * 99 | * \param rndContext pointer to context structure 100 | * 101 | * \returns a random number (32bit unsigned integer) 102 | * 103 | */ 104 | unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext); 105 | 106 | 107 | /* Ends C function definitions when using C++ */ 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | #include "close_code.h" 112 | 113 | #endif /* SDL_test_random_h_ */ 114 | 115 | /* vi: set ts=4 sw=4 expandtab: */ 116 | -------------------------------------------------------------------------------- /include/Windows/SDL2/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /include/Windows/SDL2/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2022 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #ifndef _begin_code_h 30 | #error close_code.h included without matching begin_code.h 31 | #endif 32 | #undef _begin_code_h 33 | 34 | /* Reset structure packing at previous byte alignment */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #pragma pack(pop) 40 | #endif /* Compiler needs structure packing set */ 41 | -------------------------------------------------------------------------------- /lib/Unix/lib/cmake/SDL2/sdl2-config-version.cmake: -------------------------------------------------------------------------------- 1 | # sdl2 cmake project-config-version input for ./configure scripts 2 | 3 | set(PACKAGE_VERSION "2.24.0") 4 | 5 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 6 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 7 | else() 8 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 9 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 10 | set(PACKAGE_VERSION_EXACT TRUE) 11 | endif() 12 | endif() 13 | -------------------------------------------------------------------------------- /lib/Unix/lib/libSDL2-2.0.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Unix/lib/libSDL2-2.0.0.dylib -------------------------------------------------------------------------------- /lib/Unix/lib/libSDL2.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Unix/lib/libSDL2.a -------------------------------------------------------------------------------- /lib/Unix/lib/libSDL2.dylib: -------------------------------------------------------------------------------- 1 | libSDL2-2.0.0.dylib -------------------------------------------------------------------------------- /lib/Unix/lib/libSDL2_test.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Unix/lib/libSDL2_test.a -------------------------------------------------------------------------------- /lib/Unix/lib/libSDL2main.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Unix/lib/libSDL2main.a -------------------------------------------------------------------------------- /lib/Unix/lib/pkgconfig/sdl2.pc: -------------------------------------------------------------------------------- 1 | # sdl pkg-config source file 2 | 3 | prefix=/opt/homebrew 4 | exec_prefix=${prefix} 5 | libdir=${exec_prefix}/lib 6 | includedir=${prefix}/include 7 | 8 | Name: sdl2 9 | Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. 10 | Version: 2.24.0 11 | Requires: 12 | Conflicts: 13 | Libs: -L${libdir} -lSDL2 14 | Libs.private: -lm -liconv -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController -Wl,-framework,ForceFeedback -lobjc -Wl,-framework,CoreVideo -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,IOKit -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal 15 | Cflags: -I${includedir} -I${includedir}/SDL2 -D_THREAD_SAFE 16 | -------------------------------------------------------------------------------- /lib/Unix/lib_image/cmake/SDL2_image/sdl2_image-config-version.cmake: -------------------------------------------------------------------------------- 1 | # sdl2_image cmake project-config-version input for ./configure scripts 2 | 3 | set(PACKAGE_VERSION "@MAJOR_VERSION_MACRO@.@MINOR_VERSION_MACRO@.@MICRO_VERSION_MACRO@") 4 | 5 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 6 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 7 | else() 8 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 9 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 10 | set(PACKAGE_VERSION_EXACT TRUE) 11 | endif() 12 | endif() 13 | 14 | -------------------------------------------------------------------------------- /lib/Unix/lib_image/libSDL2_image-2.0.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Unix/lib_image/libSDL2_image-2.0.0.dylib -------------------------------------------------------------------------------- /lib/Unix/lib_image/libSDL2_image.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Unix/lib_image/libSDL2_image.a -------------------------------------------------------------------------------- /lib/Unix/lib_image/libSDL2_image.dylib: -------------------------------------------------------------------------------- 1 | libSDL2_image-2.0.0.dylib -------------------------------------------------------------------------------- /lib/Unix/lib_image/pkgconfig/SDL2_image.pc: -------------------------------------------------------------------------------- 1 | prefix=/opt/homebrew 2 | exec_prefix=${prefix} 3 | libdir=/opt/homebrew/Cellar/sdl2_image/2.6.2/lib 4 | includedir=${prefix}/include 5 | 6 | Name: SDL2_image 7 | Description: image loading library for Simple DirectMedia Layer 8 | Version: 2.6.2 9 | Requires: sdl2 >= 2.0.9 10 | Libs: -L${libdir} -lSDL2_image 11 | Requires.private: libpng libjpeg libtiff-4 libwebp 12 | Libs.private: 13 | Cflags: -I${includedir}/SDL2 14 | 15 | -------------------------------------------------------------------------------- /lib/Unix/lib_mixer/cmake/SDL2_mixer/sdl2_mixer-config-version.cmake: -------------------------------------------------------------------------------- 1 | # sdl2_mixer cmake project-config-version input for ./configure scripts 2 | 3 | set(PACKAGE_VERSION "2.6.2") 4 | 5 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 6 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 7 | else() 8 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 9 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 10 | set(PACKAGE_VERSION_EXACT TRUE) 11 | endif() 12 | endif() 13 | -------------------------------------------------------------------------------- /lib/Unix/lib_mixer/libSDL2_mixer-2.0.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Unix/lib_mixer/libSDL2_mixer-2.0.0.dylib -------------------------------------------------------------------------------- /lib/Unix/lib_mixer/libSDL2_mixer.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Unix/lib_mixer/libSDL2_mixer.a -------------------------------------------------------------------------------- /lib/Unix/lib_mixer/libSDL2_mixer.dylib: -------------------------------------------------------------------------------- 1 | libSDL2_mixer-2.0.0.dylib -------------------------------------------------------------------------------- /lib/Unix/lib_mixer/pkgconfig/SDL2_mixer.pc: -------------------------------------------------------------------------------- 1 | prefix=/opt/homebrew 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: SDL2_mixer 7 | Description: mixer library for Simple DirectMedia Layer 8 | Version: 2.6.2 9 | Requires: sdl2 >= 2.0.9 10 | Libs: -L${libdir} -lSDL2_mixer 11 | Cflags: -I${includedir}/SDL2 12 | Requires.private: libmodplug libmpg123 13 | Libs.private: -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,CoreServices 14 | -------------------------------------------------------------------------------- /lib/Unix/lib_ttf/cmake/SDL2_ttf/sdl2_ttf-config-version.cmake: -------------------------------------------------------------------------------- 1 | # sdl2_ttf cmake project-config-version input for ./configure scripts 2 | 3 | set(PACKAGE_VERSION "2.20.1") 4 | 5 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 6 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 7 | else() 8 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 9 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 10 | set(PACKAGE_VERSION_EXACT TRUE) 11 | endif() 12 | endif() 13 | -------------------------------------------------------------------------------- /lib/Unix/lib_ttf/cmake/SDL2_ttf/sdl2_ttf-config.cmake: -------------------------------------------------------------------------------- 1 | # sdl2_ttf cmake project-config input for ./configure scripts 2 | 3 | include(FeatureSummary) 4 | set_package_properties(SDL2_ttf PROPERTIES 5 | URL "https://www.libsdl.org/projects/SDL_ttf/" 6 | DESCRIPTION "Support for TrueType (.ttf) font files with Simple Directmedia Layer" 7 | ) 8 | 9 | set(SDL2_ttf_FOUND TRUE) 10 | 11 | set(SDL2TTF_HARFBUZZ 1) 12 | set(SDL2TTF_FREETYPE TRUE) 13 | 14 | set(SDL2TTF_VENDORED 0) 15 | 16 | set(SDL2TTF_SDL2_REQUIRED_VERSION 2.0.10) 17 | 18 | get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) 19 | set(exec_prefix "${prefix}") 20 | set(bindir "${exec_prefix}/bin") 21 | set(includedir "${prefix}/include") 22 | set(libdir "/opt/homebrew/Cellar/sdl2_ttf/2.20.1/lib") 23 | set(_sdl2ttf_extra_static_libraries " -L/opt/homebrew/opt/freetype/lib -lfreetype -L/opt/homebrew/Cellar/harfbuzz/5.1.0/lib -lharfbuzz ") 24 | string(STRIP "${_sdl2ttf_extra_static_libraries}" _sdl2ttf_extra_static_libraries) 25 | 26 | set(_sdl2ttf_bindir "${bindir}") 27 | set(_sdl2ttf_libdir "${libdir}") 28 | set(_sdl2ttf_incdir "${includedir}/SDL2") 29 | 30 | # Convert _sdl2ttf_extra_static_libraries to list and keep only libraries 31 | string(REGEX MATCHALL "(-[lm]([-a-zA-Z0-9._]+))|(-Wl,[^ ]*framework[^ ]*)" _sdl2ttf_extra_static_libraries "${_sdl2ttf_extra_static_libraries}") 32 | string(REGEX REPLACE "^-l" "" _sdl2ttf_extra_static_libraries "${_sdl2ttf_extra_static_libraries}") 33 | string(REGEX REPLACE ";-l" ";" _sdl2ttf_extra_static_libraries "${_sdl2ttf_extra_static_libraries}") 34 | 35 | unset(prefix) 36 | unset(exec_prefix) 37 | unset(bindir) 38 | unset(includedir) 39 | unset(libdir) 40 | 41 | include(CMakeFindDependencyMacro) 42 | 43 | if(NOT TARGET SDL2_ttf::SDL2_ttf) 44 | if(WIN32) 45 | set(_sdl2ttf_dll "${_sdl2ttf_bindir}/SDL2_ttf.dll") 46 | set(_sdl2ttf_imp "${_sdl2ttf_libdir}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2_ttf.dll${CMAKE_STATIC_LIBRARY_SUFFIX}") 47 | if(EXISTS "${_sdl2ttf_dll}" AND EXISTS "${_sdl2ttf_imp}") 48 | add_library(SDL2_ttf::SDL2_ttf SHARED IMPORTED) 49 | set_target_properties(SDL2_ttf::SDL2_ttf 50 | PROPERTIES 51 | IMPORTED_LOCATION "${_sdl2ttf_dll}" 52 | IMPORTED_IMPLIB "${_sdl2ttf_imp}" 53 | ) 54 | endif() 55 | unset(_sdl2ttf_dll) 56 | unset(_sdl2ttf_imp) 57 | else() 58 | set(_sdl2ttf_shl "${_sdl2ttf_libdir}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2_ttf${CMAKE_SHARED_LIBRARY_SUFFIX}") 59 | if(EXISTS "${_sdl2ttf_shl}") 60 | add_library(SDL2_ttf::SDL2_ttf SHARED IMPORTED) 61 | set_target_properties(SDL2_ttf::SDL2_ttf 62 | PROPERTIES 63 | IMPORTED_LOCATION "${_sdl2ttf_shl}" 64 | ) 65 | endif() 66 | endif() 67 | if(TARGET SDL2_ttf::SDL2_ttf) 68 | set_target_properties(SDL2_ttf::SDL2_ttf 69 | PROPERTIES 70 | INTERFACE_INCLUDE_DIRECTORIES "${_sdl2ttf_incdir}" 71 | COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED" 72 | INTERFACE_SDL2_SHARED "ON" 73 | ) 74 | endif() 75 | endif() 76 | 77 | if(NOT TARGET SDL2_ttf::SDL2_ttf-static) 78 | set(_sdl2ttf_stl "${_sdl2ttf_libdir}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2_ttf${CMAKE_STATIC_LIBRARY_SUFFIX}") 79 | if(EXISTS "${_sdl2ttf_stl}") 80 | add_library(SDL2_ttf::SDL2_ttf-static STATIC IMPORTED) 81 | set_target_properties(SDL2_ttf::SDL2_ttf-static 82 | PROPERTIES 83 | INTERFACE_INCLUDE_DIRECTORIES "${_sdl2ttf_incdir}" 84 | IMPORTED_LOCATION "${_sdl2ttf_stl}" 85 | INTERFACE_LINK_LIBRARIES "${_sdl2ttf_extra_static_libraries}" 86 | ) 87 | endif() 88 | unset(_sdl2ttf_stl) 89 | endif() 90 | 91 | unset(_sdl2ttf_extra_static_libraries) 92 | unset(_sdl2ttf_bindir) 93 | unset(_sdl2ttf_libdir) 94 | unset(_sdl2ttf_incdir) 95 | -------------------------------------------------------------------------------- /lib/Unix/lib_ttf/libSDL2_ttf-2.0.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Unix/lib_ttf/libSDL2_ttf-2.0.0.dylib -------------------------------------------------------------------------------- /lib/Unix/lib_ttf/libSDL2_ttf.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Unix/lib_ttf/libSDL2_ttf.a -------------------------------------------------------------------------------- /lib/Unix/lib_ttf/libSDL2_ttf.dylib: -------------------------------------------------------------------------------- 1 | libSDL2_ttf-2.0.0.dylib -------------------------------------------------------------------------------- /lib/Unix/lib_ttf/pkgconfig/SDL2_ttf.pc: -------------------------------------------------------------------------------- 1 | prefix=/opt/homebrew 2 | exec_prefix=${prefix} 3 | libdir=/opt/homebrew/Cellar/sdl2_ttf/2.20.1/lib 4 | includedir=${prefix}/include 5 | 6 | Name: SDL2_ttf 7 | Description: ttf library for Simple DirectMedia Layer with FreeType 2 support 8 | Version: 2.20.1 9 | Requires: sdl2 >= 2.0.10 10 | Libs: -L${libdir} -lSDL2_ttf 11 | Cflags: -I${includedir}/SDL2 12 | Requires.private: harfbuzz freetype2 13 | Libs.private: 14 | -------------------------------------------------------------------------------- /lib/Windows/lib/LICENSE.harfbuzz.txt: -------------------------------------------------------------------------------- 1 | HarfBuzz is licensed under the so-called "Old MIT" license. Details follow. 2 | For parts of HarfBuzz that are licensed under different licenses see individual 3 | files names COPYING in subdirectories where applicable. 4 | 5 | Copyright © 2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 Google, Inc. 6 | Copyright © 2018,2019,2020 Ebrahim Byagowi 7 | Copyright © 2019,2020 Facebook, Inc. 8 | Copyright © 2012 Mozilla Foundation 9 | Copyright © 2011 Codethink Limited 10 | Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies) 11 | Copyright © 2009 Keith Stribley 12 | Copyright © 2009 Martin Hosken and SIL International 13 | Copyright © 2007 Chris Wilson 14 | Copyright © 2006 Behdad Esfahbod 15 | Copyright © 2005 David Turner 16 | Copyright © 2004,2007,2008,2009,2010 Red Hat, Inc. 17 | Copyright © 1998-2004 David Turner and Werner Lemberg 18 | 19 | For full copyright notices consult the individual files in the package. 20 | 21 | 22 | Permission is hereby granted, without written agreement and without 23 | license or royalty fees, to use, copy, modify, and distribute this 24 | software and its documentation for any purpose, provided that the 25 | above copyright notice and the following two paragraphs appear in 26 | all copies of this software. 27 | 28 | IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 29 | DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 30 | ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 31 | IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 32 | DAMAGE. 33 | 34 | THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 35 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 36 | FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 37 | ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 38 | PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 39 | -------------------------------------------------------------------------------- /lib/Windows/lib/LICENSE.modplug.txt: -------------------------------------------------------------------------------- 1 | The source code to this library used with SDL_mixer can be found here: 2 | https://hg.libsdl.org/SDL_mixer/file/default/external 3 | --- 4 | 5 | ModPlug-XMMS and libmodplug are now in the public domain. 6 | -------------------------------------------------------------------------------- /lib/Windows/lib/LICENSE.ogg-vorbis.txt: -------------------------------------------------------------------------------- 1 | The source code to this library used with SDL_mixer can be found here: 2 | https://hg.libsdl.org/SDL_mixer/file/default/external 3 | --- 4 | 5 | Copyright (c) 2002-2018 Xiph.org Foundation 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 26 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /lib/Windows/lib/LICENSE.opus.txt: -------------------------------------------------------------------------------- 1 | The source code to this library used with SDL_mixer can be found here: 2 | https://hg.libsdl.org/SDL_mixer/file/default/external 3 | --- 4 | 5 | Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic, 6 | Jean-Marc Valin, Timothy B. Terriberry, 7 | CSIRO, Gregory Maxwell, Mark Borgerding, 8 | Erik de Castro Lopo 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 14 | - Redistributions of source code must retain the above copyright 15 | notice, this list of conditions and the following disclaimer. 16 | 17 | - Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | 21 | - Neither the name of Internet Society, IETF or IETF Trust, nor the 22 | names of specific contributors, may be used to endorse or promote 23 | products derived from this software without specific prior written 24 | permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 30 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 31 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 32 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 33 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 34 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | Opus is subject to the royalty-free patent licenses which are 39 | specified at: 40 | 41 | Xiph.Org Foundation: 42 | https://datatracker.ietf.org/ipr/1524/ 43 | 44 | Microsoft Corporation: 45 | https://datatracker.ietf.org/ipr/1914/ 46 | 47 | Broadcom Corporation: 48 | https://datatracker.ietf.org/ipr/1526/ 49 | -------------------------------------------------------------------------------- /lib/Windows/lib/LICENSE.opusfile.txt: -------------------------------------------------------------------------------- 1 | The source code to this library used with SDL_mixer can be found here: 2 | https://hg.libsdl.org/SDL_mixer/file/default/external 3 | --- 4 | 5 | Copyright (c) 1994-2013 Xiph.Org Foundation and contributors 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | - Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | - Neither the name of the Xiph.Org Foundation nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 26 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /lib/Windows/lib/LICENSE.tiff.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 1988-1997 Sam Leffler 2 | Copyright (c) 1991-1997 Silicon Graphics, Inc. 3 | 4 | Permission to use, copy, modify, distribute, and sell this software and 5 | its documentation for any purpose is hereby granted without fee, provided 6 | that (i) the above copyright notices and this permission notice appear in 7 | all copies of the software and related documentation, and (ii) the names of 8 | Sam Leffler and Silicon Graphics may not be used in any advertising or 9 | publicity relating to the software without the specific, prior written 10 | permission of Sam Leffler and Silicon Graphics. 11 | 12 | THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 13 | EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 14 | WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 17 | ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 18 | OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 19 | WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 20 | LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 21 | OF THIS SOFTWARE. 22 | -------------------------------------------------------------------------------- /lib/Windows/lib/LICENSE.webp.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Google Inc. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the 13 | distribution. 14 | 15 | * Neither the name of Google nor the names of its contributors may 16 | be used to endorse or promote products derived from this software 17 | without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | -------------------------------------------------------------------------------- /lib/Windows/lib/LICENSE.zlib.txt: -------------------------------------------------------------------------------- 1 | The source code to this library used with SDL_ttf can be found here: 2 | https://github.com/libsdl-org/SDL_ttf/tree/main/external 3 | --- 4 | 5 | Copyright notice: 6 | 7 | (C) 1995-2010 Jean-loup Gailly and Mark Adler 8 | 9 | This software is provided 'as-is', without any express or implied 10 | warranty. In no event will the authors be held liable for any damages 11 | arising from the use of this software. 12 | 13 | Permission is granted to anyone to use this software for any purpose, 14 | including commercial applications, and to alter it and redistribute it 15 | freely, subject to the following restrictions: 16 | 17 | 1. The origin of this software must not be misrepresented; you must not 18 | claim that you wrote the original software. If you use this software 19 | in a product, an acknowledgment in the product documentation would be 20 | appreciated but is not required. 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 3. This notice may not be removed or altered from any source distribution. 24 | 25 | Jean-loup Gailly Mark Adler 26 | jloup@gzip.org madler@alumni.caltech.edu 27 | 28 | If you use the zlib library in a product, we would appreciate *not* receiving 29 | lengthy legal documents to sign. The sources are provided for free but without 30 | warranty of any kind. The library has been entirely written by Jean-loup 31 | Gailly and Mark Adler; it does not include third-party code. 32 | -------------------------------------------------------------------------------- /lib/Windows/lib/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/SDL2.dll -------------------------------------------------------------------------------- /lib/Windows/lib/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/SDL2.lib -------------------------------------------------------------------------------- /lib/Windows/lib/SDL2_image.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/SDL2_image.lib -------------------------------------------------------------------------------- /lib/Windows/lib/SDL2_mixer.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/SDL2_mixer.lib -------------------------------------------------------------------------------- /lib/Windows/lib/SDL2_ttf.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/SDL2_ttf.lib -------------------------------------------------------------------------------- /lib/Windows/lib/SDL2main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/SDL2main.lib -------------------------------------------------------------------------------- /lib/Windows/lib/SDL2test.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/SDL2test.lib -------------------------------------------------------------------------------- /lib/Windows/lib/libmodplug-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/libmodplug-1.dll -------------------------------------------------------------------------------- /lib/Windows/lib/libogg-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/libogg-0.dll -------------------------------------------------------------------------------- /lib/Windows/lib/libopus-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/libopus-0.dll -------------------------------------------------------------------------------- /lib/Windows/lib/libopusfile-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/libopusfile-0.dll -------------------------------------------------------------------------------- /lib/Windows/lib/libtiff-5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/libtiff-5.dll -------------------------------------------------------------------------------- /lib/Windows/lib/libwebp-7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feather-game-engine/feather/547390fabbfe814aa84d0a8f6824bb85f52683ad/lib/Windows/lib/libwebp-7.dll --------------------------------------------------------------------------------