├── .gitattributes ├── .github └── workflows │ └── doxygen.yml ├── .gitignore ├── .gitmodules ├── .vscode ├── c_cpp_properties.json ├── launch.json ├── settings.json └── tasks.json ├── BUILDING.md ├── CMakeLists.txt ├── Doxyfile ├── Makefile ├── README.md ├── assets ├── images │ ├── logo │ │ ├── logo.png │ │ ├── logoBlue.png │ │ ├── logoC.png │ │ ├── logoCyan.png │ │ ├── logoGreen.png │ │ ├── logoRed.png │ │ └── logoYellow.png │ └── ui │ │ └── cursor.png └── sounds │ ├── flixel.mp3 │ └── flixel.ogg ├── examples ├── Makefile ├── State.hpp ├── assets │ ├── Saul.png │ └── troll.png ├── main.cpp └── to check memory leaks.txt ├── include └── flixel++ │ ├── Common.hpp │ ├── FlxAnimation.hpp │ ├── FlxAssets.hpp │ ├── FlxBackends.hpp │ ├── FlxBasic.hpp │ ├── FlxColor.hpp │ ├── FlxG.hpp │ ├── FlxGame.hpp │ ├── FlxGraphic.hpp │ ├── FlxGroup.hpp │ ├── FlxHttp.hpp │ ├── FlxKeyboard.hpp │ ├── FlxLog.hpp │ ├── FlxMacros.hpp │ ├── FlxManagers.hpp │ ├── FlxMouse.hpp │ ├── FlxNet.hpp │ ├── FlxObject.hpp │ ├── FlxPoint.hpp │ ├── FlxRect.hpp │ ├── FlxScript.hpp │ ├── FlxSound.hpp │ ├── FlxSplash.hpp │ ├── FlxSprite.hpp │ ├── FlxState.hpp │ ├── FlxText.hpp │ ├── FlxUtils.hpp │ ├── SDL_Backports.hpp │ └── platform │ ├── 3ds.h │ ├── pc.h │ ├── platform.h │ └── wii.h ├── mk ├── 3ds.mk ├── FindGLEW.cmake ├── FindGLFW.cmake ├── FindLibVorbisfile.cmake ├── FindSDL2_image.cmake ├── FindSDL2_ttf.cmake ├── FindSDL_image.cmake ├── FindSDL_ttf.cmake ├── FindSOIL.cmake ├── pc.mk ├── switch.mk └── wii.mk ├── source ├── FlxAnimation.cpp ├── FlxAssets.cpp ├── FlxBackends.cpp ├── FlxBasic.cpp ├── FlxColor.cpp ├── FlxGame.cpp ├── FlxGraphic.cpp ├── FlxGroup.cpp ├── FlxHttp.cpp ├── FlxKeyboard.cpp ├── FlxLog.cpp ├── FlxManagers.cpp ├── FlxMouse.cpp ├── FlxNet.cpp ├── FlxObject.cpp ├── FlxPoint.cpp ├── FlxRect.cpp ├── FlxScript.cpp ├── FlxSound.cpp ├── FlxSplash.cpp ├── FlxSprite.cpp ├── FlxState.cpp ├── FlxText.cpp ├── FlxUtils.cpp ├── SDL_Backports.cpp └── assets │ ├── cursor.h │ ├── flixel.h │ ├── logoBlue.h │ ├── logoC.h │ ├── logoCyan.h │ ├── logoGreen.h │ ├── logoRed.h │ ├── logoYellow.h │ └── vcr.h └── workflows └── doxygen.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | source/assets/* linguist-vendored 2 | mk/*.cmake linguist-vendored -------------------------------------------------------------------------------- /.github/workflows/doxygen.yml: -------------------------------------------------------------------------------- 1 | name: Doxygen GitHub Pages Deploy Action 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | deploy: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: DenverCoder1/doxygen-github-pages-action@v1.2.0 13 | with: 14 | github_token: ${{ secrets.GITHUB_TOKEN }} 15 | branch: gh-pages 16 | folder: docs/html 17 | config_file: Doxyfile 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | obj/ 2 | build/ 3 | include/flixel++/Test.hpp 4 | source/main.cpp 5 | release/ 6 | debug/ 7 | examples/example 8 | .vscode/*.log -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "bundles/tinyxml2"] 2 | path = bundles/tinyxml2 3 | url = https://github.com/leethomason/tinyxml2 4 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Linux", 5 | "includePath": [ 6 | "${workspaceFolder}/include", 7 | "/opt/devkitpro/portlibs/ppc/include", 8 | "/opt/devkitpro/libctru/include" 9 | ], 10 | "defines": ["FLIXEL_SDL"], 11 | "compilerPath": "/usr/bin/clang", 12 | "cStandard": "c17", 13 | "cppStandard": "c++14", 14 | "intelliSenseMode": "linux-clang-x64", 15 | "configurationProvider": "ms-vscode.makefile-tools" 16 | } 17 | ], 18 | "version": 4 19 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "(gdb) Launch", 9 | "type": "cppdbg", 10 | "request": "launch", 11 | "program": "${workspaceFolder}/examples/example", 12 | "args": [], 13 | "stopAtEntry": false, 14 | "cwd": "${workspaceFolder}", 15 | "environment": [{ 16 | "name": "LD_LIBRARY_PATH", 17 | "value": "${workspaceFolder}/build" 18 | }], 19 | "externalConsole": false, 20 | "MIMode": "gdb", 21 | "setupCommands": [ 22 | { 23 | "description": "Enable pretty-printing for gdb", 24 | "text": "-enable-pretty-printing", 25 | "ignoreFailures": true 26 | }, 27 | { 28 | "description": "Set Disassembly Flavor to Intel", 29 | "text": "-gdb-set disassembly-flavor intel", 30 | "ignoreFailures": true 31 | } 32 | ] 33 | } 34 | 35 | ] 36 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "makefile.extensionOutputFolder": "./.vscode", 3 | "files.associations": { 4 | "ostream": "cpp", 5 | "*.tcc": "cpp", 6 | "cctype": "cpp", 7 | "clocale": "cpp", 8 | "cmath": "cpp", 9 | "compare": "cpp", 10 | "concepts": "cpp", 11 | "cstdint": "cpp", 12 | "cstdio": "cpp", 13 | "cstdlib": "cpp", 14 | "cwchar": "cpp", 15 | "cwctype": "cpp", 16 | "map": "cpp", 17 | "vector": "cpp", 18 | "exception": "cpp", 19 | "initializer_list": "cpp", 20 | "iosfwd": "cpp", 21 | "iostream": "cpp", 22 | "istream": "cpp", 23 | "limits": "cpp", 24 | "new": "cpp", 25 | "numbers": "cpp", 26 | "stdexcept": "cpp", 27 | "streambuf": "cpp", 28 | "string": "cpp", 29 | "string_view": "cpp", 30 | "system_error": "cpp", 31 | "tuple": "cpp", 32 | "type_traits": "cpp", 33 | "typeinfo": "cpp", 34 | "array": "cpp", 35 | "bit": "cpp", 36 | "unordered_map": "cpp", 37 | "functional": "cpp", 38 | "numeric": "cpp", 39 | "utility": "cpp" 40 | }, 41 | "cmake.configureOnOpen": true 42 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasks": [ 3 | { 4 | "type": "cppbuild", 5 | "label": "C/C++: g++ build active file", 6 | "command": "/usr/bin/g++", 7 | "args": [ 8 | "-fdiagnostics-color=always", 9 | "-g", 10 | "${file}", 11 | "-o", 12 | "${fileDirname}/${fileBasenameNoExtension}" 13 | ], 14 | "options": { 15 | "cwd": "${fileDirname}" 16 | }, 17 | "problemMatcher": [ 18 | "$gcc" 19 | ], 20 | "group": { 21 | "kind": "build", 22 | "isDefault": true 23 | }, 24 | "detail": "Task generated by Debugger." 25 | } 26 | ], 27 | "version": "2.0.0" 28 | } -------------------------------------------------------------------------------- /BUILDING.md: -------------------------------------------------------------------------------- 1 | # PC 2 | ## Linux 3 | You will need the following dependencies: 4 | - SDL2 5 | - SDL2_image 6 | - SDL2_ttf 7 | - OpenAL 8 | - libvorbis 9 | - gcc 10 | - make 11 | - cmake 12 | 13 | 1. Run ``make pc`` 14 | 1.1. Run ``make pc PLATFORM=1`` for compiling with SDL 1.2 15 | 1.2. Run ``make pc PLATFORM=2`` for compiling with SDL 2 16 | 1.3. Run ``make pc PLATFORM=3`` for compiling with SDL 2 and OpenGL 17 | 18 | 2. Run ``make install`` (with root permissions) 19 | 20 | After installing, libflixel++.so will be placed in /usr/lib/ and the neccessary headers will be placed in /usr/include/flixel++ 21 | 22 | To change the framework(s): 23 | 1. Run ``make uninstall`` (if did make install) 24 | 2. Run ``make clean`` 25 | 3. Follow the instructions above 26 | 27 | ## Windows 28 | Should theoretically support Windows? 29 | 30 | # Consoles 31 | ## Nintendo Switch (WIP) 32 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/mk") 4 | 5 | set(CMAKE_DEBUG_POSTFIX d) 6 | set(CMAKE_CXX_FLAGS_RELEASE "-O3") 7 | 8 | message(STATUS "Source dir: ${CMAKE_SOURCE_DIR}") 9 | 10 | project(flixel++, VERSION 0.1.0) 11 | include_directories("include/") 12 | include_directories("bundles/tinyxml2/") 13 | file (GLOB_RECURSE FLIXEL_FILES CONFIGURE_DEPENDS "source/*.cpp" "bundles/tinyxml2/tinyxml2.cpp") 14 | 15 | if(DEFINED SDL_LEGACY) 16 | add_definitions(-DSDL_LEGACY) 17 | find_package(SDL_image REQUIRED) 18 | include_directories(${SDLIMAGE_INCLUDE_DIRS}) 19 | 20 | find_package(SDL_ttf REQUIRED) 21 | include_directories(${SDLTTF_INCLUDE_DIRS}) 22 | 23 | find_package(SDL REQUIRED) 24 | include_directories(${SDL_INCLUDE_DIRS}) 25 | endif() 26 | if(DEFINED SDL) 27 | find_package(SDL2_image REQUIRED) 28 | include_directories(${SDL2IMAGE_INCLUDE_DIRS}) 29 | 30 | find_package(SDL2_ttf REQUIRED) 31 | include_directories(${SDL2TTF_INCLUDE_DIRS}) 32 | 33 | find_package(SDL2 REQUIRED) 34 | include_directories(${SDL2_INCLUDE_DIRS}) 35 | endif() 36 | if(DEFINED OPENGL) 37 | find_package(SDL2 REQUIRED) 38 | include_directories(${SDL2_INCLUDE_DIRS}) 39 | 40 | find_package(OpenGL REQUIRED) 41 | 42 | find_package(glfw3 3.3 REQUIRED) 43 | include_directories(${GLFW_INCLUDE_DIRS}) 44 | 45 | find_package(SOIL REQUIRED) 46 | include_directories(${SOIL_INCLUDE_DIRS}) 47 | 48 | find_package(GLEW REQUIRED) 49 | include_directories(${GLEW_INCLUDE_DIRS}) 50 | endif() 51 | 52 | 53 | find_package(CURL REQUIRED) 54 | include_directories(${CURL_INCLUDE_DIRS}) 55 | 56 | find_package(OpenAL REQUIRED) 57 | include_directories(${OPENAL_INCLUDE_DIR}) 58 | 59 | find_package(LibVorbisfile REQUIRED) 60 | include_directories(${VORBIS_INCLUDE_DIR}) 61 | 62 | find_package(CURL REQUIRED) 63 | include_directories(${CURL_INCLUDE_DIR}) 64 | 65 | add_library(flixel++ SHARED ${FLIXEL_FILES}) 66 | 67 | if(DEFINED SDL_LEGACY) 68 | target_link_libraries(flixel++ ${SDL_LIBRARIES}) 69 | target_link_libraries(flixel++ ${SDL_IMAGE_LIBRARIES}) 70 | target_link_libraries(flixel++ ${SDL_TTF_LIBRARIES}) 71 | endif() 72 | if(DEFINED SDL) 73 | target_link_libraries(flixel++ ${SDL2_LIBRARIES}) 74 | target_link_libraries(flixel++ ${SDL2_IMAGE_LIBRARIES}) 75 | target_link_libraries(flixel++ ${SDL2_TTF_LIBRARIES}) 76 | endif() 77 | if(DEFINED OPENGL) 78 | target_link_libraries(flixel++ ${SDL2_LIBRARIES}) 79 | target_link_libraries(flixel++ ${GLEW_LIBRARIES}) 80 | target_link_libraries(flixel++ ${OPENGL_LIBRARY}) 81 | target_link_libraries(flixel++ ${GLFW_LIBRARY}) 82 | target_link_libraries(flixel++ ${SOIL_LIBRARY}) 83 | endif() 84 | 85 | 86 | target_link_libraries(flixel++ ${CURL_LIBRARIES}) 87 | target_link_libraries(flixel++ ${OPENAL_LIBRARY}) 88 | target_link_libraries(flixel++ ${VORBISFILE_LIBRARY}) 89 | target_link_libraries(flixel++ ${CURL_LIBRARY}) 90 | 91 | install(TARGETS flixel++ DESTINATION lib) 92 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | all: 3 | @echo "Specify what platform you want to build" 4 | pc: 5 | ifeq ($(PLATFORM),1) 6 | @mkdir -p build 7 | @cd build && cmake -DSDL_LEGACY=1 .. && make 8 | 9 | else ifeq ($(PLATFORM),2) 10 | @mkdir -p build 11 | @cd build && cmake -DSDL=1 .. && make 12 | 13 | else ifeq ($(PLATFORM),3) 14 | @mkdir -p build 15 | @cd build && cmake -DOPENGL=1 .. && make 16 | 17 | 18 | endif 19 | 20 | install: 21 | rm -rf /usr/include/flixel++ 22 | rm -rf /usr/lib/libflixel++.so 23 | cp -r include/flixel++/ /usr/include 24 | cp -r build/libflixel++.so /usr/lib/libflixel++.so 25 | uninstall: 26 | rm -rf /usr/include/flixel++ 27 | rm -rf /usr/lib/libflixel++.so 28 | switch: 29 | @mkdir -p build/switch 30 | @make -f mk/switch.mk 31 | 3ds: 32 | @mkdir -p build/3ds 33 | @make -f mk/3ds.mk 34 | wii: 35 | @mkdir -p build/wii 36 | @make -f mk/wii.mk 37 | clean: 38 | rm -rf build/ 39 | rm -rf obj/ 40 | @make -f mk/switch.mk clean 41 | example: 42 | @make -f examples/Makefile 43 | LD_LIBRARY_PATH="./build/" examples/example -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 |

5 | GitHub contributors 6 | GitHub commit activity 7 | GitHub branch checks state 8 | 9 | Discord 10 | 11 |

12 | 13 | # flixel++ 14 | 15 | flixel++ is a port of Adam "Atomic" Saltsman's Flixel library originally created for ActionScript 3. 16 | 17 | flixel++ is a work in progess, things might change or break. 18 | 19 | ## Cloning 20 | Make sure you clone with submodules OR it will not work as the needed submodules are not there. 21 | 22 | ``` 23 | git clone --recursive https://github.com/coolfren/flixelplusplus 24 | ``` 25 | 26 | If you already cloned it: 27 | ``` 28 | git submodule update --init --recursive 29 | ``` 30 | ## Building 31 | Refer to BUILDING.md for instructions. 32 | -------------------------------------------------------------------------------- /assets/images/logo/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/assets/images/logo/logo.png -------------------------------------------------------------------------------- /assets/images/logo/logoBlue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/assets/images/logo/logoBlue.png -------------------------------------------------------------------------------- /assets/images/logo/logoC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/assets/images/logo/logoC.png -------------------------------------------------------------------------------- /assets/images/logo/logoCyan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/assets/images/logo/logoCyan.png -------------------------------------------------------------------------------- /assets/images/logo/logoGreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/assets/images/logo/logoGreen.png -------------------------------------------------------------------------------- /assets/images/logo/logoRed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/assets/images/logo/logoRed.png -------------------------------------------------------------------------------- /assets/images/logo/logoYellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/assets/images/logo/logoYellow.png -------------------------------------------------------------------------------- /assets/images/ui/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/assets/images/ui/cursor.png -------------------------------------------------------------------------------- /assets/sounds/flixel.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/assets/sounds/flixel.mp3 -------------------------------------------------------------------------------- /assets/sounds/flixel.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/assets/sounds/flixel.ogg -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | g++ examples/main.cpp -Lbuild/ -lflixel++ -o examples/example -Iexamples/ -Iinclude/ -O3 3 | 4 | -------------------------------------------------------------------------------- /examples/State.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "flixel++/FlxState.hpp" 3 | #include "flixel++/FlxSprite.hpp" 4 | #include "flixel++/FlxAssets.hpp" 5 | #include "flixel++/FlxSound.hpp" 6 | #include "flixel++/FlxNet.hpp" 7 | #include "flixel++/FlxG.hpp" 8 | #include "flixel++/FlxText.hpp" 9 | #include "flixel++/FlxMacros.hpp" 10 | #include "flixel++/FlxHttp.hpp" 11 | class PlayState : public Flx::State 12 | { 13 | public: 14 | PlayState(){}; 15 | ~PlayState(){}; 16 | Flx::Sprite *sprite; 17 | Flx::Text *text; 18 | Flx::Http *http; 19 | Flx::Sound* flixelSound; 20 | 21 | float time = 0.0f; 22 | float offsetX = 0.0f, offsetY = 0.0f; 23 | void create() 24 | { 25 | http = new Flx::Http("https://pastebin.com/raw/j9cs4GWP"); 26 | trace(http->storage); 27 | 28 | sprite = new Flx::Sprite(0, 0); 29 | if (http->storage == "saul goodman") 30 | { 31 | sprite->loadGraphic("examples/assets/Saul.png"); 32 | sprite->setGraphicSize(800, 800); 33 | } 34 | else 35 | { 36 | sprite->loadGraphic("assets/images/logo/logo.png"); 37 | sprite->setGraphicSize(240, 240); 38 | } 39 | 40 | sprite->screenCenter(); 41 | add(sprite); 42 | 43 | text = new Flx::Text(0, 100, "i am a piece of text!"); 44 | if (http->storage == "saul goodman") 45 | { 46 | text->screenCenter(); 47 | text->setText(http->storage + " V1.0"); 48 | } 49 | else 50 | { 51 | text->x = (Flx::Globals::width / 2); 52 | text->setText("i am a piece of new text!"); 53 | } 54 | add(text); 55 | 56 | if (http->storage == "saul goodman") 57 | { 58 | Flx::Globals::mouse->loadGraphic("examples/assets/troll.png"); 59 | } 60 | 61 | flixelSound = new Flx::Sound(); 62 | flixelSound->load("assets/sounds/flixel.ogg"); 63 | flixelSound->play(); 64 | 65 | }; 66 | virtual void update() 67 | { 68 | sprite->x += cos(time) + offsetX * 2; 69 | sprite->y += sin(time) + offsetY * 2; 70 | text->x -= cos(time) - offsetX * 2; 71 | text->y -= sin(time) - offsetY * 2; 72 | 73 | time += 0.05f; 74 | 75 | Flx::State::update(); 76 | } 77 | }; -------------------------------------------------------------------------------- /examples/assets/Saul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/examples/assets/Saul.png -------------------------------------------------------------------------------- /examples/assets/troll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolfren/flixelplusplus/f0e4638a816e55086950d4adfe7c8cd442c6fceb/examples/assets/troll.png -------------------------------------------------------------------------------- /examples/main.cpp: -------------------------------------------------------------------------------- 1 | #include "State.hpp" 2 | #include "flixel++/FlxGame.hpp" 3 | 4 | int main(int argc, char** argv) 5 | { 6 | Flx::Game* game = new Flx::Game("Flixel++", 640, 480, 60.0f, new PlayState(), false); 7 | game->start(); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /examples/to check memory leaks.txt: -------------------------------------------------------------------------------- 1 | valgrind --tool=memcheck -s ls -lflixel++ ./examples/example -------------------------------------------------------------------------------- /include/flixel++/Common.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_HPP 2 | #define COMMON_HPP 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #define SDL_MAIN_HANDLED 11 | 12 | #include "platform/platform.h" 13 | 14 | #include "tinyxml2.h" 15 | 16 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxAnimation.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXANIMATION_HPP 2 | #define FLXANIMATION_HPP 3 | #include "flixel++/FlxRect.hpp" 4 | 5 | namespace Flx 6 | { 7 | class Sprite; 8 | 9 | /** 10 | * The basic frame class used for animation. 11 | * @extends Flx::Rect 12 | */ 13 | struct Frame : public Flx::Rect 14 | { 15 | float frameX = 0, frameY = 0; 16 | }; 17 | 18 | 19 | class Animation 20 | { 21 | public: 22 | std::vector frames; 23 | int fps = 0; 24 | Animation(); 25 | int size(); 26 | }; 27 | 28 | class AnimationController 29 | { 30 | public: 31 | Animation* curAnim; 32 | int frameIndex = 0; 33 | bool animated = false; 34 | std::map animations; 35 | AnimationController(); 36 | void fromSparrow(const char* path, const char* defaultAnim, int fps); 37 | void play(const char* name); 38 | Frame* getCurAnim(); 39 | }; 40 | } 41 | 42 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxAssets.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXASSETS_HPP 2 | #define FLXASSETS_HPP 3 | namespace Flx 4 | { 5 | namespace Assets 6 | { 7 | /// @brief Default engine's font (can be overwritten in every FlxText) 8 | extern void* defaultFont; 9 | /// @brief Default engine's cursor bitmap (can be overwritten in the game class FlxMouse) 10 | extern void* defaultCursor; 11 | } 12 | } 13 | 14 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxBackends.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXBACKENDS_HPP 2 | #define FLXBACKENDS_HPP 3 | #include "flixel++/FlxSprite.hpp" 4 | #include "flixel++/FlxGraphic.hpp" 5 | 6 | #ifdef FLIXEL_SDL 7 | struct SDL_Window; 8 | struct SDL_Renderer; 9 | struct SDL_Surface; 10 | #endif 11 | 12 | namespace Flx::Backends 13 | { 14 | class Backend 15 | { 16 | public: 17 | Backend(); 18 | virtual ~Backend(); 19 | virtual Flx::Graphic* requestTexture(const char* path); 20 | virtual Flx::Graphic* requestTexture(const void* data, const size_t size); 21 | virtual Flx::Graphic* requestText(const char* text); 22 | virtual Flx::Graphic* requestRectangle(float width, float height, int color); 23 | virtual bool deleteTexture(void* tex); 24 | virtual void runEvents(); 25 | virtual void update(); 26 | virtual void render(Flx::Sprite* spr); 27 | virtual uint32_t getTicks(); 28 | virtual void delay(uint32_t ms); 29 | }; 30 | 31 | #ifdef FLIXEL_SDL 32 | class SDL : public Backend 33 | { 34 | private: 35 | 36 | SDL_Window* window; 37 | SDL_Renderer* renderer; 38 | public: 39 | SDL(); 40 | ~SDL(); 41 | Flx::Graphic* requestTexture(const char* path); 42 | Flx::Graphic* requestTexture(const void* data, const size_t size); 43 | Flx::Graphic* requestTexture(SDL_Surface* surface); 44 | Flx::Graphic* requestText(const char* text); 45 | Flx::Graphic* requestRectangle(float width, float height, int color); 46 | bool deleteTexture(void* tex); 47 | void runEvents(); 48 | void update(); 49 | void render(Flx::Sprite* spr); 50 | inline uint32_t getTicks(); 51 | inline void delay(uint32_t ms); 52 | }; 53 | #endif 54 | 55 | class OpenGL : public Backend 56 | {}; 57 | } 58 | 59 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxBasic.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXBASIC_HPP 2 | #define FLXBASIC_HPP 3 | namespace Flx 4 | { 5 | class Basic 6 | { 7 | public: 8 | /// @brief Unique ID that identifies every object in the scene 9 | int ID; 10 | /// @brief Changes the object's visibility 11 | bool visible = false; 12 | /// @brief Default FlxBasic constructor 13 | Basic(); 14 | 15 | virtual ~Basic(); 16 | virtual void update(); 17 | virtual void draw(); 18 | }; 19 | } 20 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxColor.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXCOLOR_HPP 2 | #define FLXCOLOR_HPP 3 | #include "flixel++/Common.hpp" 4 | 5 | namespace Flx 6 | { 7 | struct Color 8 | { 9 | /// @brief Red color value 10 | uint8_t r; 11 | /// @brief Green color value 12 | uint8_t g; 13 | /// @brief Blue color value 14 | uint8_t b; 15 | /// @brief Alpha color value 16 | uint8_t a; 17 | 18 | /** 19 | * @brief Used to create an specific color for any sprite in the engine 20 | * @param red Red Value 21 | * @param green Green Value 22 | * @param blue Blue Value 23 | * @param alpha Alpha Value 24 | **/ 25 | Color(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha); 26 | 27 | /** 28 | * @brief Creates a color from an given hex value 29 | * @param color Hex value (Ex: #FFFFFF or 0xFF0FFF) 30 | * @return An Color struct 31 | **/ 32 | static Color fromHex(int color); 33 | }; 34 | } 35 | 36 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxG.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXG_HPP 2 | #define FLXG_HPP 3 | #include "flixel++/FlxGame.hpp" 4 | #include "flixel++/FlxKeyboard.hpp" 5 | #include "flixel++/FlxMouse.hpp" 6 | 7 | namespace Flx 8 | { 9 | namespace Globals 10 | { 11 | extern int width, height; 12 | 13 | extern Flx::Game* game; 14 | 15 | extern Flx::Random* random; 16 | 17 | extern Flx::SoundManager* sound; 18 | 19 | extern Flx::Keyboard* keys; 20 | 21 | extern Flx::Mouse* mouse; 22 | 23 | extern bool switchState(Flx::State* state); 24 | } 25 | } 26 | 27 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxGame.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXGAME_HPP 2 | #define FLXGAME_HPP 3 | #include "flixel++/FlxState.hpp" 4 | #include "flixel++/FlxManagers.hpp" 5 | #include "flixel++/FlxBackends.hpp" 6 | namespace Flx 7 | { 8 | class Game 9 | { 10 | public: 11 | bool quitting = false; 12 | bool paused = false; 13 | 14 | std::string title; 15 | float framerate; 16 | 17 | Flx::State* curState; 18 | Flx::Backends::Backend* backend; 19 | 20 | Game(const char* title, int width, int height, int framerate, Flx::State* initialState, bool skipSplash); 21 | ~Game(); 22 | void setupGlobals(); 23 | void destroyGlobals(); 24 | bool switchState(Flx::State* state); 25 | void runEvents(); 26 | void run(); 27 | void start(); 28 | }; 29 | } 30 | 31 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxGraphic.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXGRAPHIC_HPP 2 | #define FLXGRAPHIC_HPP 3 | #include "flixel++/Common.hpp" 4 | namespace Flx 5 | { 6 | 7 | class Graphic 8 | { 9 | public: 10 | Graphic(int width, int height, void* tex); 11 | ~Graphic(); 12 | int width, height; 13 | void* bitmap; 14 | uint32_t getPixel32(int x, int y); 15 | friend class Sprite; 16 | }; 17 | } 18 | 19 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxGroup.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXGROUP_HPP 2 | #define FLXGROUP_HPP 3 | #include 4 | #include 5 | 6 | namespace Flx 7 | { 8 | class Group : public Flx::Basic 9 | { 10 | public: 11 | std::vector members; 12 | Group(); 13 | ~Group(); 14 | Flx::Basic* operator+=(Flx::Basic& obj); 15 | Flx::Basic* operator+=(Flx::Basic* obj); 16 | Flx::Basic* add(Flx::Basic& obj); 17 | Flx::Basic* add(Flx::Basic* obj); 18 | virtual void update(); 19 | void draw(); 20 | }; 21 | } 22 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxHttp.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLIXEL_HTTP 2 | #define FLIXEL_HTTP 3 | 4 | #include "flixel++/Common.hpp" 5 | #ifdef FLIXEL_USE_CURL 6 | #include "curl/curl.h" 7 | 8 | //NEED TO REWORK ON THIS 9 | 10 | namespace Flx 11 | { 12 | class Http 13 | { 14 | public: 15 | /// @brief Creates an new Http point 16 | Http(); 17 | 18 | ~Http(); 19 | 20 | CURL *curl; 21 | 22 | std::string requestURLtext(const std::string&); 23 | 24 | std::string storage; 25 | bool onData; 26 | bool onError; 27 | bool received; 28 | 29 | static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp); 30 | }; 31 | } 32 | #endif 33 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxKeyboard.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXKEYBOARD_HPP 2 | #define FLXKEYBOARD_HPP 3 | 4 | namespace Flx 5 | { 6 | class Keyboard 7 | { 8 | public: 9 | Keyboard(); 10 | bool* keys; 11 | bool pressed(const unsigned char key); 12 | bool justPressed(const unsigned char key); 13 | }; 14 | } 15 | 16 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxLog.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXLOG_HPP 2 | #define FLXLOG_HPP 3 | #include 4 | #include 5 | namespace Flx 6 | { 7 | class Log 8 | { 9 | public: 10 | static std::vector logs; 11 | 12 | static void warn(const char* msg); 13 | static void error(const char* msg); 14 | static const char* recent(); 15 | }; 16 | } 17 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxMacros.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXMACROS_HPP 2 | #define FLXMACROS_HPP 3 | 4 | #define trace(x) std::cout << '(' << __FILE__ << ',' << __LINE__ << "): " << ( x ) << std::endl 5 | 6 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxManagers.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXMANAGERS_HPP 2 | #define FLXMANAGERS_HPP 3 | #include "flixel++/Common.hpp" 4 | #include "flixel++/FlxSound.hpp" 5 | namespace Flx 6 | { 7 | class Random 8 | { 9 | private: 10 | std::mt19937 engine; 11 | public: 12 | Random(); 13 | Random(int seed); 14 | ~Random(); 15 | int number(int min, int max); 16 | float floating(float min, float max); 17 | bool boolean(float chance); 18 | }; 19 | 20 | class SoundManager 21 | { 22 | private: 23 | #ifdef FLIXEL_OPENAL 24 | ALCdevice *device; 25 | ALCcontext *context; 26 | #endif 27 | public: 28 | Flx::Sound* music; 29 | SoundManager(); 30 | ~SoundManager(); 31 | }; 32 | } 33 | 34 | #endif // FLXMANAGERS_HPP -------------------------------------------------------------------------------- /include/flixel++/FlxMouse.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXMOUSE_HPP 2 | #define FLXMOUSE_HPP 3 | 4 | #include "flixel++/Common.hpp" 5 | #include "flixel++/FlxBasic.hpp" 6 | #include "flixel++/FlxAssets.hpp" 7 | #include "flixel++/FlxRect.hpp" 8 | #include "flixel++/FlxPoint.hpp" 9 | 10 | namespace Flx { 11 | class Mouse 12 | { 13 | public: 14 | Mouse(); 15 | ~Mouse(); 16 | 17 | void draw(); 18 | void update(); 19 | void loadGraphic(const char* path); 20 | 21 | Flx::Rect clipRect; 22 | void* cursor; 23 | Flx::Point pos; 24 | 25 | bool enable; 26 | 27 | float x,y; 28 | 29 | private: 30 | void setGraphic(); 31 | }; 32 | } 33 | 34 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxNet.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXNET_HPP 2 | #define FLXNET_HPP 3 | 4 | #ifdef USE_SOCKETS 5 | 6 | #include 7 | #include 8 | #ifdef _WIN32 9 | #include 10 | #pragma comment(lib, "ws2_32.lib") 11 | #else 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #endif 20 | 21 | namespace Flx { 22 | /* 23 | * Provides a platform independent way of handling sockets. 24 | */ 25 | class Net { 26 | private: 27 | #ifdef _WIN32 28 | SOCKET sock; 29 | #else 30 | int sock; 31 | sockaddr_in addr; 32 | #endif 33 | public: 34 | Net(const char* host, int port); 35 | ~Net(); 36 | void listen(int connections); 37 | void send(const char* data); 38 | std::string read(); 39 | std::string readUntil(char until); 40 | void connect(); 41 | }; 42 | } 43 | 44 | #endif 45 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxObject.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXOBJECT_HPP 2 | #define FLXOBJECT_HPP 3 | #include "flixel++/FlxBasic.hpp" 4 | 5 | namespace Flx 6 | { 7 | class Object : public Flx::Basic 8 | { 9 | public: 10 | 11 | /// @brief X position of an object normally located at the upper left corner of the object 12 | float x = 0; 13 | /// @brief Y position of an object normally located at the upper left corner of the object 14 | float y = 0; 15 | 16 | /// @brief Sets the width of an object (Not of an texture) 17 | float width = 0; 18 | /// @brief Sets the height of an object (Not of an texture) 19 | float height = 0; 20 | 21 | /// @brief Base of the engine other resources demonstrated as an invisible object 22 | /// @param x X position of the object 23 | /// @param y Y position of the object 24 | Object(float x, float y); 25 | 26 | ~Object(); 27 | }; 28 | } 29 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxPoint.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXPOINT_HPP 2 | #define FLXPOINT_HPP 3 | 4 | #include "flixel++/Common.hpp" 5 | 6 | namespace Flx { 7 | class Point { 8 | public: 9 | /// @brief Used commonly for coordination 10 | Point(); 11 | 12 | /// @brief Used commonly for coordination 13 | /// @param x X position of the point 14 | /// @param y Y position of the point 15 | Point(float x, float y); 16 | 17 | ~Point(); 18 | 19 | /// @brief Adds an value to the point coordinates 20 | /// @param x X position adddition 21 | /// @param y Y position adddition 22 | void add(float x, float y); 23 | 24 | /// @brief Sets an value to the point coordinates 25 | /// @param x X position 26 | /// @param y Y position 27 | void set(float x, float y); 28 | 29 | /// @brief Subtracts an value to the point coordinates 30 | /// @param x X position subtraction 31 | /// @param y Y position subtraction 32 | void subtract(float x, float y); 33 | 34 | /// @brief Point X position 35 | float x; 36 | 37 | /// @brief Point Y position 38 | float y; 39 | 40 | int _x,_y; 41 | 42 | /// @brief Point's width 43 | int w; 44 | 45 | /// @brief Point's height 46 | int h; 47 | 48 | /// @brief Point's angle 49 | float angle; 50 | 51 | /// @brief Point's scale 52 | float scale; 53 | }; 54 | } 55 | 56 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxRect.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXRECT_HPP 2 | #define FLXRECT_HPP 3 | #include "flixel++/Common.hpp" 4 | 5 | namespace Flx 6 | { 7 | struct Rect 8 | { 9 | 10 | Rect(); 11 | Rect(float x, float y, float width, float height); 12 | ~Rect(); 13 | 14 | float x, y; 15 | float width, height; 16 | }; 17 | } 18 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxScript.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXSCRIPT_HPP 2 | #define FLXSCRIPT_HPP 3 | #include 4 | #include 5 | 6 | namespace Flx 7 | { 8 | 9 | class Script 10 | { 11 | private: 12 | void* interp; 13 | public: 14 | Script(); 15 | ~Script(); 16 | void addFunction(const char* name, std::function func); 17 | void runFunction(const char* func); 18 | int getInteger(const char* name); 19 | float getFloat(const char* name); 20 | bool getBool(const char* name); 21 | }; 22 | } 23 | 24 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxSound.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXSOUND_HPP 2 | #define FLXSOUND_HPP 3 | #include "flixel++/Common.hpp" 4 | #include "flixel++/FlxBasic.hpp" 5 | namespace Flx 6 | { 7 | // TODO: revamp Sound! 8 | class Sound : public Basic 9 | { 10 | public: 11 | uint32_t startTime; 12 | 13 | OggVorbis_File vorbis; 14 | vorbis_info* info; 15 | #ifdef FLIXEL_OPENAL 16 | ALuint buffer; 17 | ALuint source; 18 | #endif 19 | std::vector bufferData; 20 | public: 21 | Sound(); 22 | ~Sound(); 23 | void play(); 24 | void load(const char* path); 25 | float getPosition(); 26 | }; 27 | } 28 | 29 | #endif // FLXSOUND_HPP -------------------------------------------------------------------------------- /include/flixel++/FlxSplash.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXSPLASH_HPP 2 | #define FLXSPLASH_HPP 3 | 4 | #include "flixel++/FlxSprite.hpp" 5 | #include "flixel++/FlxState.hpp" 6 | #include "flixel++/FlxSound.hpp" 7 | #include "flixel++/FlxText.hpp" 8 | 9 | namespace Flx{ 10 | class Splash : public Flx::State 11 | { 12 | public: 13 | Splash(Flx::State* state); 14 | Flx::State* nextState; 15 | 16 | Flx::Sprite* green; 17 | Flx::Sprite* blue; 18 | Flx::Sprite* yellow; 19 | Flx::Sprite* red; 20 | Flx::Sprite* cyan; 21 | Flx::Sprite* cpp; 22 | 23 | Flx::Text *flixelText; 24 | 25 | 26 | Flx::Sound* flixelSound; 27 | 28 | void create(); 29 | void update(); 30 | }; 31 | } 32 | 33 | 34 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxSprite.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXSPRITE_HPP 2 | #define FLXSPRITE_HPP 3 | #include "flixel++/FlxObject.hpp" 4 | #include "flixel++/FlxGraphic.hpp" 5 | #include "flixel++/FlxRect.hpp" 6 | #include "flixel++/FlxPoint.hpp" 7 | #include "flixel++/FlxAnimation.hpp" 8 | #include "flixel++/FlxColor.hpp" 9 | namespace Flx 10 | { 11 | class Sprite : public Flx::Object 12 | { 13 | public: 14 | int alpha; 15 | int angle; 16 | bool visible; 17 | 18 | Flx::Graphic* graphic; 19 | Flx::Rect clipRect; 20 | Flx::Rect hitbox; 21 | Flx::AnimationController* animation; 22 | 23 | Flx::Color color; 24 | 25 | Sprite(float x, float y); 26 | Sprite(const char* path); 27 | Sprite(); 28 | ~Sprite(); 29 | 30 | Flx::Sprite* loadGraphic(const char* path); 31 | Flx::Sprite* loadGraphic(const void* data, const size_t size); 32 | Flx::Sprite* makeGraphic(float width, float height, int color); 33 | 34 | bool collides(Flx::Sprite* sprite); 35 | void setGraphicSize(float width, float height); 36 | void screenCenter(); 37 | void updatePosition(); 38 | void updateHitbox(); 39 | void update(); 40 | void draw(); 41 | 42 | Flx::Point offset; 43 | Flx::Point scale; 44 | Flx::Point origin; 45 | }; 46 | } 47 | 48 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxState.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXSTATE_HPP 2 | #define FLXSTATE_HPP 3 | #include 4 | #include 5 | #include 6 | 7 | namespace Flx 8 | { 9 | class State : public Flx::Group 10 | { 11 | public: 12 | //Flx::SubState substate; 13 | State(); 14 | virtual void create(); 15 | virtual void update(); 16 | virtual void onResize(int width, int height); 17 | void draw(); 18 | }; 19 | class SubState : public Flx::State 20 | { 21 | public: 22 | SubState(); 23 | ~SubState(); 24 | void update(); 25 | void draw(); 26 | }; 27 | } 28 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxText.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXTEXT_HPP 2 | #define FLXTEXT_HPP 3 | 4 | #include "flixel++/FlxSprite.hpp" 5 | 6 | namespace Flx 7 | { 8 | class Text : public Flx::Sprite 9 | { 10 | public: 11 | std::string text; 12 | Text(float x, float y, const std::string& text); 13 | ~Text(); 14 | 15 | void setText(std::string newText); 16 | void drawText(); 17 | 18 | // TODO: FlxFont 19 | void* font; 20 | }; 21 | } 22 | 23 | #endif -------------------------------------------------------------------------------- /include/flixel++/FlxUtils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FLXUTILS_HPP 2 | #define FLXUTILS_HPP 3 | 4 | namespace Flx 5 | { 6 | namespace Utils 7 | { 8 | bool fileExists(const char* path); 9 | } 10 | } 11 | 12 | #endif -------------------------------------------------------------------------------- /include/flixel++/SDL_Backports.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SDL_BACKPORTS_HPP 2 | #define SDL_BACKPORTS_HPP 3 | #ifdef SDL_LEGACY 4 | #include 5 | 6 | #define SDL_RectEmpty(X) ((!(X)) || ((X)->w <= 0) || ((X)->h <= 0)) 7 | 8 | bool SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result); 9 | /** 10 | * This is a semi-private blit function and it performs low-level surface 11 | * scaled blitting only. 12 | */ 13 | int 14 | SDL_LowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect, 15 | SDL_Surface * dst, SDL_Rect * dstrect); 16 | 17 | int 18 | SDL_UpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect, 19 | SDL_Surface * dst, SDL_Rect * dstrect); 20 | #endif 21 | #endif -------------------------------------------------------------------------------- /include/flixel++/platform/3ds.h: -------------------------------------------------------------------------------- 1 | #ifndef THREEDS_P_H 2 | #define THREEDS_P_H 3 | 4 | #define SDL_LEGACY 5 | #define TREMOR 6 | #define USE_SOCKETS 7 | 8 | #include <3ds.h> 9 | #include "tremor/ivorbisfile.h" 10 | 11 | #endif -------------------------------------------------------------------------------- /include/flixel++/platform/pc.h: -------------------------------------------------------------------------------- 1 | #ifndef PC_H 2 | #define PC_H 3 | 4 | #define FLIXEL_OPENAL 5 | #define FLIXEL_USE_SOCKETS 6 | #include 7 | #include 8 | #include 9 | #define FLIXEL_SDL 10 | 11 | #ifdef __SWITCH__ 12 | #include // Switch uses the same libraries as PC, no need for a new file 13 | #else 14 | #define FLIXEL_USE_CURL 15 | #endif 16 | 17 | #endif -------------------------------------------------------------------------------- /include/flixel++/platform/platform.h: -------------------------------------------------------------------------------- 1 | #ifndef PLATFORM_H 2 | #define PLATFORM_H 3 | 4 | #if (__3DS__) 5 | #include "3ds.h" 6 | #elif (__WII__) 7 | #include "wii.h" 8 | #else 9 | #include "pc.h" 10 | #endif 11 | 12 | #endif -------------------------------------------------------------------------------- /include/flixel++/platform/wii.h: -------------------------------------------------------------------------------- 1 | #ifndef WII_P_H 2 | #define WII_P_H 3 | 4 | #define SDL_LEGACY 5 | #define TINYXML2 6 | #include 7 | #include 8 | #include "tinyxml2.h" 9 | 10 | #endif -------------------------------------------------------------------------------- /mk/3ds.mk: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | .SUFFIXES: 3 | #--------------------------------------------------------------------------------- 4 | 5 | ifeq ($(strip $(DEVKITARM)),) 6 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") 7 | endif 8 | 9 | include $(DEVKITARM)/3ds_rules 10 | 11 | #--------------------------------------------------------------------------------- 12 | # TARGET is the name of the output 13 | # BUILD is the directory where object files & intermediate files will be placed 14 | # SOURCES is a list of directories containing source code 15 | # DATA is a list of directories containing data files 16 | # INCLUDES is a list of directories containing header files 17 | #--------------------------------------------------------------------------------- 18 | TARGET := 3ds/libflixel++ 19 | BUILD := obj 20 | SOURCES := source 21 | DATA := data 22 | INCLUDES := include 23 | 24 | #--------------------------------------------------------------------------------- 25 | # options for code generation 26 | #--------------------------------------------------------------------------------- 27 | ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft 28 | 29 | CFLAGS := -g -Wall -O2 -mword-relocations \ 30 | -ffunction-sections \ 31 | $(ARCH) 32 | 33 | CFLAGS += $(INCLUDE) -D__3DS__ 34 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions 35 | 36 | ASFLAGS := -g $(ARCH) 37 | 38 | #--------------------------------------------------------------------------------- 39 | # list of directories containing libraries, this must be the top level containing 40 | # include and lib 41 | #--------------------------------------------------------------------------------- 42 | LIBDIRS := $(PORTLIBS) $(CTRULIB) 43 | 44 | #--------------------------------------------------------------------------------- 45 | # no real need to edit anything past this point unless you need to add additional 46 | # rules for different file extensions 47 | #--------------------------------------------------------------------------------- 48 | ifneq ($(BUILD),$(notdir $(CURDIR))) 49 | #--------------------------------------------------------------------------------- 50 | 51 | export OUTPUT := $(CURDIR)/build/$(TARGET).a 52 | 53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ 54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) 55 | 56 | export DEPSDIR := $(CURDIR)/$(BUILD) 57 | 58 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 59 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 60 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 61 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 62 | 63 | #--------------------------------------------------------------------------------- 64 | # use CXX for linking C++ projects, CC for standard C 65 | #--------------------------------------------------------------------------------- 66 | ifeq ($(strip $(CPPFILES)),) 67 | #--------------------------------------------------------------------------------- 68 | export LD := $(CC) 69 | #--------------------------------------------------------------------------------- 70 | else 71 | #--------------------------------------------------------------------------------- 72 | export LD := $(CXX) 73 | #--------------------------------------------------------------------------------- 74 | endif 75 | #--------------------------------------------------------------------------------- 76 | 77 | export OFILES := $(addsuffix .o,$(BINFILES)) \ 78 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) 79 | 80 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ 81 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 82 | -I$(CURDIR)/$(BUILD) 83 | 84 | .PHONY: $(BUILD) clean all 85 | 86 | #--------------------------------------------------------------------------------- 87 | all: $(BUILD) 88 | 89 | lib: 90 | @[ -d $@ ] || mkdir -p $@ 91 | 92 | $(BUILD): lib 93 | @[ -d $@ ] || mkdir -p $@ 94 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/mk/3ds.mk 95 | 96 | #--------------------------------------------------------------------------------- 97 | clean: 98 | @echo clean ... 99 | @rm -fr $(BUILD) lib 100 | 101 | #--------------------------------------------------------------------------------- 102 | else 103 | 104 | DEPENDS := $(OFILES:.o=.d) 105 | 106 | #--------------------------------------------------------------------------------- 107 | # main targets 108 | #--------------------------------------------------------------------------------- 109 | $(OUTPUT) : $(OFILES) 110 | 111 | #--------------------------------------------------------------------------------- 112 | %.bin.o : %.bin 113 | #--------------------------------------------------------------------------------- 114 | @echo $(notdir $<) 115 | @$(bin2o) 116 | 117 | 118 | -include $(DEPENDS) 119 | 120 | #--------------------------------------------------------------------------------------- 121 | endif 122 | #--------------------------------------------------------------------------------------- 123 | -------------------------------------------------------------------------------- /mk/FindGLEW.cmake: -------------------------------------------------------------------------------- 1 | #.rst: 2 | # FindGLEW 3 | # -------- 4 | # 5 | # Find the OpenGL Extension Wrangler Library (GLEW) 6 | # 7 | # IMPORTED Targets 8 | # ^^^^^^^^^^^^^^^^ 9 | # 10 | # This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``, 11 | # if GLEW has been found. 12 | # 13 | # Result Variables 14 | # ^^^^^^^^^^^^^^^^ 15 | # 16 | # This module defines the following variables: 17 | # 18 | # :: 19 | # 20 | # GLEW_INCLUDE_DIRS - include directories for GLEW 21 | # GLEW_LIBRARIES - libraries to link against GLEW 22 | # GLEW_FOUND - true if GLEW has been found and can be used 23 | 24 | #============================================================================= 25 | # Copyright 2012 Benjamin Eikel 26 | # Copyright 2016 Ryan Pavlik 27 | # 28 | # Distributed under the OSI-approved BSD License (the "License"); 29 | # see below. 30 | # 31 | # This software is distributed WITHOUT ANY WARRANTY; without even the 32 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 33 | # See the License for more information. 34 | # 35 | # SPDX-License-Identifier: BSD-3-Clause 36 | #============================================================================= 37 | # 38 | # Redistribution and use in source and binary forms, with or without 39 | # modification, are permitted provided that the following conditions 40 | # are met: 41 | # 42 | # * Redistributions of source code must retain the above copyright 43 | # notice, this list of conditions and the following disclaimer. 44 | # 45 | # * Redistributions in binary form must reproduce the above copyright 46 | # notice, this list of conditions and the following disclaimer in the 47 | # documentation and/or other materials provided with the distribution. 48 | # 49 | # * Neither the names of Kitware, Inc., the Insight Software Consortium, 50 | # nor the names of their contributors may be used to endorse or promote 51 | # products derived from this software without specific prior written 52 | # permission. 53 | # 54 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 55 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 56 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 57 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 58 | # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 59 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 60 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 61 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 62 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 63 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 64 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 65 | #============================================================================= 66 | 67 | find_path(GLEW_INCLUDE_DIR GL/glew.h) 68 | if(WIN32) 69 | # TODO how to make this exclude arm? 70 | if(CMAKE_SIZEOF_VOID_P EQUAL 4) 71 | set(GLEW_ARCH Win32) 72 | else() 73 | set(GLEW_ARCH x64) 74 | endif() 75 | set(GLEW_EXTRA_SUFFIXES lib/Release/${GLEW_ARCH} bin/Release/${GLEW_ARCH}) 76 | endif() 77 | 78 | if(WIN32 AND GLEW_INCLUDE_DIR) 79 | get_filename_component(GLEW_LIB_ROOT_CANDIDATE "${GLEW_INCLUDE_DIR}/.." ABSOLUTE) 80 | endif() 81 | 82 | find_library(GLEW_LIBRARY 83 | NAMES GLEW glew32 glew glew32s 84 | PATH_SUFFIXES lib64 ${GLEW_EXTRA_SUFFIXES} 85 | HINTS "${GLEW_LIB_ROOT_CANDIDATE}") 86 | 87 | if(WIN32 AND GLEW_LIBRARY AND NOT GLEW_LIBRARY MATCHES ".*s.lib") 88 | get_filename_component(GLEW_LIB_DIR "${GLEW_LIBRARY}" DIRECTORY) 89 | get_filename_component(GLEW_BIN_ROOT_CANDIDATE1 "${GLEW_LIB_DIR}/.." ABSOLUTE) 90 | get_filename_component(GLEW_BIN_ROOT_CANDIDATE2 "${GLEW_LIB_DIR}/../../.." ABSOLUTE) 91 | find_file(GLEW_RUNTIME_LIBRARY 92 | NAMES glew32.dll 93 | PATH_SUFFIXES bin ${GLEW_EXTRA_SUFFIXES} 94 | HINTS 95 | "${GLEW_BIN_ROOT_CANDIDATE1}" 96 | "${GLEW_BIN_ROOT_CANDIDATE2}") 97 | endif() 98 | 99 | set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) 100 | set(GLEW_LIBRARIES ${GLEW_LIBRARY}) 101 | 102 | include(FindPackageHandleStandardArgs) 103 | find_package_handle_standard_args(GLEW 104 | REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) 105 | 106 | if(GLEW_FOUND AND NOT TARGET GLEW::GLEW) 107 | if(WIN32 AND GLEW_LIBRARY MATCHES ".*s.lib") 108 | # Windows, known static library. 109 | add_library(GLEW::GLEW STATIC IMPORTED) 110 | set_target_properties(GLEW::GLEW PROPERTIES 111 | IMPORTED_LOCATION "${GLEW_LIBRARY}" 112 | PROPERTY INTERFACE_COMPILE_DEFINITIONS GLEW_STATIC) 113 | 114 | elseif(WIN32 AND GLEW_RUNTIME_LIBRARY) 115 | # Windows, known dynamic library and we have both pieces 116 | # TODO might be different for mingw 117 | add_library(GLEW::GLEW SHARED IMPORTED) 118 | set_target_properties(GLEW::GLEW PROPERTIES 119 | IMPORTED_LOCATION "${GLEW_RUNTIME_LIBRARY}" 120 | IMPORTED_IMPLIB "${GLEW_LIBRARY}") 121 | else() 122 | 123 | # Anything else - previous behavior. 124 | add_library(GLEW::GLEW UNKNOWN IMPORTED) 125 | set_target_properties(GLEW::GLEW PROPERTIES 126 | IMPORTED_LOCATION "${GLEW_LIBRARY}") 127 | endif() 128 | 129 | set_target_properties(GLEW::GLEW PROPERTIES 130 | INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}") 131 | 132 | endif() 133 | 134 | mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY GLEW_RUNTIME_LIBRARY) -------------------------------------------------------------------------------- /mk/FindGLFW.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2013 Pixar 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "Apache License") 5 | # with the following modification; you may not use this file except in 6 | # compliance with the Apache License and the following modification to it: 7 | # Section 6. Trademarks. is deleted and replaced with: 8 | # 9 | # 6. Trademarks. This License does not grant permission to use the trade 10 | # names, trademarks, service marks, or product names of the Licensor 11 | # and its affiliates, except as required to comply with Section 4(c) of 12 | # the License and to reproduce the content of the NOTICE file. 13 | # 14 | # You may obtain a copy of the Apache License at 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, software 19 | # distributed under the Apache License with the above modification is 20 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21 | # KIND, either express or implied. See the Apache License for the specific 22 | # language governing permissions and limitations under the Apache License. 23 | # 24 | 25 | # Try to find GLFW library and include path. 26 | # Once done this will define 27 | # 28 | # GLFW_FOUND 29 | # GLFW_INCLUDE_DIR 30 | # GLFW_LIBRARIES 31 | # 32 | 33 | if(NOT NO_GLFW_X11) 34 | set(GLFW_X11_INCLUDE_DIRS 35 | "/usr/X11R6/include" 36 | "/usr/include/X11" 37 | ) 38 | set(GLFW_X11_LIB_DIRS 39 | "/usr/X11R6/lib" 40 | ) 41 | else() 42 | set(GLFW_X11_INCLUDE_DIRS "") 43 | set(GLFW_X11_LIB_DIRS "") 44 | endif() 45 | 46 | find_path( GLFW_INCLUDE_DIR 47 | NAMES 48 | GLFW/glfw3.h 49 | HINTS 50 | "${GLFW_LOCATION}/include" 51 | "$ENV{GLFW_LOCATION}/include" 52 | PATHS 53 | "$ENV{PROGRAMFILES}/GLFW/include" 54 | "${OPENGL_INCLUDE_DIR}" 55 | /usr/openwin/share/include 56 | /usr/openwin/include 57 | "${GLFW_X11_INCLUDE_DIRS}" 58 | /opt/graphics/OpenGL/include 59 | /opt/graphics/OpenGL/contrib/libglfw 60 | /usr/local/include 61 | /usr/include/GL 62 | /usr/include 63 | DOC 64 | "The directory where GLFW/glfw3.h resides" 65 | ) 66 | 67 | # 68 | # XXX: Do we still need to search for GL/glfw.h? 69 | # 70 | find_path( GLFW_INCLUDE_DIR 71 | NAMES 72 | GL/glfw.h 73 | HINTS 74 | "${GLFW_LOCATION}/include" 75 | "$ENV{GLFW_LOCATION}/include" 76 | PATHS 77 | "$ENV{PROGRAMFILES}/GLFW/include" 78 | "${OPENGL_INCLUDE_DIR}" 79 | /usr/openwin/share/include 80 | /usr/openwin/include 81 | "${GLFW_X11_INCLUDE_DIRS}" 82 | /opt/graphics/OpenGL/include 83 | /opt/graphics/OpenGL/contrib/libglfw 84 | /usr/local/include 85 | /usr/include/GL 86 | /usr/include 87 | DOC 88 | "The directory where GL/glfw.h resides" 89 | ) 90 | 91 | if (WIN32) 92 | if(CYGWIN) 93 | find_library( GLFW_glfw_LIBRARY 94 | NAMES 95 | glfw32 96 | HINTS 97 | "${GLFW_LOCATION}/lib" 98 | "${GLFW_LOCATION}/lib/x64" 99 | "$ENV{GLFW_LOCATION}/lib" 100 | PATHS 101 | "${OPENGL_LIBRARY_DIR}" 102 | /usr/lib 103 | /usr/lib/w32api 104 | /usr/local/lib 105 | "${GLFW_X11_LIB_DIRS}" 106 | DOC 107 | "The GLFW library" 108 | ) 109 | else() 110 | find_library( GLFW_glfw_LIBRARY 111 | NAMES 112 | glfw32 113 | glfw32s 114 | glfw 115 | glfw3 116 | HINTS 117 | "${GLFW_LOCATION}/lib" 118 | "${GLFW_LOCATION}/lib/x64" 119 | "${GLFW_LOCATION}/lib-msvc110" 120 | "${GLFW_LOCATION}/lib-vc2012" 121 | "$ENV{GLFW_LOCATION}/lib" 122 | "$ENV{GLFW_LOCATION}/lib/x64" 123 | "$ENV{GLFW_LOCATION}/lib-msvc110" 124 | "$ENV{GLFW_LOCATION}/lib-vc2012" 125 | PATHS 126 | "$ENV{PROGRAMFILES}/GLFW/lib" 127 | "${OPENGL_LIBRARY_DIR}" 128 | DOC 129 | "The GLFW library" 130 | ) 131 | endif() 132 | else () 133 | if (APPLE) 134 | find_library( GLFW_glfw_LIBRARY glfw 135 | NAMES 136 | glfw 137 | glfw3 138 | HINTS 139 | "${GLFW_LOCATION}/lib" 140 | "${GLFW_LOCATION}/lib/cocoa" 141 | "$ENV{GLFW_LOCATION}/lib" 142 | "$ENV{GLFW_LOCATION}/lib/cocoa" 143 | PATHS 144 | /usr/local/lib 145 | ) 146 | set(GLFW_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX") 147 | set(GLFW_corevideo_LIBRARY "-framework CoreVideo" CACHE STRING "CoreVideo framework for OSX") 148 | set(GLFW_iokit_LIBRARY "-framework IOKit" CACHE STRING "IOKit framework for OSX") 149 | else () 150 | # (*)NIX 151 | 152 | find_package(Threads REQUIRED) 153 | 154 | if(NOT NO_GLFW_X11) 155 | find_package(X11 REQUIRED) 156 | 157 | if(NOT X11_Xrandr_FOUND) 158 | message(FATAL_ERROR "Xrandr library not found - required for GLFW") 159 | endif() 160 | 161 | if(NOT X11_xf86vmode_FOUND) 162 | message(FATAL_ERROR "xf86vmode library not found - required for GLFW") 163 | endif() 164 | 165 | if(NOT X11_Xcursor_FOUND) 166 | message(FATAL_ERROR "Xcursor library not found - required for GLFW") 167 | endif() 168 | 169 | if(NOT X11_Xinerama_FOUND) 170 | message(FATAL_ERROR "Xinerama library not found - required for GLFW") 171 | endif() 172 | 173 | if(NOT X11_Xi_FOUND) 174 | message(FATAL_ERROR "Xi library not found - required for GLFW") 175 | endif() 176 | 177 | list(APPEND GLFW_x11_LIBRARY "${X11_Xrandr_LIB}" "${X11_Xxf86vm_LIB}" "${X11_Xcursor_LIB}" "${X11_Xinerama_LIB}" "${X11_Xi_LIB}" "${X11_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}" -lrt -ldl) 178 | endif (NOT NO_GLFW_X11) 179 | 180 | find_library( GLFW_glfw_LIBRARY 181 | NAMES 182 | glfw 183 | glfw3 184 | HINTS 185 | "${GLFW_LOCATION}/lib" 186 | "$ENV{GLFW_LOCATION}/lib" 187 | "${GLFW_LOCATION}/lib/x11" 188 | "$ENV{GLFW_LOCATION}/lib/x11" 189 | PATHS 190 | /usr/lib64 191 | /usr/lib 192 | /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} 193 | /usr/local/lib64 194 | /usr/local/lib 195 | /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} 196 | /usr/openwin/lib 197 | "${GLFW_X11_LIB_DIRS}" 198 | DOC 199 | "The GLFW library" 200 | ) 201 | endif (APPLE) 202 | endif (WIN32) 203 | 204 | set( GLFW_FOUND "NO" ) 205 | 206 | if(GLFW_INCLUDE_DIR) 207 | 208 | if(GLFW_glfw_LIBRARY) 209 | set( GLFW_LIBRARIES "${GLFW_glfw_LIBRARY}" 210 | "${GLFW_x11_LIBRARY}" 211 | "${GLFW_cocoa_LIBRARY}" 212 | "${GLFW_iokit_LIBRARY}" 213 | "${GLFW_corevideo_LIBRARY}" ) 214 | set( GLFW_FOUND "YES" ) 215 | set (GLFW_LIBRARY "${GLFW_LIBRARIES}") 216 | set (GLFW_INCLUDE_PATH "${GLFW_INCLUDE_DIR}") 217 | endif(GLFW_glfw_LIBRARY) 218 | 219 | 220 | # Tease the GLFW_VERSION numbers from the lib headers 221 | function(parseVersion FILENAME VARNAME) 222 | 223 | set(PATTERN "^#define ${VARNAME}.*$") 224 | 225 | file(STRINGS "${GLFW_INCLUDE_DIR}/${FILENAME}" TMP REGEX ${PATTERN}) 226 | 227 | string(REGEX MATCHALL "[0-9]+" TMP ${TMP}) 228 | 229 | set(${VARNAME} ${TMP} PARENT_SCOPE) 230 | 231 | endfunction() 232 | 233 | 234 | if(EXISTS "${GLFW_INCLUDE_DIR}/GL/glfw.h") 235 | 236 | parseVersion(GL/glfw.h GLFW_VERSION_MAJOR) 237 | parseVersion(GL/glfw.h GLFW_VERSION_MINOR) 238 | parseVersion(GL/glfw.h GLFW_VERSION_REVISION) 239 | 240 | elseif(EXISTS "${GLFW_INCLUDE_DIR}/GLFW/glfw3.h") 241 | 242 | parseVersion(GLFW/glfw3.h GLFW_VERSION_MAJOR) 243 | parseVersion(GLFW/glfw3.h GLFW_VERSION_MINOR) 244 | parseVersion(GLFW/glfw3.h GLFW_VERSION_REVISION) 245 | 246 | endif() 247 | 248 | if(${GLFW_VERSION_MAJOR} OR ${GLFW_VERSION_MINOR} OR ${GLFW_VERSION_REVISION}) 249 | set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}.${GLFW_VERSION_REVISION}") 250 | set(GLFW_VERSION_STRING "${GLFW_VERSION}") 251 | mark_as_advanced(GLFW_VERSION) 252 | endif() 253 | 254 | endif(GLFW_INCLUDE_DIR) 255 | 256 | include(FindPackageHandleStandardArgs) 257 | 258 | find_package_handle_standard_args(GLFW 259 | REQUIRED_VARS 260 | GLFW_INCLUDE_DIR 261 | GLFW_LIBRARIES 262 | VERSION_VAR 263 | GLFW_VERSION 264 | ) 265 | 266 | mark_as_advanced( 267 | GLFW_INCLUDE_DIR 268 | GLFW_LIBRARIES 269 | GLFW_glfw_LIBRARY 270 | GLFW_cocoa_LIBRARY 271 | ) 272 | -------------------------------------------------------------------------------- /mk/FindLibVorbisfile.cmake: -------------------------------------------------------------------------------- 1 | #from: https://github.com/SFML/SFML/blob/master/cmake/Modules/FindVORBIS.cmake 2 | 3 | find_path(OGG_INCLUDE_DIR ogg/ogg.h) 4 | find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) 5 | 6 | find_library(OGG_LIBRARY NAMES ogg) 7 | find_library(VORBIS_LIBRARY NAMES vorbis) 8 | if(NOT SFML_OS_IOS) 9 | find_library(VORBISFILE_LIBRARY NAMES vorbisfile) 10 | find_library(VORBISENC_LIBRARY NAMES vorbisenc) 11 | set(VORBIS_LIBRARIES ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY}) 12 | else() 13 | set(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${OGG_LIBRARY}) 14 | endif() 15 | 16 | include(FindPackageHandleStandardArgs) 17 | 18 | find_package_handle_standard_args(VORBIS DEFAULT_MSG VORBIS_LIBRARIES VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR) 19 | 20 | set(VORBIS_INCLUDE_DIRS ${OGG_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR}) 21 | 22 | mark_as_advanced(OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY) -------------------------------------------------------------------------------- /mk/FindSDL2_image.cmake: -------------------------------------------------------------------------------- 1 | # from: https://github.com/aminosbh/sdl2-image-sample/blob/master/cmake/sdl2/FindSDL2_image.cmake 2 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 3 | # file Copyright.txt or https://cmake.org/licensing for details. 4 | 5 | # Copyright 2019 Amine Ben Hassouna 6 | # Copyright 2000-2019 Kitware, Inc. and Contributors 7 | # All rights reserved. 8 | 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions 11 | # are met: 12 | 13 | # * Redistributions of source code must retain the above copyright 14 | # notice, this list of conditions and the following disclaimer. 15 | 16 | # * Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | 20 | # * Neither the name of Kitware, Inc. nor the names of Contributors 21 | # may be used to endorse or promote products derived from this 22 | # software without specific prior written permission. 23 | 24 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | #[=======================================================================[.rst: 37 | FindSDL2_image 38 | -------------- 39 | 40 | Locate SDL2_image library 41 | 42 | This module defines the following 'IMPORTED' target: 43 | 44 | :: 45 | 46 | SDL2::Image 47 | The SDL2_image library, if found. 48 | Have SDL2::Core as a link dependency. 49 | 50 | 51 | 52 | This module will set the following variables in your project: 53 | 54 | :: 55 | 56 | SDL2_IMAGE_LIBRARIES, the name of the library to link against 57 | SDL2_IMAGE_INCLUDE_DIRS, where to find the headers 58 | SDL2_IMAGE_FOUND, if false, do not try to link against 59 | SDL2_IMAGE_VERSION_STRING - human-readable string containing the 60 | version of SDL2_image 61 | 62 | 63 | 64 | This module responds to the following cache variables: 65 | 66 | :: 67 | 68 | SDL2_IMAGE_PATH 69 | Set a custom SDL2_image Library path (default: empty) 70 | 71 | SDL2_IMAGE_NO_DEFAULT_PATH 72 | Disable search SDL2_image Library in default path. 73 | If SDL2_IMAGE_PATH (default: ON) 74 | Else (default: OFF) 75 | 76 | SDL2_IMAGE_INCLUDE_DIR 77 | SDL2_image headers path. 78 | 79 | SDL2_IMAGE_LIBRARY 80 | SDL2_image Library (.dll, .so, .a, etc) path. 81 | 82 | 83 | Additional Note: If you see an empty SDL2_IMAGE_LIBRARY in your project 84 | configuration, it means CMake did not find your SDL2_image library 85 | (SDL2_image.dll, libsdl2_image.so, etc). Set SDL2_IMAGE_LIBRARY to point 86 | to your SDL2_image library, and configure again. This value is used to 87 | generate the final SDL2_IMAGE_LIBRARIES variable and the SDL2::Image target, 88 | but when this value is unset, SDL2_IMAGE_LIBRARIES and SDL2::Image does not 89 | get created. 90 | 91 | 92 | $SDL2IMAGEDIR is an environment variable that would correspond to the 93 | ./configure --prefix=$SDL2IMAGEDIR used in building SDL2_image. 94 | 95 | $SDL2DIR is an environment variable that would correspond to the 96 | ./configure --prefix=$SDL2DIR used in building SDL2. 97 | 98 | 99 | 100 | Created by Amine Ben Hassouna: 101 | Adapt FindSDL_image.cmake to SDL2_image (FindSDL2_image.cmake). 102 | Add cache variables for more flexibility: 103 | SDL2_IMAGE_PATH, SDL2_IMAGE_NO_DEFAULT_PATH (for details, see doc above). 104 | Add SDL2 as a required dependency. 105 | Modernize the FindSDL2_image.cmake module by creating a specific target: 106 | SDL2::Image (for details, see doc above). 107 | 108 | Original FindSDL_image.cmake module: 109 | Created by Eric Wing. This was influenced by the FindSDL.cmake 110 | module, but with modifications to recognize OS X frameworks and 111 | additional Unix paths (FreeBSD, etc). 112 | #]=======================================================================] 113 | 114 | # SDL2 Library required 115 | find_package(SDL2 QUIET) 116 | if(NOT SDL2_FOUND) 117 | set(SDL2_IMAGE_SDL2_NOT_FOUND "Could NOT find SDL2 (SDL2 is required by SDL2_image).") 118 | if(SDL2_image_FIND_REQUIRED) 119 | message(FATAL_ERROR ${SDL2_IMAGE_SDL2_NOT_FOUND}) 120 | else() 121 | if(NOT SDL2_image_FIND_QUIETLY) 122 | message(STATUS ${SDL2_IMAGE_SDL2_NOT_FOUND}) 123 | endif() 124 | return() 125 | endif() 126 | unset(SDL2_IMAGE_SDL2_NOT_FOUND) 127 | endif() 128 | 129 | 130 | # Define options for searching SDL2_image Library in a custom path 131 | 132 | set(SDL2_IMAGE_PATH "" CACHE STRING "Custom SDL2_image Library path") 133 | 134 | set(_SDL2_IMAGE_NO_DEFAULT_PATH OFF) 135 | if(SDL2_IMAGE_PATH) 136 | set(_SDL2_IMAGE_NO_DEFAULT_PATH ON) 137 | endif() 138 | 139 | set(SDL2_IMAGE_NO_DEFAULT_PATH ${_SDL2_IMAGE_NO_DEFAULT_PATH} 140 | CACHE BOOL "Disable search SDL2_image Library in default path") 141 | unset(_SDL2_IMAGE_NO_DEFAULT_PATH) 142 | 143 | set(SDL2_IMAGE_NO_DEFAULT_PATH_CMD) 144 | if(SDL2_IMAGE_NO_DEFAULT_PATH) 145 | set(SDL2_IMAGE_NO_DEFAULT_PATH_CMD NO_DEFAULT_PATH) 146 | endif() 147 | 148 | # Search for the SDL2_image include directory 149 | find_path(SDL2_IMAGE_INCLUDE_DIR SDL_image.h 150 | HINTS 151 | ENV SDL2IMAGEDIR 152 | ENV SDL2DIR 153 | ${SDL2_IMAGE_NO_DEFAULT_PATH_CMD} 154 | PATH_SUFFIXES SDL2 155 | # path suffixes to search inside ENV{SDL2DIR} 156 | # and ENV{SDL2IMAGEDIR} 157 | include/SDL2 include 158 | PATHS ${SDL2_IMAGE_PATH} 159 | DOC "Where the SDL2_image headers can be found" 160 | ) 161 | 162 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 163 | set(VC_LIB_PATH_SUFFIX lib/x64) 164 | else() 165 | set(VC_LIB_PATH_SUFFIX lib/x86) 166 | endif() 167 | 168 | # Search for the SDL2_image library 169 | find_library(SDL2_IMAGE_LIBRARY 170 | NAMES SDL2_image 171 | HINTS 172 | ENV SDL2IMAGEDIR 173 | ENV SDL2DIR 174 | ${SDL2_IMAGE_NO_DEFAULT_PATH_CMD} 175 | PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} 176 | PATHS ${SDL2_IMAGE_PATH} 177 | DOC "Where the SDL2_image Library can be found" 178 | ) 179 | 180 | # Read SDL2_image version 181 | if(SDL2_IMAGE_INCLUDE_DIR AND EXISTS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h") 182 | file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$") 183 | file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+[0-9]+$") 184 | file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+[0-9]+$") 185 | string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MAJOR "${SDL2_IMAGE_VERSION_MAJOR_LINE}") 186 | string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MINOR "${SDL2_IMAGE_VERSION_MINOR_LINE}") 187 | string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_PATCH "${SDL2_IMAGE_VERSION_PATCH_LINE}") 188 | set(SDL2_IMAGE_VERSION_STRING ${SDL2_IMAGE_VERSION_MAJOR}.${SDL2_IMAGE_VERSION_MINOR}.${SDL2_IMAGE_VERSION_PATCH}) 189 | unset(SDL2_IMAGE_VERSION_MAJOR_LINE) 190 | unset(SDL2_IMAGE_VERSION_MINOR_LINE) 191 | unset(SDL2_IMAGE_VERSION_PATCH_LINE) 192 | unset(SDL2_IMAGE_VERSION_MAJOR) 193 | unset(SDL2_IMAGE_VERSION_MINOR) 194 | unset(SDL2_IMAGE_VERSION_PATCH) 195 | endif() 196 | 197 | set(SDL2_IMAGE_LIBRARIES ${SDL2_IMAGE_LIBRARY}) 198 | set(SDL2_IMAGE_INCLUDE_DIRS ${SDL2_IMAGE_INCLUDE_DIR}) 199 | 200 | include(FindPackageHandleStandardArgs) 201 | 202 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_image 203 | REQUIRED_VARS SDL2_IMAGE_LIBRARIES SDL2_IMAGE_INCLUDE_DIRS 204 | VERSION_VAR SDL2_IMAGE_VERSION_STRING) 205 | 206 | 207 | mark_as_advanced(SDL2_IMAGE_PATH 208 | SDL2_IMAGE_NO_DEFAULT_PATH 209 | SDL2_IMAGE_LIBRARY 210 | SDL2_IMAGE_INCLUDE_DIR) 211 | 212 | 213 | if(SDL2_IMAGE_FOUND) 214 | 215 | # SDL2::Image target 216 | if(SDL2_IMAGE_LIBRARY AND NOT TARGET SDL2::Image) 217 | add_library(SDL2::Image UNKNOWN IMPORTED) 218 | set_target_properties(SDL2::Image PROPERTIES 219 | IMPORTED_LOCATION "${SDL2_IMAGE_LIBRARY}" 220 | INTERFACE_INCLUDE_DIRECTORIES "${SDL2_IMAGE_INCLUDE_DIR}" 221 | INTERFACE_LINK_LIBRARIES SDL2::Core) 222 | endif() 223 | endif() 224 | -------------------------------------------------------------------------------- /mk/FindSDL2_ttf.cmake: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | # Copyright 2019 Amine Ben Hassouna 5 | # Copyright 2000-2019 Kitware, Inc. and Contributors 6 | # All rights reserved. 7 | 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | 12 | # * Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | 15 | # * Redistributions in binary form must reproduce the above copyright 16 | # notice, this list of conditions and the following disclaimer in the 17 | # documentation and/or other materials provided with the distribution. 18 | 19 | # * Neither the name of Kitware, Inc. nor the names of Contributors 20 | # may be used to endorse or promote products derived from this 21 | # software without specific prior written permission. 22 | 23 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #[=======================================================================[.rst: 36 | FindSDL2_ttf 37 | ------------ 38 | 39 | Locate SDL2_ttf library 40 | 41 | This module defines the following 'IMPORTED' target: 42 | 43 | :: 44 | 45 | SDL2::TTF 46 | The SDL2_ttf library, if found. 47 | Have SDL2::Core as a link dependency. 48 | 49 | 50 | 51 | This module will set the following variables in your project: 52 | 53 | :: 54 | 55 | SDL2_TTF_LIBRARIES, the name of the library to link against 56 | SDL2_TTF_INCLUDE_DIRS, where to find the headers 57 | SDL2_TTF_FOUND, if false, do not try to link against 58 | SDL2_TTF_VERSION_STRING - human-readable string containing the 59 | version of SDL2_ttf 60 | 61 | 62 | 63 | This module responds to the following cache variables: 64 | 65 | :: 66 | 67 | SDL2_TTF_PATH 68 | Set a custom SDL2_ttf Library path (default: empty) 69 | 70 | SDL2_TTF_NO_DEFAULT_PATH 71 | Disable search SDL2_ttf Library in default path. 72 | If SDL2_TTF_PATH (default: ON) 73 | Else (default: OFF) 74 | 75 | SDL2_TTF_INCLUDE_DIR 76 | SDL2_ttf headers path. 77 | 78 | SDL2_TTF_LIBRARY 79 | SDL2_ttf Library (.dll, .so, .a, etc) path. 80 | 81 | 82 | Additional Note: If you see an empty SDL2_TTF_LIBRARY in your project 83 | configuration, it means CMake did not find your SDL2_ttf library 84 | (SDL2_ttf.dll, libsdl2_ttf.so, etc). Set SDL2_TTF_LIBRARY to point 85 | to your SDL2_ttf library, and configure again. This value is used to 86 | generate the final SDL2_TTF_LIBRARIES variable and the SDL2::TTF target, 87 | but when this value is unset, SDL2_TTF_LIBRARIES and SDL2::TTF does not 88 | get created. 89 | 90 | 91 | $SDL2TTFDIR is an environment variable that would correspond to the 92 | ./configure --prefix=$SDL2TTFDIR used in building SDL2_ttf. 93 | 94 | $SDL2DIR is an environment variable that would correspond to the 95 | ./configure --prefix=$SDL2DIR used in building SDL2. 96 | 97 | 98 | 99 | Created by Amine Ben Hassouna: 100 | Adapt FindSDL_ttf.cmake to SDL2_ttf (FindSDL2_ttf.cmake). 101 | Add cache variables for more flexibility: 102 | SDL2_TTF_PATH, SDL2_TTF_NO_DEFAULT_PATH (for details, see doc above). 103 | Add SDL2 as a required dependency. 104 | Modernize the FindSDL2_ttf.cmake module by creating a specific target: 105 | SDL2::TTF (for details, see doc above). 106 | 107 | Original FindSDL_ttf.cmake module: 108 | Created by Eric Wing. This was influenced by the FindSDL.cmake 109 | module, but with modifications to recognize OS X frameworks and 110 | additional Unix paths (FreeBSD, etc). 111 | #]=======================================================================] 112 | 113 | # SDL2 Library required 114 | find_package(SDL2 QUIET) 115 | if(NOT SDL2_FOUND) 116 | set(SDL2_TTF_SDL2_NOT_FOUND "Could NOT find SDL2 (SDL2 is required by SDL2_ttf).") 117 | if(SDL2_ttf_FIND_REQUIRED) 118 | message(FATAL_ERROR ${SDL2_TTF_SDL2_NOT_FOUND}) 119 | else() 120 | if(NOT SDL2_ttf_FIND_QUIETLY) 121 | message(STATUS ${SDL2_TTF_SDL2_NOT_FOUND}) 122 | endif() 123 | return() 124 | endif() 125 | unset(SDL2_TTF_SDL2_NOT_FOUND) 126 | endif() 127 | 128 | 129 | # Define options for searching SDL2_ttf Library in a custom path 130 | 131 | set(SDL2_TTF_PATH "" CACHE STRING "Custom SDL2_ttf Library path") 132 | 133 | set(_SDL2_TTF_NO_DEFAULT_PATH OFF) 134 | if(SDL2_TTF_PATH) 135 | set(_SDL2_TTF_NO_DEFAULT_PATH ON) 136 | endif() 137 | 138 | set(SDL2_TTF_NO_DEFAULT_PATH ${_SDL2_TTF_NO_DEFAULT_PATH} 139 | CACHE BOOL "Disable search SDL2_ttf Library in default path") 140 | unset(_SDL2_TTF_NO_DEFAULT_PATH) 141 | 142 | set(SDL2_TTF_NO_DEFAULT_PATH_CMD) 143 | if(SDL2_TTF_NO_DEFAULT_PATH) 144 | set(SDL2_TTF_NO_DEFAULT_PATH_CMD NO_DEFAULT_PATH) 145 | endif() 146 | 147 | # Search for the SDL2_ttf include directory 148 | find_path(SDL2_TTF_INCLUDE_DIR SDL_ttf.h 149 | HINTS 150 | ENV SDL2TTFDIR 151 | ENV SDL2DIR 152 | ${SDL2_TTF_NO_DEFAULT_PATH_CMD} 153 | PATH_SUFFIXES SDL2 154 | # path suffixes to search inside ENV{SDL2DIR} 155 | # and ENV{SDL2TTFDIR} 156 | include/SDL2 include 157 | PATHS ${SDL2_TTF_PATH} 158 | DOC "Where the SDL2_ttf headers can be found" 159 | ) 160 | 161 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 162 | set(VC_LIB_PATH_SUFFIX lib/x64) 163 | else() 164 | set(VC_LIB_PATH_SUFFIX lib/x86) 165 | endif() 166 | 167 | # Search for the SDL2_ttf library 168 | find_library(SDL2_TTF_LIBRARY 169 | NAMES SDL2_ttf 170 | HINTS 171 | ENV SDL2TTFDIR 172 | ENV SDL2DIR 173 | ${SDL2_TTF_NO_DEFAULT_PATH_CMD} 174 | PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} 175 | PATHS ${SDL2_TTF_PATH} 176 | DOC "Where the SDL2_ttf Library can be found" 177 | ) 178 | 179 | # Read SDL2_ttf version 180 | if(SDL2_TTF_INCLUDE_DIR AND EXISTS "${SDL2_TTF_INCLUDE_DIR}/SDL_ttf.h") 181 | file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL2_TTF_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+[0-9]+$") 182 | file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL2_TTF_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+[0-9]+$") 183 | file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL2_TTF_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+[0-9]+$") 184 | string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_MAJOR "${SDL2_TTF_VERSION_MAJOR_LINE}") 185 | string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_MINOR "${SDL2_TTF_VERSION_MINOR_LINE}") 186 | string(REGEX REPLACE "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_PATCH "${SDL2_TTF_VERSION_PATCH_LINE}") 187 | set(SDL2_TTF_VERSION_STRING ${SDL2_TTF_VERSION_MAJOR}.${SDL2_TTF_VERSION_MINOR}.${SDL2_TTF_VERSION_PATCH}) 188 | unset(SDL2_TTF_VERSION_MAJOR_LINE) 189 | unset(SDL2_TTF_VERSION_MINOR_LINE) 190 | unset(SDL2_TTF_VERSION_PATCH_LINE) 191 | unset(SDL2_TTF_VERSION_MAJOR) 192 | unset(SDL2_TTF_VERSION_MINOR) 193 | unset(SDL2_TTF_VERSION_PATCH) 194 | endif() 195 | 196 | set(SDL2_TTF_LIBRARIES ${SDL2_TTF_LIBRARY}) 197 | set(SDL2_TTF_INCLUDE_DIRS ${SDL2_TTF_INCLUDE_DIR}) 198 | 199 | include(FindPackageHandleStandardArgs) 200 | 201 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_ttf 202 | REQUIRED_VARS SDL2_TTF_LIBRARIES SDL2_TTF_INCLUDE_DIRS 203 | VERSION_VAR SDL2_TTF_VERSION_STRING) 204 | 205 | 206 | mark_as_advanced(SDL2_TTF_PATH 207 | SDL2_TTF_NO_DEFAULT_PATH 208 | SDL2_TTF_LIBRARY 209 | SDL2_TTF_INCLUDE_DIR) 210 | 211 | 212 | if(SDL2_TTF_FOUND) 213 | 214 | # SDL2::TTF target 215 | if(SDL2_TTF_LIBRARY AND NOT TARGET SDL2::TTF) 216 | add_library(SDL2::TTF UNKNOWN IMPORTED) 217 | set_target_properties(SDL2::TTF PROPERTIES 218 | IMPORTED_LOCATION "${SDL2_TTF_LIBRARY}" 219 | INTERFACE_INCLUDE_DIRECTORIES "${SDL2_TTF_INCLUDE_DIR}" 220 | INTERFACE_LINK_LIBRARIES SDL2::Core) 221 | endif() 222 | endif() 223 | -------------------------------------------------------------------------------- /mk/FindSDL_image.cmake: -------------------------------------------------------------------------------- 1 | # from: https://github.com/aminosbh/SDL2-image-sample/blob/master/cmake/SDL2/FindSDL2_image.cmake 2 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 3 | # file Copyright.txt or https://cmake.org/licensing for details. 4 | 5 | # Copyright 2019 Amine Ben Hassouna 6 | # Copyright 2000-2019 Kitware, Inc. and Contributors 7 | # All rights reserved. 8 | 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions 11 | # are met: 12 | 13 | # * Redistributions of source code must retain the above copyright 14 | # notice, this list of conditions and the following disclaimer. 15 | 16 | # * Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | 20 | # * Neither the name of Kitware, Inc. nor the names of Contributors 21 | # may be used to endorse or promote products derived from this 22 | # software without specific prior written permission. 23 | 24 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | #[=======================================================================[.rst: 37 | FindSDL_image 38 | -------------- 39 | 40 | Locate SDL_image library 41 | 42 | This module defines the following 'IMPORTED' target: 43 | 44 | :: 45 | 46 | SDL::Image 47 | The SDL_image library, if found. 48 | Have SDL::Core as a link dependency. 49 | 50 | 51 | 52 | This module will set the following variables in your project: 53 | 54 | :: 55 | 56 | SDL_IMAGE_LIBRARIES, the name of the library to link against 57 | SDL_IMAGE_INCLUDE_DIRS, where to find the headers 58 | SDL_IMAGE_FOUND, if false, do not try to link against 59 | SDL_IMAGE_VERSION_STRING - human-readable string containing the 60 | version of SDL_image 61 | 62 | 63 | 64 | This module responds to the following cache variables: 65 | 66 | :: 67 | 68 | SDL_IMAGE_PATH 69 | Set a custom SDL_image Library path (default: empty) 70 | 71 | SDL_IMAGE_NO_DEFAULT_PATH 72 | Disable search SDL_image Library in default path. 73 | If SDL_IMAGE_PATH (default: ON) 74 | Else (default: OFF) 75 | 76 | SDL_IMAGE_INCLUDE_DIR 77 | SDL_image headers path. 78 | 79 | SDL_IMAGE_LIBRARY 80 | SDL_image Library (.dll, .so, .a, etc) path. 81 | 82 | 83 | Additional Note: If you see an empty SDL_IMAGE_LIBRARY in your project 84 | configuration, it means CMake did not find your SDL_image library 85 | (SDL_image.dll, libSDL_image.so, etc). Set SDL_IMAGE_LIBRARY to point 86 | to your SDL_image library, and configure again. This value is used to 87 | generate the final SDL_IMAGE_LIBRARIES variable and the SDL::Image target, 88 | but when this value is unset, SDL_IMAGE_LIBRARIES and SDL::Image does not 89 | get created. 90 | 91 | 92 | $SDLIMAGEDIR is an environment variable that would correspond to the 93 | ./configure --prefix=$SDLIMAGEDIR used in building SDL_image. 94 | 95 | $SDLDIR is an environment variable that would correspond to the 96 | ./configure --prefix=$SDLDIR used in building SDL. 97 | 98 | 99 | 100 | Created by Amine Ben Hassouna: 101 | Adapt FindSDL_image.cmake to SDL_image (FindSDL_image.cmake). 102 | Add cache variables for more flexibility: 103 | SDL_IMAGE_PATH, SDL_IMAGE_NO_DEFAULT_PATH (for details, see doc above). 104 | Add SDL as a required dependency. 105 | Modernize the FindSDL_image.cmake module by creating a specific target: 106 | SDL::Image (for details, see doc above). 107 | 108 | Original FindSDL_image.cmake module: 109 | Created by Eric Wing. This was influenced by the FindSDL.cmake 110 | module, but with modifications to recognize OS X frameworks and 111 | additional Unix paths (FreeBSD, etc). 112 | #]=======================================================================] 113 | 114 | # SDL Library required 115 | find_package(SDL QUIET) 116 | if(NOT SDL_FOUND) 117 | set(SDL_IMAGE_SDL_NOT_FOUND "Could NOT find SDL (SDL is required by SDL_image).") 118 | if(SDL_image_FIND_REQUIRED) 119 | message(FATAL_ERROR ${SDL_IMAGE_SDL_NOT_FOUND}) 120 | else() 121 | if(NOT SDL_image_FIND_QUIETLY) 122 | message(STATUS ${SDL_IMAGE_SDL_NOT_FOUND}) 123 | endif() 124 | return() 125 | endif() 126 | unset(SDL_IMAGE_SDL_NOT_FOUND) 127 | endif() 128 | 129 | 130 | # Define options for searching SDL_image Library in a custom path 131 | 132 | set(SDL_IMAGE_PATH "" CACHE STRING "Custom SDL_image Library path") 133 | 134 | set(_SDL_IMAGE_NO_DEFAULT_PATH OFF) 135 | if(SDL_IMAGE_PATH) 136 | set(_SDL_IMAGE_NO_DEFAULT_PATH ON) 137 | endif() 138 | 139 | set(SDL_IMAGE_NO_DEFAULT_PATH ${_SDL_IMAGE_NO_DEFAULT_PATH} 140 | CACHE BOOL "Disable search SDL_image Library in default path") 141 | unset(_SDL_IMAGE_NO_DEFAULT_PATH) 142 | 143 | set(SDL_IMAGE_NO_DEFAULT_PATH_CMD) 144 | if(SDL_IMAGE_NO_DEFAULT_PATH) 145 | set(SDL_IMAGE_NO_DEFAULT_PATH_CMD NO_DEFAULT_PATH) 146 | endif() 147 | 148 | # Search for the SDL_image include directory 149 | find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h 150 | HINTS 151 | ENV SDLIMAGEDIR 152 | ENV SDLDIR 153 | ${SDL_IMAGE_NO_DEFAULT_PATH_CMD} 154 | PATH_SUFFIXES SDL 155 | # path suffixes to search inside ENV{SDLDIR} 156 | # and ENV{SDLIMAGEDIR} 157 | include/SDL include 158 | PATHS ${SDL_IMAGE_PATH} 159 | DOC "Where the SDL_image headers can be found" 160 | ) 161 | 162 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 163 | set(VC_LIB_PATH_SUFFIX lib/x64) 164 | else() 165 | set(VC_LIB_PATH_SUFFIX lib/x86) 166 | endif() 167 | 168 | # Search for the SDL_image library 169 | find_library(SDL_IMAGE_LIBRARY 170 | NAMES SDL_image 171 | HINTS 172 | ENV SDLIMAGEDIR 173 | ENV SDLDIR 174 | ${SDL_IMAGE_NO_DEFAULT_PATH_CMD} 175 | PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} 176 | PATHS ${SDL_IMAGE_PATH} 177 | DOC "Where the SDL_image Library can be found" 178 | ) 179 | 180 | # Read SDL_image version 181 | if(SDL_IMAGE_INCLUDE_DIR AND EXISTS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h") 182 | file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$") 183 | file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+[0-9]+$") 184 | file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+[0-9]+$") 185 | string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MAJOR "${SDL_IMAGE_VERSION_MAJOR_LINE}") 186 | string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MINOR "${SDL_IMAGE_VERSION_MINOR_LINE}") 187 | string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_PATCH "${SDL_IMAGE_VERSION_PATCH_LINE}") 188 | set(SDL_IMAGE_VERSION_STRING ${SDL_IMAGE_VERSION_MAJOR}.${SDL_IMAGE_VERSION_MINOR}.${SDL_IMAGE_VERSION_PATCH}) 189 | unset(SDL_IMAGE_VERSION_MAJOR_LINE) 190 | unset(SDL_IMAGE_VERSION_MINOR_LINE) 191 | unset(SDL_IMAGE_VERSION_PATCH_LINE) 192 | unset(SDL_IMAGE_VERSION_MAJOR) 193 | unset(SDL_IMAGE_VERSION_MINOR) 194 | unset(SDL_IMAGE_VERSION_PATCH) 195 | endif() 196 | 197 | set(SDL_IMAGE_LIBRARIES ${SDL_IMAGE_LIBRARY}) 198 | set(SDL_IMAGE_INCLUDE_DIRS ${SDL_IMAGE_INCLUDE_DIR}) 199 | 200 | include(FindPackageHandleStandardArgs) 201 | 202 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_image 203 | REQUIRED_VARS SDL_IMAGE_LIBRARIES SDL_IMAGE_INCLUDE_DIRS 204 | VERSION_VAR SDL_IMAGE_VERSION_STRING) 205 | 206 | 207 | mark_as_advanced(SDL_IMAGE_PATH 208 | SDL_IMAGE_NO_DEFAULT_PATH 209 | SDL_IMAGE_LIBRARY 210 | SDL_IMAGE_INCLUDE_DIR) 211 | 212 | 213 | if(SDL_IMAGE_FOUND) 214 | 215 | # SDL::Image target 216 | if(SDL_IMAGE_LIBRARY AND NOT TARGET SDL::Image) 217 | add_library(SDL::Image UNKNOWN IMPORTED) 218 | set_target_properties(SDL::Image PROPERTIES 219 | IMPORTED_LOCATION "${SDL_IMAGE_LIBRARY}" 220 | INTERFACE_INCLUDE_DIRECTORIES "${SDL_IMAGE_INCLUDE_DIR}" 221 | INTERFACE_LINK_LIBRARIES SDL::Core) 222 | endif() 223 | endif() 224 | -------------------------------------------------------------------------------- /mk/FindSDL_ttf.cmake: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | # Copyright 2019 Amine Ben Hassouna 5 | # Copyright 2000-2019 Kitware, Inc. and Contributors 6 | # All rights reserved. 7 | 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | 12 | # * Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | 15 | # * Redistributions in binary form must reproduce the above copyright 16 | # notice, this list of conditions and the following disclaimer in the 17 | # documentation and/or other materials provided with the distribution. 18 | 19 | # * Neither the name of Kitware, Inc. nor the names of Contributors 20 | # may be used to endorse or promote products derived from this 21 | # software without specific prior written permission. 22 | 23 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | #[=======================================================================[.rst: 36 | FindSDL_ttf 37 | ------------ 38 | 39 | Locate SDL_ttf library 40 | 41 | This module defines the following 'IMPORTED' target: 42 | 43 | :: 44 | 45 | SDL::TTF 46 | The SDL_ttf library, if found. 47 | Have SDL::Core as a link dependency. 48 | 49 | 50 | 51 | This module will set the following variables in your project: 52 | 53 | :: 54 | 55 | SDL_TTF_LIBRARIES, the name of the library to link against 56 | SDL_TTF_INCLUDE_DIRS, where to find the headers 57 | SDL_TTF_FOUND, if false, do not try to link against 58 | SDL_TTF_VERSION_STRING - human-readable string containing the 59 | version of SDL_ttf 60 | 61 | 62 | 63 | This module responds to the following cache variables: 64 | 65 | :: 66 | 67 | SDL_TTF_PATH 68 | Set a custom SDL_ttf Library path (default: empty) 69 | 70 | SDL_TTF_NO_DEFAULT_PATH 71 | Disable search SDL_ttf Library in default path. 72 | If SDL_TTF_PATH (default: ON) 73 | Else (default: OFF) 74 | 75 | SDL_TTF_INCLUDE_DIR 76 | SDL_ttf headers path. 77 | 78 | SDL_TTF_LIBRARY 79 | SDL_ttf Library (.dll, .so, .a, etc) path. 80 | 81 | 82 | Additional Note: If you see an empty SDL_TTF_LIBRARY in your project 83 | configuration, it means CMake did not find your SDL_ttf library 84 | (SDL_ttf.dll, libSDL_ttf.so, etc). Set SDL_TTF_LIBRARY to point 85 | to your SDL_ttf library, and configure again. This value is used to 86 | generate the final SDL_TTF_LIBRARIES variable and the SDL::TTF target, 87 | but when this value is unset, SDL_TTF_LIBRARIES and SDL::TTF does not 88 | get created. 89 | 90 | 91 | $SDLTTFDIR is an environment variable that would correspond to the 92 | ./configure --prefix=$SDLTTFDIR used in building SDL_ttf. 93 | 94 | $SDLDIR is an environment variable that would correspond to the 95 | ./configure --prefix=$SDLDIR used in building SDL. 96 | 97 | 98 | 99 | Created by Amine Ben Hassouna: 100 | Adapt FindSDL_ttf.cmake to SDL_ttf (FindSDL_ttf.cmake). 101 | Add cache variables for more flexibility: 102 | SDL_TTF_PATH, SDL_TTF_NO_DEFAULT_PATH (for details, see doc above). 103 | Add SDL as a required dependency. 104 | Modernize the FindSDL_ttf.cmake module by creating a specific target: 105 | SDL::TTF (for details, see doc above). 106 | 107 | Original FindSDL_ttf.cmake module: 108 | Created by Eric Wing. This was influenced by the FindSDL.cmake 109 | module, but with modifications to recognize OS X frameworks and 110 | additional Unix paths (FreeBSD, etc). 111 | #]=======================================================================] 112 | 113 | # SDL Library required 114 | find_package(SDL QUIET) 115 | if(NOT SDL_FOUND) 116 | set(SDL_TTF_SDL_NOT_FOUND "Could NOT find SDL (SDL is required by SDL_ttf).") 117 | if(SDL_ttf_FIND_REQUIRED) 118 | message(FATAL_ERROR ${SDL_TTF_SDL_NOT_FOUND}) 119 | else() 120 | if(NOT SDL_ttf_FIND_QUIETLY) 121 | message(STATUS ${SDL_TTF_SDL_NOT_FOUND}) 122 | endif() 123 | return() 124 | endif() 125 | unset(SDL_TTF_SDL_NOT_FOUND) 126 | endif() 127 | 128 | 129 | # Define options for searching SDL_ttf Library in a custom path 130 | 131 | set(SDL_TTF_PATH "" CACHE STRING "Custom SDL_ttf Library path") 132 | 133 | set(_SDL_TTF_NO_DEFAULT_PATH OFF) 134 | if(SDL_TTF_PATH) 135 | set(_SDL_TTF_NO_DEFAULT_PATH ON) 136 | endif() 137 | 138 | set(SDL_TTF_NO_DEFAULT_PATH ${_SDL_TTF_NO_DEFAULT_PATH} 139 | CACHE BOOL "Disable search SDL_ttf Library in default path") 140 | unset(_SDL_TTF_NO_DEFAULT_PATH) 141 | 142 | set(SDL_TTF_NO_DEFAULT_PATH_CMD) 143 | if(SDL_TTF_NO_DEFAULT_PATH) 144 | set(SDL_TTF_NO_DEFAULT_PATH_CMD NO_DEFAULT_PATH) 145 | endif() 146 | 147 | # Search for the SDL_ttf include directory 148 | find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h 149 | HINTS 150 | ENV SDLTTFDIR 151 | ENV SDLDIR 152 | ${SDL_TTF_NO_DEFAULT_PATH_CMD} 153 | PATH_SUFFIXES SDL 154 | # path suffixes to search inside ENV{SDLDIR} 155 | # and ENV{SDLTTFDIR} 156 | include/SDL include 157 | PATHS ${SDL_TTF_PATH} 158 | DOC "Where the SDL_ttf headers can be found" 159 | ) 160 | 161 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 162 | set(VC_LIB_PATH_SUFFIX lib/x64) 163 | else() 164 | set(VC_LIB_PATH_SUFFIX lib/x86) 165 | endif() 166 | 167 | # Search for the SDL_ttf library 168 | find_library(SDL_TTF_LIBRARY 169 | NAMES SDL_ttf 170 | HINTS 171 | ENV SDLTTFDIR 172 | ENV SDLDIR 173 | ${SDL_TTF_NO_DEFAULT_PATH_CMD} 174 | PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} 175 | PATHS ${SDL_TTF_PATH} 176 | DOC "Where the SDL_ttf Library can be found" 177 | ) 178 | 179 | # Read SDL_ttf version 180 | if(SDL_TTF_INCLUDE_DIR AND EXISTS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h") 181 | file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+[0-9]+$") 182 | file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+[0-9]+$") 183 | file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+[0-9]+$") 184 | string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MAJOR "${SDL_TTF_VERSION_MAJOR_LINE}") 185 | string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MINOR "${SDL_TTF_VERSION_MINOR_LINE}") 186 | string(REGEX REPLACE "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_PATCH "${SDL_TTF_VERSION_PATCH_LINE}") 187 | set(SDL_TTF_VERSION_STRING ${SDL_TTF_VERSION_MAJOR}.${SDL_TTF_VERSION_MINOR}.${SDL_TTF_VERSION_PATCH}) 188 | unset(SDL_TTF_VERSION_MAJOR_LINE) 189 | unset(SDL_TTF_VERSION_MINOR_LINE) 190 | unset(SDL_TTF_VERSION_PATCH_LINE) 191 | unset(SDL_TTF_VERSION_MAJOR) 192 | unset(SDL_TTF_VERSION_MINOR) 193 | unset(SDL_TTF_VERSION_PATCH) 194 | endif() 195 | 196 | set(SDL_TTF_LIBRARIES ${SDL_TTF_LIBRARY}) 197 | set(SDL_TTF_INCLUDE_DIRS ${SDL_TTF_INCLUDE_DIR}) 198 | 199 | include(FindPackageHandleStandardArgs) 200 | 201 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_ttf 202 | REQUIRED_VARS SDL_TTF_LIBRARIES SDL_TTF_INCLUDE_DIRS 203 | VERSION_VAR SDL_TTF_VERSION_STRING) 204 | 205 | 206 | mark_as_advanced(SDL_TTF_PATH 207 | SDL_TTF_NO_DEFAULT_PATH 208 | SDL_TTF_LIBRARY 209 | SDL_TTF_INCLUDE_DIR) 210 | 211 | 212 | if(SDL_TTF_FOUND) 213 | 214 | # SDL::TTF target 215 | if(SDL_TTF_LIBRARY AND NOT TARGET SDL::TTF) 216 | add_library(SDL::TTF UNKNOWN IMPORTED) 217 | set_target_properties(SDL::TTF PROPERTIES 218 | IMPORTED_LOCATION "${SDL_TTF_LIBRARY}" 219 | INTERFACE_INCLUDE_DIRECTORIES "${SDL_TTF_INCLUDE_DIR}" 220 | INTERFACE_LINK_LIBRARIES SDL::Core) 221 | endif() 222 | endif() 223 | -------------------------------------------------------------------------------- /mk/FindSOIL.cmake: -------------------------------------------------------------------------------- 1 | # Find SOIL 2 | # Find the SOIL includes and library 3 | # 4 | # SOIL_INCLUDE_DIRS - where to find SOIL.h, etc. 5 | # SOIL_LIBRARIES - List of libraries when using SOIL. 6 | # SOIL_FOUND - True if SOIL found. 7 | # 8 | # Based on the FindZLIB.cmake module. 9 | 10 | IF (SOIL_INCLUDE_DIR) 11 | # Already in cache, be silent 12 | SET(SOIL_FIND_QUIETLY TRUE) 13 | ENDIF (SOIL_INCLUDE_DIR) 14 | 15 | FIND_PATH(SOIL_INCLUDE_DIR SOIL.h PATH_SUFFIXES include/SOIL include) 16 | 17 | SET(SOIL_NAMES SOIL Soil soil) 18 | FIND_LIBRARY(SOIL_LIBRARY NAMES ${SOIL_NAMES} ) 19 | MARK_AS_ADVANCED( SOIL_LIBRARY SOIL_INCLUDE_DIR ) 20 | 21 | # Per-recommendation 22 | SET(SOIL_INCLUDE_DIRS "${SOIL_INCLUDE_DIR}") 23 | SET(SOIL_LIBRARIES "${SOIL_LIBRARY}") 24 | 25 | # handle the QUIETLY and REQUIRED arguments and set SOIL_FOUND to TRUE if 26 | # all listed variables are TRUE 27 | INCLUDE(FindPackageHandleStandardArgs) 28 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SOIL DEFAULT_MSG SOIL_LIBRARIES SOIL_INCLUDE_DIRS) -------------------------------------------------------------------------------- /mk/pc.mk: -------------------------------------------------------------------------------- 1 | # Legacy Makefile, use CMake instead! 2 | 3 | CC = gcc 4 | CXX = g++ 5 | INCLUDE = -Iinclude/ 6 | FILES = source/**.cpp 7 | CFLAGS = -O3 -Wall -fPIC -g 8 | OUT = lib$(notdir $(CURDIR)).so 9 | OBJ = obj/pc 10 | CLIBS = ${sdl2-config --cflags --libs}-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lopenal -lvorbisfile -lcurl 11 | 12 | ifeq ($(SDL_LEGACY),1) 13 | CLIBS = ${sdl-config --cflags --libs}-lSDL -lSDL_image -lSDL_mixer -lSDL_ttf -lopenal -lvorbisfile -lcurl -DSDL_LEGACY 14 | OUT := $(OUT)_legacy 15 | endif 16 | 17 | 18 | 19 | all: ./source/* 20 | @mkdir -p ${OBJ} 21 | @for file in $^ ; do \ 22 | echo "$${file}..." ; \ 23 | ${CXX} ${CFLAGS} ${CLIBS} ${INCLUDE} $${file} -c -o ${OBJ}/$$(basename $${file} .cpp).o || exit 1 ; \ 24 | done 25 | @echo "Linking..." 26 | @${CXX} ${CLIBS} ${OBJ}/*.o -o build/${OUT} -shared -------------------------------------------------------------------------------- /mk/switch.mk: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | .SUFFIXES: 3 | #--------------------------------------------------------------------------------- 4 | 5 | ifeq ($(strip $(DEVKITPRO)),) 6 | $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") 7 | endif 8 | 9 | include $(DEVKITPRO)/libnx/switch_rules 10 | 11 | #--------------------------------------------------------------------------------- 12 | # TARGET is the name of the output 13 | # SOURCES is a list of directories containing source code 14 | # DATA is a list of directories containing data files 15 | # INCLUDES is a list of directories containing header files 16 | #--------------------------------------------------------------------------------- 17 | TARGET := switch/libflixel++ 18 | SOURCES := source 19 | DATA := data 20 | INCLUDES := include 21 | 22 | #--------------------------------------------------------------------------------- 23 | # options for code generation 24 | #--------------------------------------------------------------------------------- 25 | ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec 26 | 27 | CFLAGS := -g -Wall -Werror -Wno-unused-variable \ 28 | -ffunction-sections \ 29 | -fdata-sections \ 30 | $(ARCH) \ 31 | $(BUILD_CFLAGS) \ 32 | -D__SWITCH__ 33 | 34 | CFLAGS += $(INCLUDE) 35 | 36 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions 37 | 38 | ASFLAGS := -g $(ARCH) 39 | 40 | #--------------------------------------------------------------------------------- 41 | # list of directories containing libraries, this must be the top level containing 42 | # include and lib 43 | #--------------------------------------------------------------------------------- 44 | LIBDIRS := $(PORTLIBS) $(LIBNX) 45 | 46 | #--------------------------------------------------------------------------------- 47 | # no real need to edit anything past this point unless you need to add additional 48 | # rules for different file extensions 49 | #--------------------------------------------------------------------------------- 50 | ifneq ($(BUILD),$(notdir $(CURDIR))) 51 | #--------------------------------------------------------------------------------- 52 | 53 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ 54 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) 55 | 56 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 57 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 58 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 59 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 60 | 61 | #--------------------------------------------------------------------------------- 62 | # use CXX for linking C++ projects, CC for standard C 63 | #--------------------------------------------------------------------------------- 64 | ifeq ($(strip $(CPPFILES)),) 65 | #--------------------------------------------------------------------------------- 66 | export LD := $(CC) 67 | #--------------------------------------------------------------------------------- 68 | else 69 | #--------------------------------------------------------------------------------- 70 | export LD := $(CXX) 71 | #--------------------------------------------------------------------------------- 72 | endif 73 | #--------------------------------------------------------------------------------- 74 | 75 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) 76 | export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) 77 | export OFILES := $(OFILES_BIN) $(OFILES_SRC) 78 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) 79 | 80 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ 81 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 82 | -I$(CURDIR)/$(BUILD) 83 | 84 | .PHONY: clean all 85 | 86 | #--------------------------------------------------------------------------------- 87 | all: build/$(TARGET).a build/$(TARGET)d.a 88 | 89 | lib: 90 | @[ -d $@ ] || mkdir -p build/ 91 | 92 | release: 93 | @[ -d $@ ] || mkdir -p $@ 94 | 95 | debug: 96 | @[ -d $@ ] || mkdir -p $@ 97 | 98 | build/$(TARGET).a : lib release $(SOURCES) $(INCLUDES) 99 | @$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \ 100 | BUILD_CFLAGS="-DNDEBUG=1 -O2" \ 101 | DEPSDIR=$(CURDIR)/release \ 102 | --no-print-directory -C release \ 103 | -f $(CURDIR)/mk/switch.mk 104 | 105 | build/$(TARGET)d.a : lib debug $(SOURCES) $(INCLUDES) 106 | @$(MAKE) BUILD=debug OUTPUT=$(CURDIR)/$@ \ 107 | BUILD_CFLAGS="-DDEBUG=1 -Og" \ 108 | DEPSDIR=$(CURDIR)/debug \ 109 | --no-print-directory -C debug \ 110 | -f $(CURDIR)/mk/switch.mk 111 | 112 | dist-bin: all 113 | @tar --exclude=*~ -cjf lib$(TARGET).tar.bz2 include lib 114 | 115 | dist-src: 116 | @tar --exclude=*~ -cjf lib$(TARGET)-src.tar.bz2 include source Makefile 117 | 118 | dist: dist-src dist-bin 119 | 120 | #--------------------------------------------------------------------------------- 121 | clean: 122 | @echo clean ... 123 | @rm -fr release debug lib *.bz2 124 | 125 | #--------------------------------------------------------------------------------- 126 | else 127 | 128 | DEPENDS := $(OFILES:.o=.d) 129 | 130 | #--------------------------------------------------------------------------------- 131 | # main targets 132 | #--------------------------------------------------------------------------------- 133 | $(OUTPUT) : $(OFILES) 134 | 135 | $(OFILES_SRC) : $(HFILES) 136 | 137 | #--------------------------------------------------------------------------------- 138 | %_bin.h %.bin.o : %.bin 139 | #--------------------------------------------------------------------------------- 140 | @echo $(notdir $<) 141 | @$(bin2o) 142 | 143 | 144 | -include $(DEPENDS) 145 | 146 | #--------------------------------------------------------------------------------------- 147 | endif 148 | #--------------------------------------------------------------------------------------- 149 | 150 | -------------------------------------------------------------------------------- /mk/wii.mk: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | # Clear the implicit built in rules 3 | #--------------------------------------------------------------------------------- 4 | .SUFFIXES: 5 | #--------------------------------------------------------------------------------- 6 | ifeq ($(strip $(DEVKITPPC)),) 7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") 8 | endif 9 | 10 | include $(DEVKITPPC)/wii_rules 11 | 12 | #--------------------------------------------------------------------------------- 13 | # TARGET is the name of the output 14 | # BUILD is the directory where object files & intermediate files will be placed 15 | # SOURCES is a list of directories containing source code 16 | # INCLUDES is a list of directories containing extra header files 17 | #--------------------------------------------------------------------------------- 18 | TARGET := wii/libflixel++ 19 | BUILD := obj 20 | SOURCES := source bundles/tinyxml2/tinyxml2.cpp 21 | DATA := data 22 | INCLUDES := include 23 | 24 | #--------------------------------------------------------------------------------- 25 | # version for release generation 26 | #--------------------------------------------------------------------------------- 27 | MAJOR = 0 28 | MINOR = 3 29 | REVISION = 0f 30 | 31 | #--------------------------------------------------------------------------------- 32 | # options for code generation 33 | #--------------------------------------------------------------------------------- 34 | 35 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) `freetype-config --cflags` -D__WII__ 36 | CXXFLAGS = $(CFLAGS) 37 | 38 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map 39 | 40 | #--------------------------------------------------------------------------------- 41 | # any extra libraries we wish to link with the project 42 | #--------------------------------------------------------------------------------- 43 | LIBS := `freetype-config --libs` -lpng -lz -logc -lm 44 | 45 | #--------------------------------------------------------------------------------- 46 | # list of directories containing libraries, this must be the top level containing 47 | # include and lib 48 | #--------------------------------------------------------------------------------- 49 | LIBDIRS := $(PORTLIBS) 50 | 51 | #--------------------------------------------------------------------------------- 52 | # no real need to edit anything past this point unless you need to add additional 53 | # rules for different file extensions 54 | #--------------------------------------------------------------------------------- 55 | ifneq ($(BUILD),$(notdir $(CURDIR))) 56 | #--------------------------------------------------------------------------------- 57 | 58 | export OUTPUT := $(CURDIR)/$(TARGET) 59 | 60 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ 61 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) 62 | 63 | export DEPSDIR := $(CURDIR)/$(BUILD) 64 | 65 | #--------------------------------------------------------------------------------- 66 | # automatically build a list of object files for our project 67 | #--------------------------------------------------------------------------------- 68 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 69 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 70 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 71 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) 72 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 73 | 74 | #--------------------------------------------------------------------------------- 75 | # use CXX for linking C++ projects, CC for standard C 76 | #--------------------------------------------------------------------------------- 77 | ifeq ($(strip $(CPPFILES)),) 78 | export LD := $(CC) 79 | else 80 | export LD := $(CXX) 81 | endif 82 | 83 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) 84 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) 85 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) 86 | 87 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) 88 | 89 | #--------------------------------------------------------------------------------- 90 | # build a list of include paths 91 | #--------------------------------------------------------------------------------- 92 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ 93 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 94 | -I$(CURDIR)/include \ 95 | -I$(CURDIR)/$(BUILD) \ 96 | -I$(LIBOGC_INC) \ 97 | -I../bundles/tinyxml2/ 98 | 99 | #--------------------------------------------------------------------------------- 100 | # build a list of library paths 101 | #--------------------------------------------------------------------------------- 102 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ 103 | -L$(LIBOGC_LIB) 104 | 105 | export OUTPUT := $(CURDIR)/build/$(TARGET) 106 | .PHONY: $(BUILD) clean 107 | 108 | #--------------------------------------------------------------------------------- 109 | $(BUILD): 110 | @[ -d $@ ] || mkdir -p $@ 111 | @[ -d $(CURDIR)/build ] || mkdir -p $(CURDIR)/build 112 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/mk/wii.mk 113 | 114 | #--------------------------------------------------------------------------------- 115 | clean: 116 | @echo clean ... 117 | @rm -fr $(BUILD) $(OUTPUT).a $(OUTPUT) $(CURDIR)/lib $(TARGET)-*.tgz 118 | #--------------------------------------------------------------------------------- 119 | install: 120 | @[ -d $(PORTLIBS_PATH)/wii/lib ] || mkdir -p $(PORTLIBS_PATH)/wii/lib 121 | cp $(OUTPUT).a $(PORTLIBS_PATH)/wii/lib/$(TARGET).a 122 | @[ -d $(PORTLIBS_PATH)/wii/include ] || mkdir -p $(PORTLIBS_PATH)/wii/include 123 | cp -fr include/* $(PORTLIBS_PATH)/wii/include/. 124 | 125 | #--------------------------------------------------------------------------------- 126 | uninstall: 127 | rm $(PORTLIBS_PATH)/wii/lib/$(TARGET).a 128 | rm -fr $(PORTLIBS_PATH)/wii/include/flixel++* 129 | 130 | 131 | #--------------------------------------------------------------------------------- 132 | tgz: 133 | tar -C $(CURDIR) -czf $(TARGET)-$(MAJOR).$(MINOR).$(REVISION).tgz lib include 134 | 135 | #--------------------------------------------------------------------------------- 136 | src: 137 | make clean 138 | tar -C $(CURDIR) --exclude=*.tgz -czf $(TARGET)-$(MAJOR).$(MINOR).$(REVISION)_src.tgz * 139 | 140 | #--------------------------------------------------------------------------------- 141 | run: 142 | wiiload $(TARGET).dol 143 | 144 | #--------------------------------------------------------------------------------- 145 | %.a: 146 | @echo linking to lib ... $(notdir $@) 147 | @$(AR) -rc $@ $^ 148 | #--------------------------------------------------------------------------------- 149 | else 150 | 151 | DEPENDS := $(OFILES:.o=.d) 152 | 153 | #--------------------------------------------------------------------------------- 154 | # main targets 155 | #--------------------------------------------------------------------------------- 156 | $(OUTPUT).a: $(OFILES) 157 | 158 | #--------------------------------------------------------------------------------- 159 | # This rule links in binary data with the .jpg extension 160 | #--------------------------------------------------------------------------------- 161 | %.jpg.o : %.jpg 162 | #--------------------------------------------------------------------------------- 163 | @echo $(notdir $<) 164 | $(bin2o) 165 | 166 | -include $(DEPENDS) 167 | 168 | #--------------------------------------------------------------------------------- 169 | endif 170 | #--------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /source/FlxAnimation.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxAnimation.hpp" 2 | 3 | Flx::Animation::Animation() 4 | : frames() 5 | {} 6 | 7 | int Flx::Animation::size() 8 | { 9 | return frames.size(); 10 | } 11 | 12 | Flx::AnimationController::AnimationController() 13 | : animations() 14 | { 15 | } 16 | 17 | void Flx::AnimationController::fromSparrow(const char* path, const char* defaultAnim, int fps) 18 | { 19 | tinyxml2::XMLDocument doc; 20 | doc.LoadFile(path); 21 | auto root = doc.FirstChildElement("TextureAtlas"); 22 | tinyxml2::XMLElement* subTexture = root->FirstChildElement("SubTexture"); 23 | do 24 | { 25 | const std::string name = std::string(subTexture->Attribute("name")).substr(0, name.length() - 4); 26 | if(animations.find(name) == animations.end()) 27 | animations.insert({name, Animation()}); 28 | const int x = subTexture->FloatAttribute("x"); 29 | const int y = subTexture->FloatAttribute("y"); 30 | const int width = subTexture->FloatAttribute("width"); 31 | const int height = subTexture->FloatAttribute("height"); 32 | const int frameX = subTexture->FloatAttribute("frameX"); 33 | const int frameY = subTexture->FloatAttribute("frameY"); 34 | 35 | Frame frame; 36 | frame.x = x; 37 | frame.y = y; 38 | frame.width = width; 39 | frame.height = height; 40 | frame.frameX = frameX; 41 | frame.frameY = frameY; 42 | animations[name].frames.push_back(frame); 43 | animations[name].fps = fps; 44 | } while((subTexture = subTexture->NextSiblingElement("SubTexture")) != nullptr); 45 | curAnim = &animations[defaultAnim]; 46 | animated = true; 47 | } 48 | 49 | void Flx::AnimationController::play(const char* name){ 50 | curAnim = &animations[name]; 51 | } 52 | 53 | Flx::Frame *Flx::AnimationController::getCurAnim() 54 | { 55 | return &(curAnim->frames[frameIndex]); 56 | } 57 | -------------------------------------------------------------------------------- /source/FlxAssets.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxAssets.hpp" 2 | 3 | void* Flx::Assets::defaultFont = nullptr; 4 | void* Flx::Assets::defaultCursor = nullptr; -------------------------------------------------------------------------------- /source/FlxBackends.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxBackends.hpp" 2 | #include "flixel++/FlxG.hpp" 3 | #include "flixel++/FlxLog.hpp" 4 | #include "flixel++/FlxMacros.hpp" 5 | #include "assets/vcr.h" 6 | #include "assets/cursor.h" 7 | 8 | #ifdef FLIXEL_SDL 9 | 10 | #ifdef SDL_LEGACY 11 | #include 12 | #include 13 | #include 14 | #include "flixel++/SDL_Backports.hpp" 15 | #else 16 | #include 17 | #include 18 | #include 19 | #endif 20 | 21 | #endif 22 | using Flx::Globals::game, Flx::Globals::width, Flx::Globals::height; 23 | 24 | // ------------------------------------- 25 | 26 | Flx::Backends::Backend::Backend(){} 27 | Flx::Backends::Backend::~Backend(){} 28 | Flx::Graphic* Flx::Backends::Backend::requestTexture(const char* path){ return nullptr; } 29 | Flx::Graphic* Flx::Backends::Backend::requestTexture(const void* data, const size_t size){ return nullptr; } 30 | Flx::Graphic* Flx::Backends::Backend::requestText(const char* text){ return nullptr; } 31 | Flx::Graphic* Flx::Backends::Backend::requestRectangle(float width, float height, int color){ return nullptr; } 32 | bool Flx::Backends::Backend::deleteTexture(void* spr){ return false; } 33 | void Flx::Backends::Backend::runEvents(){} 34 | void Flx::Backends::Backend::update(){} 35 | void Flx::Backends::Backend::render(Flx::Sprite* spr){} 36 | uint32_t Flx::Backends::Backend::getTicks(){ return 0; } 37 | void Flx::Backends::Backend::delay(uint32_t ms){} 38 | 39 | #ifdef FLIXEL_SDL 40 | // ------------------------------------- 41 | Flx::Backends::SDL::SDL() 42 | : window(nullptr), 43 | renderer(nullptr) 44 | { 45 | SDL_Init(SDL_INIT_EVERYTHING); 46 | IMG_Init(IMG_INIT_PNG | IMG_INIT_JPG); 47 | TTF_Init(); 48 | 49 | #ifdef SDL_LEGACY 50 | window = SDL_SetVideoMode(width, height, 0, 0); 51 | SDL_WM_SetCaption(title, NULL); 52 | SDL_FillRect(window, NULL, SDL_MapRGB(window->format, 0, 0, 0)); 53 | #else 54 | window = SDL_CreateWindow(game->title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL); 55 | renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); 56 | SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); 57 | SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" ); 58 | SDL_SetWindowResizable(window, SDL_TRUE); 59 | #endif 60 | 61 | SDL_ShowCursor(1); 62 | 63 | SDL_RWops* rw = SDL_RWFromConstMem((void*)vcr_ttf, vcr_ttf_size); 64 | Flx::Assets::defaultFont = TTF_OpenFontRW(rw, 1, 24); 65 | 66 | SDL_Surface* temp = IMG_LoadPNG_RW(SDL_RWFromConstMem((void*)cursor_png, cursor_png_size)); 67 | 68 | #ifdef SDL_LEGACY 69 | Flx::Assets::defaultCursor = temp; 70 | #else 71 | Flx::Assets::defaultCursor = SDL_CreateTextureFromSurface(renderer, temp); 72 | SDL_FreeSurface(temp); 73 | #endif 74 | } 75 | 76 | Flx::Backends::SDL::~SDL() 77 | { 78 | #ifdef SDL_LEGACY 79 | SDL_FreeSurface(window); 80 | #else 81 | SDL_DestroyRenderer(renderer); 82 | SDL_DestroyWindow(window); 83 | #endif 84 | TTF_Quit(); 85 | } 86 | 87 | Flx::Graphic* Flx::Backends::SDL::requestTexture(const char* path) 88 | { 89 | SDL_Surface* img = IMG_Load(path); 90 | if(!img){ 91 | Flx::Log::warn(SDL_GetError()); 92 | return nullptr; 93 | } 94 | return requestTexture(img); 95 | } 96 | 97 | bool Flx::Backends::SDL::deleteTexture(void* tex) 98 | { 99 | SDL_DestroyTexture((SDL_Texture*)tex); 100 | return true; 101 | } 102 | 103 | Flx::Graphic* Flx::Backends::SDL::requestTexture(const void* data, const size_t size) 104 | { 105 | return requestTexture(IMG_Load_RW(SDL_RWFromConstMem(data, size),0)); 106 | } 107 | 108 | Flx::Graphic* Flx::Backends::SDL::requestTexture(SDL_Surface* surface) 109 | { 110 | Flx::Graphic* tex = new Flx::Graphic(surface->w, surface->h, (void*)SDL_CreateTextureFromSurface(renderer, surface)); 111 | SDL_FreeSurface(surface); 112 | return tex; 113 | } 114 | 115 | Flx::Graphic* Flx::Backends::SDL::requestText(const char* text) 116 | { 117 | return requestTexture(TTF_RenderText_Solid((TTF_Font*)Flx::Assets::defaultFont, text, {255,255,255,255})); 118 | } 119 | 120 | Flx::Graphic* Flx::Backends::SDL::requestRectangle(float width, float height, int color) 121 | { 122 | Uint32 rmask, gmask, bmask, amask; 123 | #if SDL_BYTEORDER == SDL_BIG_ENDIAN 124 | rmask = 0xff000000; 125 | gmask = 0x00ff0000; 126 | bmask = 0x0000ff00; 127 | amask = 0x000000ff; 128 | #else 129 | rmask = 0x000000ff; 130 | gmask = 0x0000ff00; 131 | bmask = 0x00ff0000; 132 | amask = 0xff000000; 133 | #endif 134 | auto textemp = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, rmask, gmask, bmask, amask); 135 | SDL_FillRect(textemp, nullptr, color); 136 | 137 | return requestTexture(textemp); 138 | } 139 | 140 | void Flx::Backends::SDL::runEvents() 141 | { 142 | SDL_Event e; 143 | while (SDL_PollEvent(&e)) 144 | { 145 | switch(e.type) 146 | { 147 | case SDL_KEYDOWN: 148 | #ifndef SDL_LEGACY 149 | if(e.key.repeat == 0) 150 | #endif 151 | Flx::Globals::keys->keys[e.key.keysym.sym % 255] = true; 152 | break; 153 | case SDL_KEYUP: 154 | Flx::Globals::keys->keys[e.key.keysym.sym % 255] = false; 155 | break; 156 | #ifndef SDL_LEGACY 157 | case SDL_WINDOWEVENT: 158 | switch(e.window.event){ 159 | case SDL_WINDOWEVENT_RESIZED: 160 | SDL_GetWindowSize(window, &Flx::Globals::width, &Flx::Globals::height); 161 | game->curState->onResize(Flx::Globals::width, Flx::Globals::height); 162 | case SDL_WINDOWEVENT_FOCUS_GAINED: 163 | game->paused = false; 164 | break; 165 | case SDL_WINDOWEVENT_FOCUS_LOST: 166 | game->paused = true; 167 | break; 168 | } 169 | break; 170 | #endif 171 | case SDL_QUIT: 172 | game->quitting = true; 173 | break; 174 | default: 175 | break; 176 | } 177 | } 178 | } 179 | 180 | inline const SDL_FRect toSDLFRect(Flx::Rect& rect){ 181 | return SDL_FRect{ 182 | rect.x, rect.y, rect.width, rect.height 183 | }; 184 | } 185 | 186 | inline const SDL_Rect toSDLRect(Flx::Rect& rect) 187 | { 188 | return SDL_Rect{ 189 | (Sint16)rect.x,(Sint16)rect.y,(Uint16)rect.width,(Uint16)rect.height 190 | }; 191 | } 192 | 193 | inline const SDL_FPoint toSDLFPoint(Flx::Point& rect) 194 | { 195 | return SDL_FPoint{ 196 | rect.x,rect.y 197 | }; 198 | } 199 | 200 | void Flx::Backends::SDL::update() 201 | { 202 | #ifdef SDL_LEGACY 203 | game->curState->update(); 204 | SDL_FillRect(window, NULL, 0x000000); 205 | game->curState->draw(); 206 | SDL_Flip(window); 207 | #else 208 | game->curState->update(); 209 | SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); 210 | SDL_RenderClear(renderer); 211 | 212 | game->curState->draw(); 213 | SDL_RenderPresent(renderer); 214 | #endif 215 | } 216 | 217 | void Flx::Backends::SDL::render(Flx::Sprite* spr) 218 | { 219 | SDL_Rect stuff = toSDLRect(spr->clipRect); 220 | if(spr->animation->animated) 221 | { 222 | auto anim = spr->animation->getCurAnim(); 223 | stuff.x = anim->x; 224 | stuff.y = anim->y; 225 | stuff.w = anim->width; 226 | stuff.h = anim->height; 227 | } 228 | #ifdef SDL_LEGACY 229 | SDL_Rect dst = SDL_Rect{ 230 | (Sint16)spr->x - (Sint16)(spr->width / 2), 231 | (Sint16)spr->y - (Sint16)(spr->height / 2), 232 | (Uint16)spr->width * (Uint16)spr->scale.x, 233 | (Uint16)spr->height * (Uint16)spr->scale.y 234 | }; 235 | 236 | //SDL_SetAlpha(graphic->bitmap, SDL_SRCALPHA, 255 - (alpha % 101) * 255 / 100); 237 | SDL_UpperBlitScaled(graphic->bitmap, NULL, Flx::Globals::game->window, &dst); 238 | #else 239 | SDL_FRect dst = SDL_FRect{ 240 | spr->x - (spr->width / 2), 241 | spr->y - (spr->height / 2), 242 | spr->width * spr->scale.x, 243 | spr->height * spr->scale.y 244 | }; 245 | 246 | auto originF = toSDLFPoint(spr->origin); 247 | SDL_SetTextureAlphaMod((SDL_Texture*)spr->graphic->bitmap, (spr->alpha % 101) * 255 / 100); 248 | SDL_RenderCopyExF(renderer, (SDL_Texture*)spr->graphic->bitmap, &stuff, &dst, spr->angle, &originF, SDL_FLIP_NONE); 249 | #endif 250 | } 251 | 252 | uint32_t Flx::Backends::SDL::getTicks() 253 | { 254 | return SDL_GetTicks(); 255 | } 256 | 257 | void Flx::Backends::SDL::delay(uint32_t ms) 258 | { 259 | SDL_Delay(ms); 260 | } 261 | #endif 262 | // ------------------------------------- -------------------------------------------------------------------------------- /source/FlxBasic.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxBasic.hpp" 2 | 3 | Flx::Basic::Basic() 4 | : ID(0), 5 | visible(false) 6 | {} 7 | 8 | Flx::Basic::~Basic() 9 | {} 10 | 11 | void Flx::Basic::update() 12 | {} 13 | 14 | void Flx::Basic::draw() 15 | {} -------------------------------------------------------------------------------- /source/FlxColor.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxColor.hpp" 2 | 3 | Flx::Color::Color(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) 4 | : r(red), g(green), b(blue), a(alpha) 5 | {} 6 | 7 | Flx::Color Flx::Color::fromHex(int color) 8 | { 9 | return Color 10 | { 11 | static_cast((color >> 24) & 0xFF), 12 | static_cast((color >> 16) & 0xFF), 13 | static_cast((color >> 8) & 0xFF), 14 | static_cast((color) & 0xFF) 15 | }; 16 | } -------------------------------------------------------------------------------- /source/FlxGame.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxGame.hpp" 2 | #include "flixel++/FlxG.hpp" 3 | #include "flixel++/FlxAssets.hpp" 4 | #include "flixel++/FlxMacros.hpp" 5 | #include "flixel++/FlxSplash.hpp" 6 | 7 | int Flx::Globals::width = 0; 8 | int Flx::Globals::height = 0; 9 | 10 | Flx::Game* Flx::Globals::game = nullptr; 11 | Flx::Random* Flx::Globals::random = nullptr; 12 | Flx::SoundManager* Flx::Globals::sound = nullptr; 13 | Flx::Keyboard* Flx::Globals::keys = nullptr; 14 | Flx::Mouse* Flx::Globals::mouse = nullptr; 15 | 16 | bool Flx::Globals::switchState(Flx::State* state){ 17 | return game->switchState(state); 18 | } 19 | 20 | void initializeConsoles() 21 | { 22 | #if defined(__3DS__) || defined(__SWITCH__) 23 | romfsInit(); 24 | #endif 25 | } 26 | 27 | Flx::Game::Game(const char* title, int width, int height, int framerate, Flx::State* initialState, bool skipSplash) 28 | : title(), 29 | framerate(framerate), 30 | curState(nullptr), 31 | backend(nullptr) 32 | { 33 | this->title = title; 34 | 35 | Flx::Globals::game = this; 36 | 37 | Flx::Globals::width = width; 38 | Flx::Globals::height = height; 39 | 40 | this->backend = new Flx::Backends::SDL(); 41 | 42 | initializeConsoles(); 43 | 44 | setupGlobals(); 45 | 46 | if(skipSplash) 47 | switchState(initialState); 48 | else 49 | switchState(new Flx::Splash(initialState)); 50 | } 51 | 52 | Flx::Game::~Game() 53 | { 54 | destroyGlobals(); 55 | delete backend; 56 | } 57 | 58 | void Flx::Game::setupGlobals() 59 | { 60 | Flx::Globals::random = new Flx::Random(); 61 | 62 | Flx::Globals::sound = new Flx::SoundManager(); 63 | 64 | Flx::Globals::keys = new Flx::Keyboard(); 65 | 66 | Flx::Globals::mouse = new Flx::Mouse(); 67 | } 68 | 69 | void Flx::Game::destroyGlobals() 70 | { 71 | delete Flx::Globals::random; 72 | delete Flx::Globals::sound; 73 | delete Flx::Globals::keys; 74 | delete Flx::Globals::mouse; 75 | } 76 | 77 | bool Flx::Game::switchState(Flx::State* state) 78 | { 79 | if (curState != nullptr) 80 | { 81 | delete curState; 82 | } 83 | curState = state; 84 | curState->create(); 85 | return true; 86 | } 87 | 88 | void Flx::Game::runEvents() 89 | { 90 | backend->runEvents(); 91 | } 92 | 93 | void Flx::Game::run() 94 | { 95 | backend->update(); 96 | } 97 | 98 | void Flx::Game::start() 99 | { 100 | while (!quitting) 101 | { 102 | runEvents(); 103 | if(!paused) 104 | run(); 105 | backend->delay(1000.0f / framerate); 106 | } 107 | } -------------------------------------------------------------------------------- /source/FlxGraphic.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxGraphic.hpp" 2 | #include "flixel++/FlxGame.hpp" 3 | #include "flixel++/FlxG.hpp" 4 | #include "flixel++/FlxLog.hpp" 5 | 6 | Flx::Graphic::Graphic(int width, int height, void* tex) 7 | : width(width), height(height), bitmap(tex) 8 | { 9 | 10 | } 11 | 12 | Flx::Graphic::~Graphic(){ 13 | Flx::Globals::game->backend->deleteTexture(bitmap); 14 | }; 15 | 16 | uint32_t Flx::Graphic::getPixel32(int x, int y){ 17 | return 0; 18 | } -------------------------------------------------------------------------------- /source/FlxGroup.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxGroup.hpp" 2 | 3 | //G.. TODO: REMAKE THIS INTO A FLXTYPEDGROUP CUS IS MORE INTUITIVE AND PRECISE 4 | 5 | Flx::Group::Group() 6 | : members() 7 | {} 8 | 9 | Flx::Group::~Group(){} 10 | 11 | Flx::Basic* Flx::Group::add(Flx::Basic& obj){ 12 | members.push_back(&obj); 13 | return &obj; 14 | } 15 | Flx::Basic* Flx::Group::add(Flx::Basic* obj){ 16 | members.push_back(obj); 17 | return obj; 18 | } 19 | Flx::Basic* Flx::Group::operator+=(Flx::Basic& obj){ 20 | return this->add(obj); 21 | } 22 | Flx::Basic* Flx::Group::operator+=(Flx::Basic* obj){ 23 | return this->add(obj); 24 | } 25 | 26 | void Flx::Group::update(){ 27 | for(Flx::Basic* obj : members) 28 | obj->update(); 29 | } 30 | 31 | void Flx::Group::draw(){ 32 | for(Flx::Basic* obj : members) 33 | obj->draw(); 34 | } -------------------------------------------------------------------------------- /source/FlxHttp.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/Common.hpp" 2 | #ifdef FLIXEL_USE_CURL 3 | #include "flixel++/FlxHttp.hpp" 4 | #include "flixel++/FlxMacros.hpp" 5 | #include "curl/curl.h" 6 | 7 | Flx::Http::Http(const std::string& url){ 8 | received = true; 9 | storage = requestURLtext(url); 10 | } 11 | 12 | Flx::Http::~Http() 13 | { 14 | 15 | } 16 | 17 | std::string Flx::Http::requestURLtext(const std::string& url) 18 | { 19 | std::string result; 20 | CURLcode exit; 21 | 22 | curl = curl_easy_init(); 23 | curl_easy_setopt(curl, CURLOPT_URL,url.c_str()); 24 | curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); 25 | curl_easy_setopt(curl, CURLOPT_WRITEDATA, &result); 26 | 27 | exit = curl_easy_perform(curl); 28 | 29 | curl_easy_cleanup(curl); 30 | 31 | if(exit == CURLE_OK){ 32 | onData = true; 33 | onError = false; 34 | received = false; 35 | } 36 | else{ 37 | onError = true; 38 | onData = false; 39 | } 40 | 41 | 42 | return result; 43 | } 44 | 45 | size_t Flx::Http::WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) 46 | { 47 | ((std::string *)userp)->append((char *)contents, size * nmemb); 48 | return size * nmemb; 49 | } 50 | 51 | #endif -------------------------------------------------------------------------------- /source/FlxKeyboard.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxKeyboard.hpp" 2 | #include 3 | 4 | Flx::Keyboard::Keyboard() 5 | : keys(new bool[255]) 6 | { 7 | memset(keys, false, 255); 8 | } 9 | 10 | bool Flx::Keyboard::pressed(const unsigned char key) 11 | { 12 | return keys[key]; 13 | } 14 | 15 | bool Flx::Keyboard::justPressed(const unsigned char key){ 16 | bool pressed = keys[key]; 17 | if(pressed) 18 | keys[key] = false; 19 | return pressed; 20 | } -------------------------------------------------------------------------------- /source/FlxLog.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxLog.hpp" 2 | 3 | using namespace std::literals::string_literals; 4 | 5 | std::vector Flx::Log::logs = std::vector(); 6 | 7 | void Flx::Log::warn(const char* msg) 8 | { 9 | logs.push_back("Warning: "s + msg); 10 | } 11 | 12 | void Flx::Log::error(const char* msg) 13 | { 14 | logs.push_back("Error: "s + msg); 15 | } 16 | 17 | const char* Flx::Log::recent(){ 18 | #if __cpp_exceptions 19 | try{ 20 | return logs.at(logs.size()).c_str(); 21 | } 22 | catch(std::exception& e){ 23 | return "No recent logs"; 24 | } 25 | #else 26 | return "No recent logs"; 27 | #endif 28 | } -------------------------------------------------------------------------------- /source/FlxManagers.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxManagers.hpp" 2 | 3 | Flx::Random::Random() 4 | : engine(std::chrono::system_clock::now().time_since_epoch().count()) 5 | { 6 | } 7 | 8 | Flx::Random::~Random() {} 9 | 10 | Flx::Random::Random(int seed) 11 | : engine(seed) 12 | { 13 | } 14 | 15 | int Flx::Random::number(int min, int max) 16 | { 17 | return engine() % (max - min + 1) + min; 18 | } 19 | 20 | float Flx::Random::floating(float min, float max) 21 | { 22 | return static_cast(engine()) / engine.max() * (max - min) + min; 23 | } 24 | 25 | bool Flx::Random::boolean(float chance) 26 | { 27 | return floating(0.0f, 100.0f) < chance; 28 | } 29 | 30 | Flx::SoundManager::SoundManager() 31 | : music(nullptr) 32 | { 33 | #ifdef FLIXEL_OPENAL 34 | device = alcOpenDevice(NULL); 35 | context = alcCreateContext(device, NULL); 36 | alcMakeContextCurrent(context); 37 | #endif 38 | } 39 | 40 | Flx::SoundManager::~SoundManager() 41 | { 42 | #ifdef FLIXEL_OPENAL 43 | alcDestroyContext (context); 44 | alcCloseDevice (device); 45 | #endif 46 | } -------------------------------------------------------------------------------- /source/FlxMouse.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxMouse.hpp" 2 | #include "flixel++/FlxG.hpp" 3 | #include "flixel++/FlxPoint.hpp" 4 | #include "flixel++/FlxMacros.hpp" 5 | 6 | Flx::Mouse::Mouse() 7 | { 8 | cursor = Flx::Assets::defaultCursor; 9 | enable = true; 10 | setGraphic(); 11 | 12 | this->x = Flx::Globals::width / 2; 13 | this->y = Flx::Globals::height / 2; 14 | } 15 | 16 | Flx::Mouse::~Mouse(){ 17 | 18 | } 19 | 20 | void Flx::Mouse::draw() 21 | { 22 | if (!enable) 23 | return; 24 | /* 25 | SDL_Rect dest = { 26 | static_cast(this->x), 27 | static_cast(this->y), 28 | static_cast(clipRect.width), 29 | static_cast(clipRect.height) 30 | }; 31 | */ 32 | //auto src = clipRect.toSDLRect(); 33 | 34 | #ifdef SDL_LEGACY 35 | SDL_UpperBlitScaled(cursor, &src, Flx::Globals::game->window, &dest); 36 | #else 37 | //SDL_RenderCopy(Flx::Globals::game->renderer, cursor, &src, &dest); 38 | #endif 39 | } 40 | 41 | void Flx::Mouse::setGraphic() 42 | { 43 | #ifdef SDL_LEGACY 44 | clipRect = {0, 0, cursor->w, cursor->h}; 45 | #else 46 | Flx::Point size; 47 | //SDL_QueryTexture(cursor, NULL, NULL, &size.w, &size.h); 48 | 49 | clipRect = {0, 0, static_cast(size.w), static_cast(size.h)}; 50 | #endif 51 | } 52 | 53 | void Flx::Mouse::loadGraphic(const char* path) 54 | { 55 | #ifdef SDL_LEGACY 56 | cursor = IMG_Load(path); 57 | #else 58 | //auto surface = IMG_Load(path); 59 | //cursor = SDL_CreateTextureFromSurface(Flx::Globals::game->renderer, surface); 60 | //SDL_FreeSurface(surface); 61 | #endif 62 | setGraphic(); 63 | } 64 | 65 | void Flx::Mouse::update() 66 | { 67 | if (enable) 68 | { 69 | //SDL_GetMouseState(&pos._x, &pos._y); 70 | this->x = pos._x; 71 | this->y = pos._y; 72 | } 73 | } -------------------------------------------------------------------------------- /source/FlxNet.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxNet.hpp" 2 | 3 | #ifdef USE_SOCKETS 4 | Flx::Net::Net(const char* host, int port) { 5 | #ifdef _WIN32 6 | #else 7 | sock = socket(AF_INET, SOCK_STREAM, 0); 8 | hostent* hostentity = gethostbyname(host); 9 | addr.sin_family = AF_INET; 10 | addr.sin_port = htons(port); 11 | memcpy(&addr.sin_addr, hostentity->h_addr_list[0], hostentity->h_length); 12 | #endif 13 | } 14 | 15 | Flx::Net::~Net() { 16 | shutdown(sock, 2); 17 | } 18 | 19 | void Flx::Net::listen(int connections) { 20 | #ifdef _WIN32 21 | #else 22 | ::listen(sock, connections); 23 | #endif 24 | } 25 | 26 | void Flx::Net::send(const char* data) { 27 | #ifdef _WIN32 28 | #else 29 | ::send(sock, data, strlen(data), 0); 30 | #endif 31 | } 32 | 33 | std::string Flx::Net::read() { 34 | #ifdef _WIN32 35 | #else 36 | std::string str; 37 | int recvsize = 0; 38 | char buffer[1024]; 39 | while((recvsize = ::recv(sock, buffer, 1024, 0)) > 1) 40 | { 41 | std::cout << recvsize << std::endl; 42 | str.append(buffer, recvsize); 43 | } 44 | return str; 45 | #endif 46 | } 47 | 48 | std::string Flx::Net::readUntil(char until) { 49 | #ifdef _WIN32 50 | #else 51 | std::stringbuf buffer; 52 | while(true) 53 | { 54 | char c; 55 | ssize_t code = ::recv(sock, &c, 1, 0); 56 | if(c == until || code < 1) 57 | break; 58 | buffer.sputc(c); 59 | } 60 | return buffer.str(); 61 | #endif 62 | } 63 | 64 | void Flx::Net::connect() { 65 | #ifdef _WIN32 66 | #else 67 | ::connect(sock, (sockaddr*)&addr, sizeof(addr)); 68 | #endif 69 | } 70 | #endif -------------------------------------------------------------------------------- /source/FlxObject.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxObject.hpp" 2 | 3 | Flx::Object::Object(float x, float y) 4 | : Basic(), 5 | x(x), y(y) 6 | { 7 | 8 | } 9 | 10 | Flx::Object::~Object() 11 | { 12 | 13 | } -------------------------------------------------------------------------------- /source/FlxPoint.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxPoint.hpp" 2 | 3 | Flx::Point::Point() 4 | : x(0), y(0) 5 | {} 6 | 7 | Flx::Point::Point(float x, float y) 8 | : x(x), y(y) 9 | {} 10 | 11 | Flx::Point::~Point(){} 12 | 13 | void Flx::Point::add(float x, float y) { 14 | this->x += x; 15 | this->y += y; 16 | } 17 | 18 | void Flx::Point::set(float x, float y) { 19 | this->x = x; 20 | this->y = y; 21 | } 22 | 23 | void Flx::Point::subtract(float x, float y) { 24 | this->x -= x; 25 | this->y -= y; 26 | } -------------------------------------------------------------------------------- /source/FlxRect.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxRect.hpp" 2 | 3 | Flx::Rect::Rect() 4 | : x(0), y(0), width(0), height(0) 5 | { 6 | } 7 | 8 | Flx::Rect::Rect(float x, float y, float width, float height) 9 | : x(x), y(y), width(width), height(height) 10 | { 11 | } 12 | 13 | Flx::Rect::~Rect() 14 | { 15 | 16 | } -------------------------------------------------------------------------------- /source/FlxScript.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxScript.hpp" 2 | 3 | Flx::Script::Script() 4 | { 5 | } 6 | 7 | Flx::Script::~Script() 8 | { 9 | } 10 | 11 | void Flx::Script::addFunction(const char *name, std::function func) 12 | { 13 | } 14 | 15 | void Flx::Script::runFunction(const char *func) 16 | { 17 | } 18 | 19 | int Flx::Script::getInteger(const char *name) 20 | { 21 | return 0; 22 | } 23 | 24 | float Flx::Script::getFloat(const char *name) 25 | { 26 | return 0.0f; 27 | } 28 | 29 | bool Flx::Script::getBool(const char *name) 30 | { 31 | return false; 32 | } -------------------------------------------------------------------------------- /source/FlxSound.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxSound.hpp" 2 | #include "flixel++/FlxG.hpp" 3 | 4 | Flx::Sound::Sound() 5 | { 6 | } 7 | 8 | Flx::Sound::~Sound() 9 | { 10 | #ifdef FLIXEL_OPENAL 11 | alDeleteSources(1, &source); 12 | alDeleteBuffers(1, &buffer); 13 | vorbis_info_clear(info); 14 | #endif 15 | } 16 | 17 | void Flx::Sound::play() 18 | { 19 | startTime = Flx::Globals::game->backend->getTicks(); 20 | #ifdef FLIXEL_OPENAL 21 | alSourcePlay(source); 22 | #endif 23 | } 24 | 25 | void Flx::Sound::load(const char *path) 26 | { 27 | #if defined(TREMOR) && !defined(__WIN32) 28 | ov_open(fopen(path, "r"), &vorbis, nullptr, 0); 29 | #else 30 | ov_fopen(path, &vorbis); 31 | #endif 32 | 33 | info = ov_info(&vorbis, -1); 34 | 35 | #ifdef FLIXEL_OPENAL 36 | alGenBuffers(1, &buffer); 37 | #endif 38 | 39 | int current_section; 40 | while (true) 41 | { 42 | std::vector pcm(4096); 43 | long result = ov_read(&vorbis, pcm.data(), pcm.size(), 44 | #ifndef TREMOR 45 | 0, 2, 1, 46 | #endif 47 | ¤t_section 48 | ); 49 | 50 | if (result == 0) 51 | break; 52 | 53 | if (result < 0) 54 | { 55 | return; 56 | } 57 | 58 | bufferData.insert(bufferData.end(), pcm.begin(), pcm.begin() + result); 59 | } 60 | #ifdef FLIXEL_OPENAL 61 | alBufferData(buffer, AL_FORMAT_STEREO16, bufferData.data(), bufferData.size(), info->rate); 62 | alGenSources(1, &source); 63 | alSourcei(source, AL_BUFFER, buffer); 64 | #endif 65 | } 66 | 67 | float Flx::Sound::getPosition() 68 | { 69 | float val = 0; 70 | #ifdef FLIXEL_OPENAL 71 | alGetSourcef(buffer, AL_SEC_OFFSET, &val); 72 | #endif 73 | return val * 1000; 74 | } 75 | -------------------------------------------------------------------------------- /source/FlxSplash.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxSplash.hpp" 2 | #include "assets/logoGreen.h" 3 | #include "assets/logoBlue.h" 4 | #include "assets/logoCyan.h" 5 | #include "assets/logoYellow.h" 6 | #include "assets/logoRed.h" 7 | #include "assets/logoC.h" 8 | #include "flixel++/FlxMacros.hpp" 9 | #include "flixel++/FlxG.hpp" 10 | #include "flixel++/FlxColor.hpp" 11 | #include "flixel++/FlxLog.hpp" 12 | 13 | int elapsedTime = 0; 14 | int result = 0; 15 | const char flixel[8] = {'F','l','i','x','e','l','+','+'}; 16 | 17 | Flx::Splash::Splash(Flx::State* state) 18 | : nextState(state) 19 | { 20 | 21 | } 22 | 23 | void Flx::Splash::create() 24 | { 25 | 26 | yellow = new Flx::Sprite(0, 0); 27 | 28 | yellow->loadGraphic((void *)logoYellow_png, logoYellow_png_length); 29 | yellow->setGraphicSize((yellow->graphic->width / 9), (yellow->graphic->height / 9)); 30 | add(yellow); 31 | yellow->screenCenter(); 32 | yellow->visible = false; 33 | 34 | red = new Flx::Sprite(0, 0); 35 | red->loadGraphic((void *)logoRed_png, logoRed_png_length); 36 | red->setGraphicSize((red->graphic->width / 9), (red->graphic->height / 9) + 3); 37 | add(red); 38 | red->screenCenter(); 39 | red->visible = false; 40 | 41 | 42 | blue = new Flx::Sprite(0, 0); 43 | blue->loadGraphic((void *)logoBlue_png, logoBlue_png_length); 44 | blue->setGraphicSize((blue->graphic->width / 9), (blue->graphic->height / 9) +2 ); 45 | add(blue); 46 | blue->screenCenter(); 47 | blue->visible = false; 48 | 49 | cyan = new Flx::Sprite(0, 0); 50 | cyan->loadGraphic((void *)logoCyan_png, logoCyan_png_length); 51 | cyan->setGraphicSize((cyan->graphic->width / 9), (cyan->graphic->height / 9)); 52 | add(cyan); 53 | cyan->screenCenter(); 54 | cyan->visible = false; 55 | 56 | 57 | green = new Flx::Sprite(0, 0); 58 | green->loadGraphic((void *)logoGreen_png, logoGreen_png_length); 59 | green->setGraphicSize((green->graphic->width / 9) + 5, (green->graphic->height / 9) + 5); 60 | add(green); 61 | green->screenCenter(); 62 | 63 | cpp = new Flx::Sprite(0, 0); 64 | cpp->loadGraphic((void *)logoC_png, logoC_png_length); 65 | cpp->setGraphicSize((cpp->graphic->width / 9), (cpp->graphic->height / 9)); 66 | add(cpp); 67 | cpp->screenCenter(); 68 | cpp->visible = true; 69 | cpp->alpha = 0; 70 | 71 | flixelText = new Text(0,0,""); 72 | flixelText->screenCenter(); 73 | flixelText->y += 150; 74 | add(flixelText); 75 | 76 | //flixelSound = new Flx::Sound(); 77 | //flixelSound->load("assets/sounds/flixel.ogg"); 78 | //flixelSound->play(); 79 | } 80 | 81 | void Flx::Splash::update() 82 | { 83 | if(elapsedTime >= 7){ 84 | yellow->visible = true; 85 | } 86 | if(elapsedTime >= 14){ 87 | red->visible = true; 88 | } 89 | if(elapsedTime >= 21){ 90 | blue->visible = true; 91 | } 92 | if(elapsedTime >= 28){ 93 | cyan->visible = true; 94 | } 95 | 96 | if(elapsedTime >= 37){ 97 | green->visible = true; 98 | } 99 | 100 | if(elapsedTime >= 100 && elapsedTime <= 140 && elapsedTime % 5 == 0){ 101 | flixelText->setText(flixelText->text + flixel[(elapsedTime - 100) / 5]); 102 | } 103 | 104 | elapsedTime += 1; 105 | if(cpp->alpha < 100 && elapsedTime < 200 ) 106 | cpp->alpha += 2.5; 107 | 108 | if(elapsedTime >= 200 && cpp->alpha > 0) 109 | { 110 | yellow->alpha -= 1; 111 | red->alpha -= 1; 112 | blue->alpha -= 1; 113 | cyan->alpha -= 1; 114 | green->alpha -= 1; 115 | cpp->alpha -= 1; 116 | flixelText->alpha -= 1; 117 | } 118 | if(elapsedTime >= 330){ 119 | Flx::Globals::switchState(nextState); 120 | } 121 | } 122 | 123 | -------------------------------------------------------------------------------- /source/FlxSprite.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxSprite.hpp" 2 | #include "flixel++/FlxG.hpp" 3 | #include "flixel++/FlxColor.hpp" 4 | #include "flixel++/FlxLog.hpp" 5 | #include "flixel++/FlxUtils.hpp" 6 | 7 | Flx::Sprite::Sprite(float x, float y) 8 | : Object(x, y), 9 | alpha(100), 10 | angle(0), 11 | visible(true), 12 | graphic(nullptr), 13 | clipRect(0, 0, 0, 0), 14 | hitbox(0, 0, 0, 0), 15 | animation(new Flx::AnimationController), 16 | color(255, 255, 255, 255), 17 | offset(0, 0), 18 | scale(1, 1), 19 | origin(x, y) 20 | { 21 | } 22 | 23 | Flx::Sprite::Sprite(const char* path) 24 | : Sprite(0,0) 25 | { 26 | loadGraphic(path); 27 | } 28 | 29 | Flx::Sprite::Sprite() 30 | : Sprite(0,0) 31 | { 32 | 33 | }; 34 | 35 | Flx::Sprite::~Sprite() 36 | { 37 | delete graphic; 38 | delete animation; 39 | } 40 | 41 | Flx::Sprite* Flx::Sprite::loadGraphic(const char* path) 42 | { 43 | if(!Flx::Utils::fileExists(path)){ 44 | Flx::Log::warn(path); 45 | return nullptr; 46 | } 47 | graphic = Flx::Globals::game->backend->requestTexture(path); 48 | updatePosition(); 49 | return this; 50 | } 51 | 52 | Flx::Sprite* Flx::Sprite::loadGraphic(const void* data, const size_t size) 53 | { 54 | graphic = Flx::Globals::game->backend->requestTexture(data, size); 55 | updatePosition(); 56 | return this; 57 | } 58 | 59 | Flx::Sprite* Flx::Sprite::makeGraphic(float width, float height, int color) 60 | { 61 | graphic = Flx::Globals::game->backend->requestRectangle(width, height, color); 62 | updatePosition(); 63 | return this; 64 | } 65 | 66 | bool Flx::Sprite::collides(Flx::Sprite* sprite) 67 | { 68 | return true; 69 | } 70 | 71 | void Flx::Sprite::setGraphicSize(float width, float height) 72 | { 73 | this->width = width; 74 | this->height = height; 75 | updateHitbox(); 76 | } 77 | 78 | void Flx::Sprite::screenCenter() 79 | { 80 | x = (Flx::Globals::width / 2); 81 | y = (Flx::Globals::height / 2); 82 | } 83 | 84 | void Flx::Sprite::updatePosition() 85 | { 86 | if(!graphic) 87 | return; 88 | this->width = graphic->width; 89 | this->height = graphic->height; 90 | this->clipRect.width = graphic->width; 91 | this->clipRect.height = graphic->height; 92 | } 93 | 94 | void Flx::Sprite::updateHitbox() 95 | { 96 | hitbox.x = x; 97 | hitbox.y = y; 98 | hitbox.width = width; 99 | hitbox.height = height; 100 | origin.set(width/2, height/2); 101 | } 102 | 103 | void Flx::Sprite::update() { 104 | if(animation->animated) 105 | { 106 | animation->frameIndex++; 107 | animation->frameIndex = (Flx::Globals::game->backend->getTicks() / (animation->curAnim->fps)) % animation->curAnim->size(); 108 | } 109 | } 110 | 111 | void Flx::Sprite::draw() { 112 | if(!graphic || !visible) 113 | return; 114 | Flx::Globals::game->backend->render(this); 115 | } -------------------------------------------------------------------------------- /source/FlxState.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxState.hpp" 2 | 3 | Flx::State::State() 4 | { 5 | 6 | } 7 | 8 | void Flx::State::create(){ 9 | 10 | } 11 | 12 | void Flx::State::update(){ 13 | Flx::Group::update(); 14 | } 15 | 16 | void Flx::State::onResize(int width, int height) 17 | { 18 | 19 | } 20 | 21 | void Flx::State::draw() 22 | { 23 | Flx::Group::draw(); 24 | } 25 | 26 | Flx::SubState::SubState(){ 27 | 28 | } 29 | 30 | Flx::SubState::~SubState(){ 31 | 32 | } 33 | 34 | void Flx::SubState::update(){ 35 | 36 | } 37 | 38 | void Flx::SubState::draw(){ 39 | 40 | } -------------------------------------------------------------------------------- /source/FlxText.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxText.hpp" 2 | #include "flixel++/FlxG.hpp" 3 | #include "flixel++/FlxAssets.hpp" 4 | #include "flixel++/FlxMacros.hpp" 5 | 6 | Flx::Text::Text(float x, float y, const std::string& text) 7 | : Flx::Sprite::Sprite(x,y) 8 | { 9 | this->text = text; 10 | if(this->text == ""){ 11 | this->text = " "; 12 | } 13 | 14 | this->font = Flx::Assets::defaultFont; 15 | 16 | this->drawText(); 17 | 18 | updatePosition(); 19 | } 20 | 21 | Flx::Text::~Text() 22 | { 23 | Flx::Sprite::~Sprite(); 24 | } 25 | 26 | void Flx::Text::setText(std::string newText){ 27 | this->text = newText; 28 | drawText(); 29 | updatePosition(); 30 | } 31 | 32 | void Flx::Text::drawText() 33 | { 34 | if(graphic != nullptr) 35 | delete graphic; 36 | graphic = Flx::Globals::game->backend->requestText(text.c_str()); 37 | } 38 | -------------------------------------------------------------------------------- /source/FlxUtils.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/FlxUtils.hpp" 2 | #include 3 | bool Flx::Utils::fileExists(const char* path) 4 | { 5 | if(FILE *file = fopen(path, "r")) 6 | { 7 | fclose(file); 8 | return true; 9 | } 10 | return false; 11 | } -------------------------------------------------------------------------------- /source/SDL_Backports.cpp: -------------------------------------------------------------------------------- 1 | #include "flixel++/SDL_Backports.hpp" 2 | 3 | #ifdef SDL_LEGACY 4 | int 5 | SDL_LowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect, 6 | SDL_Surface * dst, SDL_Rect * dstrect) 7 | { 8 | 9 | /* Save off the original dst width, height */ 10 | int dstW = dstrect->w; 11 | int dstH = dstrect->h; 12 | SDL_Rect full_rect; 13 | SDL_Rect final_dst = *dstrect; 14 | SDL_Rect final_src = *srcrect; 15 | 16 | /* Clip the dst surface to the dstrect */ 17 | full_rect.x = 0; 18 | full_rect.y = 0; 19 | full_rect.w = dst->w; 20 | full_rect.h = dst->h; 21 | if (!SDL_IntersectRect(&final_dst, &full_rect, &final_dst)) { 22 | return 0; 23 | } 24 | 25 | /* Did the dst width change? */ 26 | if ( dstW != final_dst.w ) { 27 | /* scale the src width appropriately */ 28 | final_src.w = final_src.w * dst->clip_rect.w / dstW; 29 | } 30 | 31 | /* Did the dst height change? */ 32 | if ( dstH != final_dst.h ) { 33 | /* scale the src width appropriately */ 34 | final_src.h = final_src.h * dst->clip_rect.h / dstH; 35 | } 36 | 37 | /* Clip the src surface to the srcrect */ 38 | full_rect.x = 0; 39 | full_rect.y = 0; 40 | full_rect.w = src->w; 41 | full_rect.h = src->h; 42 | if (!SDL_IntersectRect(&final_src, &full_rect, &final_src)) { 43 | return 0; 44 | } 45 | if ( !(src->map) && src->format == dst->format ) { 46 | return SDL_SoftStretch( src, &final_src, dst, &final_dst ); 47 | } else { 48 | return SDL_LowerBlit( src, &final_src, dst, &final_dst ); 49 | } 50 | } 51 | bool SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result) 52 | { 53 | int Amin, Amax, Bmin, Bmax; 54 | 55 | if (!A || !B || !result) { 56 | // TODO error message 57 | return SDL_FALSE; 58 | } 59 | 60 | /* Special cases for empty rects */ 61 | if (SDL_RectEmpty(A) || SDL_RectEmpty(B)) { 62 | return SDL_FALSE; 63 | } 64 | 65 | /* Horizontal intersection */ 66 | Amin = A->x; 67 | Amax = Amin + A->w; 68 | Bmin = B->x; 69 | Bmax = Bmin + B->w; 70 | if (Bmin > Amin) 71 | Amin = Bmin; 72 | result->x = Amin; 73 | if (Bmax < Amax) 74 | Amax = Bmax; 75 | result->w = Amax - Amin; 76 | 77 | /* Vertical intersection */ 78 | Amin = A->y; 79 | Amax = Amin + A->h; 80 | Bmin = B->y; 81 | Bmax = Bmin + B->h; 82 | if (Bmin > Amin) 83 | Amin = Bmin; 84 | result->y = Amin; 85 | if (Bmax < Amax) 86 | Amax = Bmax; 87 | result->h = Amax - Amin; 88 | 89 | return !SDL_RectEmpty(result); 90 | } 91 | 92 | int 93 | SDL_UpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect, 94 | SDL_Surface * dst, SDL_Rect * dstrect) 95 | { 96 | SDL_Rect final_src, final_dst, fulldst; 97 | 98 | /* Make sure the surfaces aren't locked */ 99 | if (!src || !dst) { 100 | } 101 | if (src->locked || dst->locked) { 102 | } 103 | 104 | /* If the destination rectangle is NULL, use the entire dest surface */ 105 | if (dstrect == NULL) { 106 | fulldst.x = fulldst.y = 0; 107 | dstrect = &fulldst; 108 | } 109 | 110 | /* clip the source rectangle to the source surface */ 111 | if (srcrect) { 112 | int maxw, maxh; 113 | 114 | final_src.x = srcrect->x; 115 | final_src.w = srcrect->w; 116 | if (final_src.x < 0) { 117 | final_src.w += final_src.x; 118 | final_src.x = 0; 119 | } 120 | maxw = src->w - final_src.x; 121 | if (maxw < final_src.w) 122 | final_src.w = maxw; 123 | 124 | final_src.y = srcrect->y; 125 | final_src.h = srcrect->h; 126 | if (final_src.y < 0) { 127 | final_src.h += final_src.y; 128 | final_src.y = 0; 129 | } 130 | maxh = src->h - final_src.y; 131 | if (maxh < final_src.h) 132 | final_src.h = maxh; 133 | 134 | } else { 135 | final_src.x = final_src.y = 0; 136 | final_src.w = src->w; 137 | final_src.h = src->h; 138 | } 139 | 140 | /* clip the destination rectangle against the clip rectangle */ 141 | if (dstrect) { 142 | int maxw, maxh; 143 | 144 | final_dst.x = dstrect->x; 145 | final_dst.w = dstrect->w; 146 | if (final_dst.x < 0) { 147 | final_dst.w += final_dst.x; 148 | final_dst.x = 0; 149 | } 150 | maxw = dst->w - final_dst.x; 151 | if (maxw < final_dst.w) 152 | final_dst.w = maxw; 153 | 154 | final_dst.y = dstrect->y; 155 | final_dst.h = dstrect->h; 156 | if (final_dst.y < 0) { 157 | final_dst.h += final_dst.y; 158 | final_dst.y = 0; 159 | } 160 | maxh = dst->h - final_dst.y; 161 | if (maxh < final_dst.h) 162 | final_dst.h = maxh; 163 | } else { 164 | final_dst.x = final_dst.y = 0; 165 | final_dst.w = dst->w; 166 | final_dst.h = dst->h; 167 | } 168 | 169 | if (final_dst.w > 0 && final_dst.h > 0) { 170 | return SDL_LowerBlitScaled(src, &final_src, dst, &final_dst); 171 | } 172 | 173 | return 0; 174 | } 175 | #endif -------------------------------------------------------------------------------- /source/assets/cursor.h: -------------------------------------------------------------------------------- 1 | /* Generated by bin2c, do not edit manually */ 2 | 3 | /* Contents of file assets/images/ui/cursor.png */ 4 | const long int cursor_png_size = 706; 5 | const unsigned char cursor_png[706] = { 6 | 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 7 | 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x08, 0x06, 0x00, 0x00, 0x00, 0x08, 0x5E, 0xB8, 8 | 0x38, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 9 | 0x65, 0x00, 0x41, 0x64, 0x6F, 0x62, 0x65, 0x20, 0x49, 0x6D, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, 10 | 0x64, 0x79, 0x71, 0xC9, 0x65, 0x3C, 0x00, 0x00, 0x02, 0x64, 0x49, 0x44, 0x41, 0x54, 0x78, 0xDA, 11 | 0xB4, 0x96, 0xCF, 0x6B, 0x13, 0x41, 0x14, 0xC7, 0xBF, 0x3B, 0xD9, 0x84, 0xA0, 0x26, 0x54, 0xD2, 12 | 0x4A, 0x25, 0xA9, 0x56, 0xFA, 0xC3, 0x22, 0xA8, 0x45, 0x50, 0x82, 0xA0, 0xF8, 0x27, 0x88, 0x22, 13 | 0x0A, 0x9E, 0x14, 0x4F, 0xE2, 0x4D, 0x10, 0xBC, 0xA4, 0xB4, 0x17, 0x8F, 0x22, 0xF4, 0xE2, 0x0F, 14 | 0x42, 0xA2, 0x65, 0xD3, 0x24, 0x85, 0xB4, 0x39, 0x55, 0x04, 0x31, 0x37, 0x41, 0x44, 0x89, 0x39, 15 | 0x5B, 0xA5, 0xAD, 0x90, 0xA2, 0x52, 0x6C, 0x69, 0xC3, 0xA6, 0xC9, 0xFA, 0x66, 0x4D, 0x96, 0xDD, 16 | 0x34, 0x1B, 0xB3, 0xE9, 0xE4, 0xC1, 0xDB, 0x99, 0x9D, 0x59, 0xBE, 0x9F, 0x7D, 0x33, 0xC3, 0x7B, 17 | 0x23, 0x05, 0x42, 0xC1, 0x08, 0x80, 0x29, 0x74, 0xC9, 0x5C, 0xFB, 0xFC, 0xFE, 0x77, 0xD4, 0x6A, 18 | 0xE4, 0xB9, 0x6E, 0x00, 0xE4, 0x5A, 0x3B, 0xC9, 0x1F, 0x0F, 0x27, 0xA7, 0x5B, 0x46, 0xF2, 0x68, 19 | 0xE2, 0x9E, 0x63, 0x00, 0xE3, 0x0F, 0x4D, 0xD3, 0x74, 0x08, 0x09, 0x44, 0x44, 0x47, 0x20, 0xD1, 20 | 0x1E, 0x68, 0x95, 0x4A, 0x15, 0x8C, 0x49, 0x90, 0x24, 0x89, 0x8F, 0x4D, 0xD8, 0x45, 0x72, 0xFF, 21 | 0xF6, 0x65, 0x5B, 0xA1, 0xDE, 0x81, 0x90, 0x7D, 0x04, 0xBA, 0x69, 0x52, 0xBD, 0x27, 0x34, 0x12, 22 | 0x03, 0x70, 0xE5, 0xEA, 0x75, 0x8C, 0x0E, 0x8F, 0x08, 0x87, 0x18, 0x80, 0x03, 0x3E, 0x3F, 0x9E, 23 | 0x3C, 0x9E, 0xC6, 0xB1, 0xC1, 0x41, 0xA1, 0x10, 0x66, 0x7E, 0xD9, 0x28, 0x55, 0x30, 0x9F, 0x4A, 24 | 0xE3, 0xE8, 0xC0, 0x11, 0x61, 0x10, 0x0B, 0x60, 0xBB, 0xA4, 0x42, 0x63, 0x1E, 0x2C, 0xA4, 0xD3, 25 | 0x08, 0x05, 0x83, 0x42, 0x20, 0xAC, 0x71, 0x60, 0x69, 0xB9, 0xA8, 0x8B, 0x67, 0x66, 0x93, 0x38, 26 | 0xDC, 0xDF, 0xBF, 0x67, 0xC8, 0x2E, 0xC0, 0x9F, 0xCD, 0x2D, 0xFC, 0x5E, 0xDF, 0xD0, 0xF7, 0x82, 27 | 0x43, 0x0E, 0xF5, 0xF5, 0x19, 0x10, 0x3A, 0x8A, 0x91, 0x3D, 0x03, 0xB8, 0x7D, 0x5D, 0x29, 0xEA, 28 | 0xED, 0xF0, 0xD0, 0x10, 0x32, 0xC9, 0x24, 0x02, 0x81, 0x40, 0xC7, 0x90, 0xA6, 0x80, 0xE2, 0xCF, 29 | 0x75, 0x6C, 0x6E, 0x95, 0xF4, 0xFE, 0xF1, 0x91, 0x51, 0x3D, 0x92, 0x83, 0x3D, 0x3D, 0x1D, 0x41, 30 | 0x98, 0xDD, 0xC4, 0x52, 0x2D, 0x0A, 0x6E, 0x27, 0xC6, 0xC6, 0x30, 0xA7, 0x28, 0xF0, 0xFB, 0x7C, 31 | 0x8E, 0x21, 0xB6, 0x80, 0xD5, 0xE2, 0x2F, 0xA8, 0xE5, 0x1D, 0xE3, 0xFD, 0xF4, 0xC9, 0x53, 0x04, 32 | 0x49, 0x38, 0x86, 0xD8, 0x02, 0x78, 0x7E, 0xFA, 0xBE, 0xBA, 0x66, 0x19, 0x3B, 0x33, 0x3E, 0x0E, 33 | 0x25, 0x1E, 0x87, 0xD7, 0xEB, 0x6D, 0x1B, 0xC2, 0x5A, 0x4D, 0x7E, 0xFB, 0xB1, 0x86, 0x4A, 0xB5, 34 | 0x6A, 0x19, 0x0B, 0x9F, 0x3D, 0x87, 0xD4, 0xAB, 0x99, 0xB6, 0x21, 0x2D, 0x01, 0xAA, 0xBA, 0xA3, 35 | 0x2F, 0x55, 0xA3, 0x9D, 0x0F, 0x87, 0x31, 0x13, 0x8D, 0xC2, 0xE3, 0x76, 0xC3, 0x54, 0x4F, 0x22, 36 | 0x8E, 0x01, 0x8D, 0x9B, 0x6D, 0xB6, 0x4B, 0x17, 0x2E, 0x22, 0xFE, 0xFC, 0xC5, 0x7F, 0x21, 0x72, 37 | 0x2B, 0xF1, 0x59, 0x25, 0x86, 0x7C, 0xFE, 0x13, 0x6D, 0xEC, 0x7E, 0x12, 0x6A, 0xFE, 0x29, 0x5F, 38 | 0x2A, 0xB5, 0x5C, 0x36, 0x43, 0x60, 0xAE, 0xF1, 0xB6, 0x80, 0x54, 0xE2, 0x25, 0x16, 0xE6, 0xD3, 39 | 0xFF, 0x3E, 0x92, 0x5D, 0x60, 0x2E, 0xD6, 0xEE, 0xD1, 0xB7, 0x40, 0x9A, 0x02, 0xB2, 0x24, 0x9C, 40 | 0xC9, 0x24, 0xC1, 0x0B, 0x9C, 0x2C, 0xCB, 0x90, 0x98, 0xE4, 0x34, 0x43, 0x18, 0x90, 0x5D, 0x80, 41 | 0xD7, 0x8B, 0x59, 0x24, 0x68, 0x69, 0x18, 0x63, 0x90, 0xDD, 0x2E, 0x3E, 0xF4, 0x96, 0xFC, 0x41, 42 | 0x87, 0xC9, 0xD4, 0x63, 0x01, 0xE4, 0x72, 0x6F, 0x10, 0x8B, 0x3E, 0x35, 0x2F, 0xC9, 0x22, 0x2F, 43 | 0x76, 0x54, 0xA3, 0xB7, 0x3B, 0xAD, 0xC9, 0x06, 0xE0, 0xE3, 0x87, 0xF7, 0x28, 0x14, 0xF2, 0x70, 44 | 0x13, 0xB3, 0x56, 0xFC, 0xB3, 0xE4, 0xD7, 0x48, 0x5C, 0x15, 0x52, 0x70, 0xBE, 0x14, 0x3E, 0xD3, 45 | 0x5F, 0x1B, 0x37, 0x8B, 0x39, 0x11, 0xE2, 0x46, 0x04, 0x2E, 0xEB, 0x09, 0xE1, 0xE2, 0x37, 0x9B, 46 | 0x89, 0xDB, 0x2D, 0x83, 0x93, 0x54, 0xA1, 0x90, 0xDF, 0x10, 0xF1, 0xE7, 0x96, 0x8B, 0x57, 0xAD, 47 | 0x1F, 0x23, 0xBF, 0xC3, 0xF3, 0x9C, 0xC8, 0x9B, 0x5D, 0x3D, 0x82, 0x67, 0xE4, 0xB7, 0x44, 0x8B, 48 | 0xD7, 0x6F, 0xD7, 0xBD, 0xD4, 0xDE, 0xED, 0xD6, 0xF5, 0xFD, 0xAF, 0x00, 0x03, 0x00, 0x99, 0x50, 49 | 0xC4, 0x0C, 0xCD, 0x0A, 0x1D, 0xCB, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 50 | 0x60, 0x82 51 | }; 52 | -------------------------------------------------------------------------------- /workflows/doxygen.yml: -------------------------------------------------------------------------------- 1 | name: Doxygen GitHub Pages Deploy Action 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | deploy: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: DenverCoder1/doxygen-github-pages-action@v1.2.0 13 | with: 14 | github_token: ${{ secrets.GITHUB_TOKEN }} 15 | branch: gh-pages 16 | folder: docs/html 17 | config_file: Doxyfile 18 | --------------------------------------------------------------------------------