├── .gitignore ├── .vscode ├── c_cpp_properties.json ├── launch.json ├── settings.json └── tasks.json ├── README.md ├── game ├── premake5.lua └── src │ └── main.cpp ├── game_objects ├── include │ ├── behavior.h │ ├── component.h │ ├── game_object.h │ ├── scene.h │ └── simple_components.h ├── premake5.lua └── src │ ├── game_object.cpp │ └── simple_components.cpp ├── premake-VisualStudio.bat ├── premake-mingw.bat ├── premake5 ├── premake5.exe ├── premake5.lua ├── premake5.osx ├── raylib_premake5.lua └── resources ├── raylib_logo.png ├── scarfy.png └── wabbit_alpha.png /.gitignore: -------------------------------------------------------------------------------- 1 | raylib-master 2 | _build 3 | _bin 4 | .vs 5 | /bin 6 | /build 7 | Makefile 8 | obj 9 | *.vcxproj 10 | *.filters 11 | *.user 12 | *.sln 13 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Win32", 5 | "includePath": [ 6 | "${workspaceFolder}/raylib-master/src", 7 | "${workspaceFolder}/game/**" 8 | ], 9 | "defines": [ 10 | "_DEBUG", 11 | "UNICODE", 12 | "_UNICODE", 13 | "GRAPHICS_API_OPENGL_33", 14 | "PLATFORM_DESKTOP" 15 | ], 16 | "cStandard": "c99", 17 | "cppStandard": "c++14", 18 | "intelliSenseMode": "gcc-x64" 19 | }, 20 | { 21 | "name": "Mac", 22 | "includePath": [ 23 | "${workspaceFolder}/raylib-master/src", 24 | "${workspaceFolder}/game/**" 25 | ], 26 | "defines": [ 27 | "_DEBUG", 28 | "UNICODE", 29 | "_UNICODE", 30 | "GRAPHICS_API_OPENGL_33", 31 | "PLATFORM_DESKTOP" 32 | ], 33 | "macFrameworkPath": [ 34 | "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks" 35 | ], 36 | "compilerPath": "/usr/bin/clang", 37 | "cStandard": "c11", 38 | "cppStandard": "c++14", 39 | "intelliSenseMode": "clang-x64" 40 | }, 41 | { 42 | "name": "Linux", 43 | "includePath": [ 44 | "${workspaceFolder}/raylib-master/src", 45 | "${workspaceFolder}/game/**" 46 | ], 47 | "defines": [ 48 | "_DEBUG", 49 | "UNICODE", 50 | "_UNICODE", 51 | "GRAPHICS_API_OPENGL_33", 52 | "PLATFORM_DESKTOP" 53 | ], 54 | "compilerPath": "/usr/bin/clang", 55 | "cStandard": "c11", 56 | "cppStandard": "c++14", 57 | "intelliSenseMode": "clang-x64" 58 | 59 | } 60 | ], 61 | "version": 4 62 | } 63 | -------------------------------------------------------------------------------- /.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": "Debug", 9 | "type": "cppdbg", 10 | "request": "launch", 11 | "program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}.exe", 12 | "args": [], 13 | "stopAtEntry": false, 14 | "cwd": "${workspaceFolder}", 15 | "environment": [], 16 | "externalConsole": false, 17 | "MIMode": "gdb", 18 | "setupCommands": [ 19 | { 20 | "description": "Enable pretty-printing for gdb", 21 | "text": "-enable-pretty-printing", 22 | "ignoreFailures": false 23 | } 24 | ], 25 | "windows": { 26 | "miDebuggerPath": "gdb.exe", 27 | }, 28 | "osx": { 29 | "MIMode": "lldb" 30 | }, 31 | "linux": { 32 | "program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}", 33 | "miDebuggerPath": "/usr/bin/gdb", 34 | }, 35 | "preLaunchTask": "build debug" 36 | }, 37 | { 38 | "name": "Run", 39 | "type": "cppdbg", 40 | "request": "launch", 41 | "args": [], 42 | "stopAtEntry": false, 43 | "cwd": "${workspaceFolder}", 44 | "environment": [], 45 | "externalConsole": false, 46 | "program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}.exe", 47 | "MIMode": "gdb", 48 | "windows": { 49 | "program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}.exe", 50 | "miDebuggerPath": "gdb.exe" 51 | }, 52 | "osx": { 53 | "program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}", 54 | "MIMode": "lldb" 55 | }, 56 | "linux": { 57 | "program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}", 58 | "miDebuggerPath": "/usr/bin/gdb" 59 | }, 60 | "preLaunchTask": "build release", 61 | } 62 | ] 63 | } 64 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/.git": true, 4 | "**/.svn": true, 5 | "**/.hg": true, 6 | "**/CVS": true, 7 | "**/.DS_Store": true, 8 | "**/*.o": true, 9 | "**/*.exe": true, 10 | } 11 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "build debug", 8 | "type": "process", 9 | "command": "make", 10 | "windows": { 11 | "command": "mingw32-make.exe", 12 | "args": [ 13 | "SHELL=cmd" 14 | ], 15 | }, 16 | "group": { 17 | "kind": "build", 18 | "isDefault": true 19 | }, 20 | "problemMatcher": [ 21 | "$gcc" 22 | ], 23 | "dependsOn":["UpdateMake"] 24 | }, 25 | { 26 | "label": "build release", 27 | "type": "process", 28 | "command": "make", 29 | "windows": { 30 | "command": "mingw32-make.exe", 31 | "args": [ 32 | "SHELL=cmd", 33 | "config=release_x64" 34 | ], 35 | }, 36 | "linux": { 37 | "args": [ 38 | "config=release_x64" 39 | ], 40 | }, 41 | "osx": { 42 | "args": [ 43 | ], 44 | }, 45 | "group": "build", 46 | "problemMatcher": [ 47 | "$gcc" 48 | ], 49 | "dependsOn":["UpdateMake"] 50 | }, 51 | { 52 | "label": "UpdateMake", 53 | "type": "process", 54 | "command": "./premake5", 55 | "args": [ 56 | "gmake2" 57 | ], 58 | "windows": { 59 | "command": "./premake5.exe" 60 | }, 61 | "linux": { 62 | "command": "./premake5" 63 | }, 64 | "osx": { 65 | "command": "./premake5.osx" 66 | }, 67 | "group": "build" 68 | } 69 | ] 70 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Game Object Example 2 | Example of a basic game object system using components. 3 | 4 | ## Game Objects 5 | A game object is an entity type class that can have children and a list of components. Game Objects are stored in a heiriachy. 6 | 7 | ## Components 8 | Components are generic classes that can be derived from and attached to entities. They get update and render calls each frame where they can perform work. 9 | 10 | ## Scene 11 | A scene is a collection of top level game objects. 12 | 13 | # Is this an ECS? 14 | No this is not an ECS, this is a game object system that uses components. It is written to perform in a similar way to how the Unity GameObject/Monobehavior system works. 15 | 16 | ## Why is this not an ECS? 17 | The acronym of ECS stands for 3 things 18 | * Entities 19 | * Components 20 | * Systems 21 | 22 | This project has entities(GameObjects) and Components, but does not contain systems. In a pure ECS the components themselves are data only and do not have logic. Additionaly ECS systems store all components together for rapid processing. This system stores the components on each entity to allow simple heirarchical trees. 23 | 24 | ## Example ECS 25 | You can find an example ECS written in raylib here. 26 | 27 | https://github.com/raylib-extras/simple_ecs 28 | 29 | -------------------------------------------------------------------------------- /game/premake5.lua: -------------------------------------------------------------------------------- 1 | -- Copyright (c) 2020-2024 Jeffery Myers 2 | -- 3 | --This software is provided "as-is", without any express or implied warranty. In no event 4 | --will the authors be held liable for any damages arising from the use of this software. 5 | 6 | --Permission is granted to anyone to use this software for any purpose, including commercial 7 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | 9 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 10 | -- wrote the original software. If you use this software in a product, an acknowledgment 11 | -- in the product documentation would be appreciated but is not required. 12 | -- 13 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 14 | -- as being the original software. 15 | -- 16 | -- 3. This notice may not be removed or altered from any source distribution. 17 | 18 | baseName = path.getbasename(os.getcwd()); 19 | 20 | project (workspaceName) 21 | kind "ConsoleApp" 22 | location "./" 23 | targetdir "../bin/%{cfg.buildcfg}" 24 | 25 | filter "configurations:Release" 26 | kind "WindowedApp" 27 | entrypoint "mainCRTStartup" 28 | 29 | filter "action:vs*" 30 | debugdir "$(SolutionDir)" 31 | 32 | filter {"action:vs*", "configurations:Release"} 33 | kind "WindowedApp" 34 | entrypoint "mainCRTStartup" 35 | filter {} 36 | 37 | vpaths 38 | { 39 | ["Header Files/*"] = { "include/**.h", "include/**.hpp", "src/**.h", "src/**.hpp", "**.h", "**.hpp"}, 40 | ["Source Files/*"] = {"src/**.c", "src/**.cpp","**.c", "**.cpp"}, 41 | } 42 | files {"**.c", "**.cpp", "**.h", "**.hpp"} 43 | 44 | includedirs { "./" } 45 | includedirs { "src" } 46 | includedirs { "include" } 47 | 48 | link_raylib() 49 | link_to("game_objects") 50 | 51 | -- To link to a lib use link_to("LIB_FOLDER_NAME") -------------------------------------------------------------------------------- /game/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Raylib example file. 3 | This is an example main file for a simple raylib project. 4 | Use this as a starting point or replace it with your code. 5 | 6 | -- Copyright (c) 2020-2024 Jeffery Myers 7 | -- 8 | --This software is provided "as-is", without any express or implied warranty. In no event 9 | --will the authors be held liable for any damages arising from the use of this software. 10 | 11 | --Permission is granted to anyone to use this software for any purpose, including commercial 12 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 13 | 14 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 15 | -- wrote the original software. If you use this software in a product, an acknowledgment 16 | -- in the product documentation would be appreciated but is not required. 17 | -- 18 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 19 | -- as being the original software. 20 | -- 21 | -- 3. This notice may not be removed or altered from any source distribution. 22 | 23 | */ 24 | #include "game_object.h" 25 | #include "simple_components.h" 26 | #include "behavior.h" 27 | #include "scene.h" 28 | 29 | #include "raylib.h" 30 | #include "raymath.h" 31 | 32 | Scene TestScene; 33 | 34 | Texture Wabbit = { 0 }; 35 | Texture Logo = { 0 }; 36 | Texture Sprite = { 0 }; 37 | 38 | 39 | // a simple behavior class that handles input 40 | class PlayerController : public GameObjectBehavior 41 | { 42 | public: 43 | DEFINE_BEHAVIOR(PlayerController) 44 | 45 | float Speed = 300; 46 | 47 | void OnUpdate() override 48 | { 49 | TransformComponent* transform = GetComponent(); 50 | if (!transform) 51 | return; 52 | 53 | Vector2 movement = { 0 }; 54 | if (IsKeyDown(KEY_W)) 55 | movement.y -= 1; 56 | if (IsKeyDown(KEY_S)) 57 | movement.y += 1; 58 | 59 | if (IsKeyDown(KEY_A)) 60 | movement.x -= 1; 61 | if (IsKeyDown(KEY_D)) 62 | movement.x += 1; 63 | 64 | transform->SetPosition(Vector2Add(transform->GetPosition(), Vector2Scale(movement, Speed * GetFrameTime()))); 65 | } 66 | }; 67 | 68 | class Spiner : public GameObjectBehavior 69 | { 70 | public: 71 | DEFINE_BEHAVIOR(Spiner) 72 | 73 | float Speed = -90; 74 | 75 | void OnUpdate() override 76 | { 77 | TransformComponent* transform = GetComponent(); 78 | if (!transform) 79 | return; 80 | 81 | transform->SetRotation(transform->GetRotation() + Speed * GetFrameTime()); 82 | Vector2 movement = { 0 }; 83 | } 84 | }; 85 | 86 | void SetupScene() 87 | { 88 | auto* player = TestScene.AddObject(); 89 | player->AddComponent()->SetPosition(Vector2{ 100, 100 }); 90 | player->AddComponent(); 91 | auto* sprite = player->AddComponent(); 92 | sprite->SetSprite(Wabbit); 93 | sprite->SetScale(3); 94 | 95 | auto* logo = TestScene.AddObject(); 96 | logo->AddComponent()->SetPosition(Vector2{ GetScreenWidth() * 0.5f, GetScreenHeight() * 0.5f }); 97 | sprite = logo->AddComponent(); 98 | sprite->SetSprite(Logo); 99 | sprite->SetScale(0.5f); 100 | 101 | auto* spinner = logo->AddChild(); 102 | spinner->AddComponent(); 103 | spinner->AddComponent(); 104 | 105 | auto* orbit = spinner->AddChild(); 106 | orbit->AddComponent()->SetPosition(Vector2{ 0, 200 }); 107 | sprite = orbit->AddComponent(); 108 | sprite->SetSprite(Sprite); 109 | // sprite->SetScale(0.5f); 110 | 111 | auto* animator = orbit->AddComponent(); 112 | auto& normalSequence = animator->AddSequence("normal"); 113 | normalSequence.FromSpriteSheet(Sprite, Sprite.width / 6, Sprite.height); 114 | normalSequence.Loop = true; 115 | normalSequence.FPS = 7; 116 | 117 | auto& reverseSequence = animator->AddSequence("reverse"); 118 | reverseSequence.FromSpriteSheet(Sprite, Sprite.width / 6, Sprite.height); 119 | reverseSequence.Loop = true; 120 | reverseSequence.FPS = normalSequence.FPS; 121 | reverseSequence.FlipFrames(true, false); 122 | 123 | animator->SetCurrentSequence("normal"); 124 | } 125 | 126 | void LoadResources() 127 | { 128 | Wabbit = LoadTexture("resources/wabbit_alpha.png"); 129 | SetTextureFilter(Wabbit, TEXTURE_FILTER_POINT); 130 | Logo = LoadTexture("resources/raylib_logo.png"); 131 | Sprite = LoadTexture("resources/scarfy.png"); 132 | } 133 | 134 | int main() 135 | { 136 | // set up the window 137 | InitWindow(1280, 800, "Game Object Test"); 138 | 139 | LoadResources(); 140 | SetupScene(); 141 | 142 | // game loop 143 | while (!WindowShouldClose()) 144 | { 145 | // drawing 146 | TestScene.Update(); 147 | 148 | BeginDrawing(); 149 | ClearBackground(TestScene.Background); 150 | 151 | TestScene.Render(); 152 | 153 | EndDrawing(); 154 | } 155 | 156 | // cleanup 157 | CloseWindow(); 158 | return 0; 159 | } -------------------------------------------------------------------------------- /game_objects/include/behavior.h: -------------------------------------------------------------------------------- 1 | /* 2 | -- Copyright (c) 2020-2024 Jeffery Myers 3 | -- 4 | --This software is provided "as-is", without any express or implied warranty. In no event 5 | --will the authors be held liable for any damages arising from the use of this software. 6 | 7 | --Permission is granted to anyone to use this software for any purpose, including commercial 8 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 9 | 10 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 11 | -- wrote the original software. If you use this software in a product, an acknowledgment 12 | -- in the product documentation would be appreciated but is not required. 13 | -- 14 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 15 | -- as being the original software. 16 | -- 17 | -- 3. This notice may not be removed or altered from any source distribution. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "component.h" 23 | #include "raylib.h" 24 | 25 | #define DEFINE_BEHAVIOR(T) \ 26 | T(GameObject& object) : GameObjectBehavior(object){} 27 | 28 | class GameObjectBehavior : public Component 29 | { 30 | public: 31 | static const char* GetComponentName() { return "GameObjectBehavior"; } 32 | static size_t GetComponentId() { return reinterpret_cast("GameObjectBehavior"); } 33 | inline size_t GetTypeId() const override { return GetComponentId(); } 34 | GameObjectBehavior(GameObject& object) : Component(object) {} 35 | 36 | }; 37 | -------------------------------------------------------------------------------- /game_objects/include/component.h: -------------------------------------------------------------------------------- 1 | /* 2 | -- Copyright (c) 2020-2024 Jeffery Myers 3 | -- 4 | --This software is provided "as-is", without any express or implied warranty. In no event 5 | --will the authors be held liable for any damages arising from the use of this software. 6 | 7 | --Permission is granted to anyone to use this software for any purpose, including commercial 8 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 9 | 10 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 11 | -- wrote the original software. If you use this software in a product, an acknowledgment 12 | -- in the product documentation would be appreciated but is not required. 13 | -- 14 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 15 | -- as being the original software. 16 | -- 17 | -- 3. This notice may not be removed or altered from any source distribution. 18 | */ 19 | #pragma once 20 | 21 | #include 22 | 23 | // macro to define common code that all components need 24 | // computes a runtime unique ID for each component using the name 25 | // NOTE that this ID is not deterministic, a real system would hash the name and use a better ID 26 | #define DEFINE_COMPONENT(T) \ 27 | static const char* GetComponentName() { return #T;} \ 28 | static size_t GetComponentId() { return reinterpret_cast(#T); } \ 29 | inline size_t GetTypeId() const override { return GetComponentId(); } \ 30 | T(GameObject& object) : Component(object) {} 31 | 32 | class GameObject; 33 | 34 | class Component 35 | { 36 | private: 37 | GameObject& HostingObject; 38 | 39 | protected: 40 | GameObject& GetGameObject() { return HostingObject; } 41 | const GameObject& GetGameObject() const { return HostingObject; } 42 | 43 | public: 44 | virtual size_t GetTypeId() const = 0; 45 | 46 | Component(GameObject& object) 47 | : HostingObject(object) 48 | { 49 | } 50 | virtual ~Component() = default; 51 | 52 | // no copy 53 | Component(const Component&) = delete; 54 | Component& operator=(Component const&) = delete; 55 | 56 | Component* GetComponent(size_t componentID); 57 | 58 | template 59 | T* GetComponent() 60 | { 61 | return static_cast(GetComponent(T::GetComponentId())); 62 | } 63 | 64 | virtual void OnCreate() {}; 65 | virtual void OnDestoy() {}; 66 | virtual void OnUpdate() {}; 67 | virtual void OnRender() {}; 68 | }; -------------------------------------------------------------------------------- /game_objects/include/game_object.h: -------------------------------------------------------------------------------- 1 | /* 2 | -- Copyright (c) 2020-2024 Jeffery Myers 3 | -- 4 | --This software is provided "as-is", without any express or implied warranty. In no event 5 | --will the authors be held liable for any damages arising from the use of this software. 6 | 7 | --Permission is granted to anyone to use this software for any purpose, including commercial 8 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 9 | 10 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 11 | -- wrote the original software. If you use this software in a product, an acknowledgment 12 | -- in the product documentation would be appreciated but is not required. 13 | -- 14 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 15 | -- as being the original software. 16 | -- 17 | -- 3. This notice may not be removed or altered from any source distribution. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "component.h" 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | class GameObject 29 | { 30 | private: 31 | GameObject* Parent = nullptr; 32 | std::vector Children; 33 | 34 | std::string Name; 35 | 36 | protected: 37 | std::unordered_map> Components; 38 | 39 | public: 40 | ~GameObject(); 41 | 42 | void Update(); 43 | void Render(); 44 | 45 | Component* AddComponent(std::unique_ptr component); 46 | void RemoveComponent(size_t componentID); 47 | Component* GetComponent(size_t componentID); 48 | 49 | template 50 | T* AddComponent() 51 | { 52 | return static_cast(AddComponent(std::make_unique(*this))); 53 | } 54 | 55 | template 56 | void RemoveComponent() 57 | { 58 | RemoveComponent(T::GetComponentId()); 59 | } 60 | 61 | template 62 | T* GetComponent() 63 | { 64 | return static_cast(GetComponent(T::GetComponentId())); 65 | } 66 | 67 | const std::vector& GetChildren() const { return Children; } 68 | GameObject* GetParent() const { return Parent; } 69 | 70 | GameObject* AddChild(); 71 | 72 | std::string_view GetName() const; 73 | void SetName(std::string_view name); 74 | }; -------------------------------------------------------------------------------- /game_objects/include/scene.h: -------------------------------------------------------------------------------- 1 | /* 2 | -- Copyright (c) 2020-2024 Jeffery Myers 3 | -- 4 | --This software is provided "as-is", without any express or implied warranty. In no event 5 | --will the authors be held liable for any damages arising from the use of this software. 6 | 7 | --Permission is granted to anyone to use this software for any purpose, including commercial 8 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 9 | 10 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 11 | -- wrote the original software. If you use this software in a product, an acknowledgment 12 | -- in the product documentation would be appreciated but is not required. 13 | -- 14 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 15 | -- as being the original software. 16 | -- 17 | -- 3. This notice may not be removed or altered from any source distribution. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "game_object.h" 23 | #include "raylib.h" 24 | 25 | #include 26 | 27 | class Scene : public GameObject 28 | { 29 | public: 30 | Color Background = DARKGRAY; 31 | 32 | GameObject* AddObject() { return AddChild(); } 33 | }; -------------------------------------------------------------------------------- /game_objects/include/simple_components.h: -------------------------------------------------------------------------------- 1 | /* 2 | -- Copyright (c) 2020-2024 Jeffery Myers 3 | -- 4 | --This software is provided "as-is", without any express or implied warranty. In no event 5 | --will the authors be held liable for any damages arising from the use of this software. 6 | 7 | --Permission is granted to anyone to use this software for any purpose, including commercial 8 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 9 | 10 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 11 | -- wrote the original software. If you use this software in a product, an acknowledgment 12 | -- in the product documentation would be appreciated but is not required. 13 | -- 14 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 15 | -- as being the original software. 16 | -- 17 | -- 3. This notice may not be removed or altered from any source distribution. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "component.h" 23 | #include "raylib.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | class TransformComponent : public Component 30 | { 31 | private: 32 | Vector2 Translation = { 0 }; 33 | float Rotation = 0; 34 | 35 | public: 36 | DEFINE_COMPONENT(TransformComponent) 37 | 38 | void SetPosition(const Vector2& pos); 39 | Vector2 GetPosition() const; 40 | 41 | void SetRotation(float rotation); 42 | float GetRotation() const; 43 | 44 | void PushMatrix(); 45 | void PopMatrix(); 46 | }; 47 | 48 | class SpriteComponent : public Component 49 | { 50 | private: 51 | Texture2D Sprite = { 0 }; 52 | Rectangle SourceRect = { 0,0,-1,-1 }; 53 | Color Tint = WHITE; 54 | float Scale = 1.0f; 55 | 56 | public: 57 | DEFINE_COMPONENT(SpriteComponent) 58 | 59 | void OnRender() override; 60 | 61 | void SetSprite(const Texture2D& texture); 62 | void SetSprite(const Texture2D& texture, const Rectangle& sourceRect); 63 | void SetSpriteRect(const Rectangle& sourceRect); 64 | 65 | void SetTint(Color tint); 66 | Color GetTint() const; 67 | 68 | void SetScale(float scale); 69 | float GetScale() const; 70 | }; 71 | 72 | struct AnimationSequence 73 | { 74 | std::vector Frames; 75 | float FPS = 15; 76 | bool Loop = true; 77 | 78 | void FlipFrames(bool flipX, bool flipY); 79 | 80 | void FromSpriteSheet(Texture2D& texture, int frameWidth, int frameHeight); 81 | }; 82 | 83 | class SpriteAnimationComponent : public Component 84 | { 85 | private: 86 | std::unordered_map Sequences; 87 | std::string CurrentSequence; 88 | 89 | int CurrentFrame = 0; 90 | float LastFrameTime = 0; 91 | 92 | public: 93 | DEFINE_COMPONENT(SpriteAnimationComponent) 94 | 95 | void OnUpdate() override; 96 | 97 | AnimationSequence& AddSequence(std::string_view name); 98 | 99 | void SetCurrentSequence(std::string_view sequenceName); 100 | void ResetSequence(); 101 | 102 | bool IsAnimating() const; 103 | }; -------------------------------------------------------------------------------- /game_objects/premake5.lua: -------------------------------------------------------------------------------- 1 | -- Copyright (c) 2020-2024 Jeffery Myers 2 | -- 3 | --This software is provided "as-is", without any express or implied warranty. In no event 4 | --will the authors be held liable for any damages arising from the use of this software. 5 | 6 | --Permission is granted to anyone to use this software for any purpose, including commercial 7 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | 9 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 10 | -- wrote the original software. If you use this software in a product, an acknowledgment 11 | -- in the product documentation would be appreciated but is not required. 12 | -- 13 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 14 | -- as being the original software. 15 | -- 16 | -- 3. This notice may not be removed or altered from any source distribution. 17 | 18 | baseName = path.getbasename(os.getcwd()); 19 | 20 | project (baseName) 21 | kind "StaticLib" 22 | location "./" 23 | targetdir "../bin/%{cfg.buildcfg}" 24 | 25 | vpaths 26 | { 27 | ["Header Files/*"] = { "include/**.h", "include/**.hpp", "**.h", "**.hpp"}, 28 | ["Source Files/*"] = { "src/**.cpp", "src/**.c", "**.cpp","**.c"}, 29 | } 30 | files {"**.hpp", "**.h", "**.cpp","**.c"} 31 | 32 | includedirs { "./" } 33 | includedirs { "./include" } 34 | 35 | include_raylib() -------------------------------------------------------------------------------- /game_objects/src/game_object.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | -- Copyright (c) 2020-2024 Jeffery Myers 3 | -- 4 | --This software is provided "as-is", without any express or implied warranty. In no event 5 | --will the authors be held liable for any damages arising from the use of this software. 6 | 7 | --Permission is granted to anyone to use this software for any purpose, including commercial 8 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 9 | 10 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 11 | -- wrote the original software. If you use this software in a product, an acknowledgment 12 | -- in the product documentation would be appreciated but is not required. 13 | -- 14 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 15 | -- as being the original software. 16 | -- 17 | -- 3. This notice may not be removed or altered from any source distribution. 18 | */ 19 | 20 | #include "game_object.h" 21 | 22 | GameObject::~GameObject() 23 | { 24 | for (auto* child : Children) 25 | delete(child); 26 | } 27 | 28 | void GameObject::Update() 29 | { 30 | for (auto& [id, componentPtr] : Components) 31 | componentPtr->OnUpdate(); 32 | 33 | for (auto* child : Children) 34 | child->Update(); 35 | } 36 | 37 | void GameObject::Render() 38 | { 39 | for (auto& [id, componentPtr] : Components) 40 | componentPtr->OnRender(); 41 | 42 | for (auto* child : Children) 43 | child->Render(); 44 | } 45 | 46 | Component* GameObject::AddComponent(std::unique_ptr component) 47 | { 48 | component->OnCreate(); 49 | size_t id = component->GetTypeId(); 50 | Components.insert_or_assign(id, std::move(component)); 51 | return GetComponent(id); 52 | } 53 | 54 | void GameObject::RemoveComponent(size_t componentID) 55 | { 56 | auto itr = Components.find(componentID); 57 | if (itr == Components.end()) 58 | return; 59 | 60 | itr->second->OnDestoy(); 61 | Components.erase(itr); 62 | } 63 | 64 | Component* GameObject::GetComponent(size_t componentID) 65 | { 66 | auto itr = Components.find(componentID); 67 | if (itr == Components.end()) 68 | return nullptr; 69 | 70 | return itr->second.get(); 71 | } 72 | 73 | GameObject* GameObject::AddChild() 74 | { 75 | GameObject* newChild = new GameObject(); 76 | newChild->Parent = this; 77 | Children.emplace_back(newChild); 78 | return newChild; 79 | } 80 | 81 | std::string_view GameObject::GetName() const 82 | { 83 | return Name; 84 | } 85 | 86 | void GameObject::SetName(std::string_view name) 87 | { 88 | Name = name; 89 | } 90 | 91 | //----------------Component---------------------// 92 | Component* Component::GetComponent(size_t componentID) 93 | { 94 | return HostingObject.GetComponent(componentID); 95 | } -------------------------------------------------------------------------------- /game_objects/src/simple_components.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | -- Copyright (c) 2020-2024 Jeffery Myers 3 | -- 4 | --This software is provided "as-is", without any express or implied warranty. In no event 5 | --will the authors be held liable for any damages arising from the use of this software. 6 | 7 | --Permission is granted to anyone to use this software for any purpose, including commercial 8 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 9 | 10 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 11 | -- wrote the original software. If you use this software in a product, an acknowledgment 12 | -- in the product documentation would be appreciated but is not required. 13 | -- 14 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 15 | -- as being the original software. 16 | -- 17 | -- 3. This notice may not be removed or altered from any source distribution. 18 | */ 19 | 20 | #include "simple_components.h" 21 | #include "game_object.h" 22 | 23 | #include "raylib.h" 24 | #include "rlgl.h" 25 | #include "raymath.h" 26 | 27 | void TransformComponent::SetPosition(const Vector2& pos) 28 | { 29 | Translation = pos; 30 | } 31 | 32 | Vector2 TransformComponent::GetPosition() const 33 | { 34 | return Translation; 35 | } 36 | 37 | void TransformComponent::SetRotation(float rotation) 38 | { 39 | Rotation = rotation; 40 | } 41 | 42 | float TransformComponent::GetRotation() const 43 | { 44 | return Rotation; 45 | } 46 | 47 | void TransformComponent::PushMatrix() 48 | { 49 | GameObject& object = GetGameObject(); 50 | 51 | GameObject* parent = object.GetParent(); 52 | if (parent) 53 | { 54 | TransformComponent* parentTransfom = parent->GetComponent(); 55 | if (parentTransfom) 56 | parentTransfom->PushMatrix(); 57 | } 58 | 59 | rlPushMatrix(); 60 | rlTranslatef(Translation.x, Translation.y, 0); 61 | rlRotatef(Rotation, 0, 0, 1); 62 | } 63 | 64 | void TransformComponent::PopMatrix() 65 | { 66 | rlPopMatrix(); 67 | 68 | GameObject& object = GetGameObject(); 69 | 70 | GameObject* parent = object.GetParent(); 71 | if (parent) 72 | { 73 | TransformComponent* parentTransfom = parent->GetComponent(); 74 | if (parentTransfom) 75 | parentTransfom->PopMatrix(); 76 | } 77 | } 78 | 79 | 80 | //-----------------------SpriteComponent-------------------------// 81 | void SpriteComponent::OnRender() 82 | { 83 | if (!IsTextureReady(Sprite)) 84 | return; 85 | 86 | TransformComponent* transform = GetComponent(); 87 | if (transform) 88 | transform->PushMatrix(); 89 | 90 | Rectangle destRect = { 0, 0, fabsf(SourceRect.width * Scale), fabsf(SourceRect.height * Scale) }; 91 | 92 | DrawTexturePro(Sprite, SourceRect, destRect, Vector2{ destRect.width *0.5f, destRect.height*0.5f}, 0, Tint); 93 | 94 | if (transform) 95 | transform->PopMatrix(); 96 | } 97 | 98 | void SpriteComponent::SetSprite(const Texture2D& texture) 99 | { 100 | SetSprite(texture, Rectangle{ 0,0,float(texture.width),float(texture.height) }); 101 | } 102 | 103 | void SpriteComponent::SetSprite(const Texture2D& texture, const Rectangle& sourceRect) 104 | { 105 | Sprite = texture; 106 | SourceRect = sourceRect; 107 | } 108 | 109 | void SpriteComponent::SetSpriteRect(const Rectangle& sourceRect) 110 | { 111 | SourceRect = sourceRect; 112 | } 113 | 114 | void SpriteComponent::SetTint(Color tint) 115 | { 116 | Tint = tint; 117 | } 118 | 119 | Color SpriteComponent::GetTint() const 120 | { 121 | return Tint; 122 | } 123 | 124 | void SpriteComponent::SetScale(float scale) 125 | { 126 | Scale = scale; 127 | } 128 | 129 | float SpriteComponent::GetScale() const 130 | { 131 | return Scale; 132 | } 133 | 134 | //-----------------------AnimationSequence-------------------------// 135 | 136 | void AnimationSequence::FlipFrames(bool flipX, bool flipY) 137 | { 138 | for (auto& rect : Frames) 139 | { 140 | if (flipX) 141 | rect.width *= -1; 142 | if (flipY) 143 | rect.height *= -1; 144 | } 145 | } 146 | 147 | void AnimationSequence::FromSpriteSheet(Texture2D& texture, int frameWidth, int frameHeight) 148 | { 149 | Frames.clear(); 150 | for (int y = 0; y < texture.height; y += frameHeight) 151 | { 152 | for (int x = 0; x < texture.width; x += frameWidth) 153 | { 154 | Frames.emplace_back(Rectangle{ float(x), float(y), float(frameWidth), float(frameHeight) }); 155 | } 156 | } 157 | } 158 | 159 | //-----------------------SpriteAnimationComponent-------------------------// 160 | 161 | void SpriteAnimationComponent::OnUpdate() 162 | { 163 | auto itr = Sequences.find(CurrentSequence); 164 | if (itr == Sequences.end()) 165 | return; 166 | 167 | AnimationSequence& sequence = itr->second; 168 | 169 | SpriteComponent* sprite = GetComponent(); 170 | if (!sprite) 171 | return; 172 | 173 | LastFrameTime += GetFrameTime(); 174 | 175 | float fpsTime = 1.0f / sequence.FPS; 176 | 177 | while (LastFrameTime >= fpsTime) 178 | { 179 | LastFrameTime -= fpsTime; 180 | CurrentFrame++; 181 | 182 | if (CurrentFrame >= sequence.Frames.size()) 183 | { 184 | if (sequence.Loop) 185 | CurrentFrame = 0; 186 | else 187 | CurrentFrame = int(sequence.Frames.size()); 188 | } 189 | } 190 | 191 | if (CurrentFrame < sequence.Frames.size()) 192 | sprite->SetSpriteRect(sequence.Frames[CurrentFrame]); 193 | } 194 | 195 | AnimationSequence& SpriteAnimationComponent::AddSequence(std::string_view name) 196 | { 197 | if (CurrentSequence.empty()) 198 | CurrentSequence = name; 199 | 200 | auto itr = Sequences.find(std::string(name)); 201 | if (itr != Sequences.end()) 202 | return itr->second; 203 | 204 | Sequences.emplace(name, AnimationSequence()); 205 | 206 | return Sequences[std::string(name)]; 207 | } 208 | 209 | void SpriteAnimationComponent::SetCurrentSequence(std::string_view sequenceName) 210 | { 211 | CurrentSequence = sequenceName; 212 | ResetSequence(); 213 | } 214 | 215 | void SpriteAnimationComponent::ResetSequence() 216 | { 217 | CurrentFrame = 0; 218 | LastFrameTime = 0; 219 | } 220 | 221 | bool SpriteAnimationComponent::IsAnimating() const 222 | { 223 | auto itr = Sequences.find(CurrentSequence); 224 | if (itr == Sequences.end()) 225 | return false; 226 | 227 | if (itr->second.Loop) 228 | return true; 229 | 230 | return CurrentFrame < itr->second.Frames.size(); 231 | } 232 | -------------------------------------------------------------------------------- /premake-VisualStudio.bat: -------------------------------------------------------------------------------- 1 | premake5.exe vs2022 || pause 2 | -------------------------------------------------------------------------------- /premake-mingw.bat: -------------------------------------------------------------------------------- 1 | premake5.exe gmake2 || pause 2 | -------------------------------------------------------------------------------- /premake5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raylib-extras/GameObjectsExample/6d21b80269f823b321afae152a4e2a794ab815ed/premake5 -------------------------------------------------------------------------------- /premake5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raylib-extras/GameObjectsExample/6d21b80269f823b321afae152a4e2a794ab815ed/premake5.exe -------------------------------------------------------------------------------- /premake5.lua: -------------------------------------------------------------------------------- 1 | -- Copyright (c) 2020-2024 Jeffery Myers 2 | -- 3 | --This software is provided "as-is", without any express or implied warranty. In no event 4 | --will the authors be held liable for any damages arising from the use of this software. 5 | 6 | --Permission is granted to anyone to use this software for any purpose, including commercial 7 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | 9 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 10 | -- wrote the original software. If you use this software in a product, an acknowledgment 11 | -- in the product documentation would be appreciated but is not required. 12 | -- 13 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 14 | -- as being the original software. 15 | -- 16 | -- 3. This notice may not be removed or altered from any source distribution. 17 | 18 | newoption 19 | { 20 | trigger = "graphics", 21 | value = "OPENGL_VERSION", 22 | description = "version of OpenGL to build raylib against", 23 | allowed = { 24 | { "opengl11", "OpenGL 1.1"}, 25 | { "opengl21", "OpenGL 2.1"}, 26 | { "opengl33", "OpenGL 3.3"}, 27 | { "opengl43", "OpenGL 4.3"} 28 | }, 29 | default = "opengl33" 30 | } 31 | 32 | function string.starts(String,Start) 33 | return string.sub(String,1,string.len(Start))==Start 34 | end 35 | 36 | function link_to(lib) 37 | links (lib) 38 | includedirs ("../"..lib.."/include") 39 | includedirs ("../"..lib.."/" ) 40 | end 41 | 42 | function download_progress(total, current) 43 | local ratio = current / total; 44 | ratio = math.min(math.max(ratio, 0), 1); 45 | local percent = math.floor(ratio * 100); 46 | print("Download progress (" .. percent .. "%/100%)") 47 | end 48 | 49 | function check_raylib() 50 | if(os.isdir("raylib") == false and os.isdir("raylib-master") == false) then 51 | if(not os.isfile("raylib-master.zip")) then 52 | print("Raylib not found, downloading from github") 53 | local result_str, response_code = http.download("https://github.com/raysan5/raylib/archive/refs/heads/master.zip", "raylib-master.zip", { 54 | progress = download_progress, 55 | headers = { "From: Premake", "Referer: Premake" } 56 | }) 57 | end 58 | print("Unzipping to " .. os.getcwd()) 59 | zip.extract("raylib-master.zip", os.getcwd()) 60 | os.remove("raylib-master.zip") 61 | end 62 | end 63 | 64 | workspaceName = path.getbasename(os.getcwd()) 65 | 66 | if (string.lower(workspaceName) == "raylib") then 67 | print("raylib is a reserved name. Name your project directory something else.") 68 | -- Project generation will succeed, but compilation will definitely fail, so just abort here. 69 | os.exit() 70 | end 71 | 72 | workspace (workspaceName) 73 | configurations { "Debug", "Release"} 74 | platforms { "x64", "x86", "ARM64"} 75 | 76 | defaultplatform ("x64") 77 | 78 | filter "configurations:Debug" 79 | defines { "DEBUG" } 80 | symbols "On" 81 | 82 | filter "configurations:Release" 83 | defines { "NDEBUG" } 84 | optimize "On" 85 | 86 | filter { "platforms:x64" } 87 | architecture "x86_64" 88 | 89 | filter { "platforms:Arm64" } 90 | architecture "ARM64" 91 | 92 | filter {} 93 | 94 | targetdir "bin/%{cfg.buildcfg}/" 95 | 96 | if(os.isdir("game")) then 97 | startproject(workspaceName) 98 | end 99 | 100 | cdialect "C99" 101 | cppdialect "C++17" 102 | check_raylib(); 103 | 104 | include ("raylib_premake5.lua") 105 | 106 | if(os.isdir("game")) then 107 | include ("game") 108 | end 109 | 110 | folders = os.matchdirs("*") 111 | for _, folderName in ipairs(folders) do 112 | if (string.starts(folderName, "raylib") == false and string.starts(folderName, ".") == false) then 113 | if (os.isfile(folderName .. "/premake5.lua")) then 114 | print(folderName) 115 | include (folderName) 116 | end 117 | end 118 | end 119 | -------------------------------------------------------------------------------- /premake5.osx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raylib-extras/GameObjectsExample/6d21b80269f823b321afae152a4e2a794ab815ed/premake5.osx -------------------------------------------------------------------------------- /raylib_premake5.lua: -------------------------------------------------------------------------------- 1 | -- Copyright (c) 2020-2024 Jeffery Myers 2 | -- 3 | --This software is provided "as-is", without any express or implied warranty. In no event 4 | --will the authors be held liable for any damages arising from the use of this software. 5 | 6 | --Permission is granted to anyone to use this software for any purpose, including commercial 7 | --applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | 9 | -- 1. The origin of this software must not be misrepresented; you must not claim that you 10 | -- wrote the original software. If you use this software in a product, an acknowledgment 11 | -- in the product documentation would be appreciated but is not required. 12 | -- 13 | -- 2. Altered source versions must be plainly marked as such, and must not be misrepresented 14 | -- as being the original software. 15 | -- 16 | -- 3. This notice may not be removed or altered from any source distribution. 17 | 18 | function platform_defines() 19 | defines{"PLATFORM_DESKTOP"} 20 | 21 | filter {"options:graphics=opengl43"} 22 | defines{"GRAPHICS_API_OPENGL_43"} 23 | 24 | filter {"options:graphics=opengl33"} 25 | defines{"GRAPHICS_API_OPENGL_33"} 26 | 27 | filter {"options:graphics=opengl21"} 28 | defines{"GRAPHICS_API_OPENGL_21"} 29 | 30 | filter {"options:graphics=opengl11"} 31 | defines{"GRAPHICS_API_OPENGL_11"} 32 | 33 | filter {"system:macosx"} 34 | disablewarnings {"deprecated-declarations"} 35 | 36 | filter {"system:linux"} 37 | defines {"_GLFW_X11"} 38 | defines {"_GNU_SOURCE"} 39 | -- This is necessary, otherwise compilation will fail since 40 | -- there is no CLOCK_MONOTOMIC. raylib claims to have a workaround 41 | -- to compile under c99 without -D_GNU_SOURCE, but it didn't seem 42 | -- to work. raylib's Makefile also adds this flag, probably why it went 43 | -- unnoticed for so long. 44 | -- It compiles under c11 without -D_GNU_SOURCE, because c11 requires 45 | -- to have CLOCK_MONOTOMIC 46 | -- See: https://github.com/raysan5/raylib/issues/2729 47 | 48 | filter{} 49 | end 50 | 51 | function get_raylib_dir() 52 | if (os.isdir("raylib-master")) then 53 | return "raylib-master" 54 | end 55 | if (os.isdir("../raylib-master")) then 56 | return "raylib-master" 57 | end 58 | return "raylib" 59 | end 60 | 61 | function link_raylib() 62 | links {"raylib"} 63 | 64 | raylib_dir = get_raylib_dir(); 65 | includedirs {"../" .. raylib_dir .. "/src" } 66 | includedirs {"../" .. raylib_dir .."/src/external" } 67 | includedirs {"../" .. raylib_dir .."/src/external/glfw/include" } 68 | platform_defines() 69 | 70 | filter "action:vs*" 71 | defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"} 72 | dependson {"raylib"} 73 | links {"raylib.lib"} 74 | characterset ("MBCS") 75 | buildoptions { "/Zc:__cplusplus" } 76 | 77 | filter "system:windows" 78 | defines{"_WIN32"} 79 | links {"winmm", "kernel32", "gdi32"} 80 | libdirs {"../bin/%{cfg.buildcfg}"} 81 | 82 | filter "system:linux" 83 | links {"pthread", "m", "dl", "rt", "X11"} 84 | 85 | filter "system:macosx" 86 | links {"OpenGL.framework", "Cocoa.framework", "IOKit.framework", "CoreFoundation.framework", "CoreAudio.framework", "CoreVideo.framework", "AudioToolbox.framework"} 87 | 88 | filter{} 89 | end 90 | 91 | function include_raylib() 92 | raylib_dir = get_raylib_dir(); 93 | includedirs {"../" .. raylib_dir .."/src" } 94 | includedirs {"../" .. raylib_dir .."/src/external" } 95 | includedirs {"../" .. raylib_dir .."/src/external/glfw/include" } 96 | platform_defines() 97 | 98 | filter "action:vs*" 99 | defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"} 100 | 101 | filter{} 102 | end 103 | 104 | project "raylib" 105 | kind "StaticLib" 106 | raylib_dir = get_raylib_dir(); 107 | 108 | platform_defines() 109 | 110 | location (raylib_dir) 111 | language "C" 112 | targetdir "bin/%{cfg.buildcfg}" 113 | 114 | filter "action:vs*" 115 | defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"} 116 | characterset ("MBCS") 117 | buildoptions { "/Zc:__cplusplus" } 118 | filter{} 119 | 120 | print ("Using raylib dir " .. raylib_dir); 121 | includedirs {raylib_dir .. "/src", raylib_dir .. "/src/external/glfw/include" } 122 | vpaths 123 | { 124 | ["Header Files"] = { raylib_dir .. "/src/**.h"}, 125 | ["Source Files/*"] = { raylib_dir .. "/src/**.c"}, 126 | } 127 | files {raylib_dir .. "/src/*.h", raylib_dir .. "/src/*.c"} 128 | 129 | removefiles {raylib_dir .. "/src/rcore_*.c"} 130 | 131 | filter { "system:macosx", "files:" .. raylib_dir .. "/src/rglfw.c" } 132 | compileas "Objective-C" 133 | 134 | filter{} 135 | -------------------------------------------------------------------------------- /resources/raylib_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raylib-extras/GameObjectsExample/6d21b80269f823b321afae152a4e2a794ab815ed/resources/raylib_logo.png -------------------------------------------------------------------------------- /resources/scarfy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raylib-extras/GameObjectsExample/6d21b80269f823b321afae152a4e2a794ab815ed/resources/scarfy.png -------------------------------------------------------------------------------- /resources/wabbit_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raylib-extras/GameObjectsExample/6d21b80269f823b321afae152a4e2a794ab815ed/resources/wabbit_alpha.png --------------------------------------------------------------------------------