{"id":18257927,"url":"https://github.com/linkdd/sdl-game-engine","last_synced_at":"2025-04-04T18:31:27.492Z","repository":{"id":71015356,"uuid":"77451009","full_name":"linkdd/sdl-game-engine","owner":"linkdd","description":"2D game engine based on SDL2","archived":true,"fork":false,"pushed_at":"2018-11-14T07:48:20.000Z","size":154,"stargazers_count":93,"open_issues_count":1,"forks_count":13,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-02-28T17:45:21.199Z","etag":null,"topics":["2d-game-engine","collision-detection","scene-graph","sdl"],"latest_commit_sha":null,"homepage":"https://linkdd.github.io/sdl-game-engine/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linkdd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-27T11:37:31.000Z","updated_at":"2025-02-15T02:29:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"7f5b2433-49db-469e-9a97-a926fdeb5639","html_url":"https://github.com/linkdd/sdl-game-engine","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdd%2Fsdl-game-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdd%2Fsdl-game-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdd%2Fsdl-game-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdd%2Fsdl-game-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linkdd","download_url":"https://codeload.github.com/linkdd/sdl-game-engine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247229382,"owners_count":20905040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2d-game-engine","collision-detection","scene-graph","sdl"],"created_at":"2024-11-05T10:28:11.249Z","updated_at":"2025-04-04T18:31:27.487Z","avatar_url":"https://github.com/linkdd.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SDL Game Engine\n\nThis project aims to create a full 2D game engine for the SDL2 library.\n\n## Features\n\n### Asset management\n\nThe ``AssetManager`` has a set of **Locators** and **Loaders**.\n\nA **locator** is used to check if the requested asset exists. It will return a pointer\nto the asset location.\n\nExample:\n\n - ``FileLocator``: check if the requested asset exists on-disk.\n - ``ZipLocator``: check if the requested asset exists in a ZIP archive (*todo*).\n - ``URLLocator``: check if the requested asset exists at a URL (*todo*).\n\nA **loader** is used to load the asset from the pointer returned by the **locator**.\n\nExample:\n\n - ``ImageLoader``: using **SDL2_image**, loads an image.\n - ``FontLoader``: using **SDL2_ttf**, loads a TTF font.\n - ``JSONLoader``: loads a JSON file.\n - ``AudioLoader``: loads a sound file (*todo*).\n\nAsset requests are made using an ``AssetDescriptor``. The descriptor holds all\ninformations about the asset (ie: name, font size, bit rate, ...).\n\nThe **manager** holds a cache of asset and descriptors. If a descriptor has already\nbeen loaded, the same asset is returned.\n\n### Actions management\n\nMap keys, mouse buttons and controller buttons to a named action, and then check\nin your code if the action is triggered or not.\n\n### Scene management\n\nThe ``SceneManager`` keeps track of all your game's scenes. It handles the scene\nloading and unloading, and notify the scene's graph of inputs, updates, and draw\nrequests.\n\nThe **scene graph** is a tree of node, each one implementing a specific task:\n\n - when a node enters the tree, it will be notified.\n - when all node's children have entered the tree, the node will be notified.\n - when a node leaves the tree, it will be notified.\n - when the scene receives an input, all nodes of the graph handling inputs will receive it.\n - when the scene must be updated, all nodes of the graph handling updates will be notified.\n - when the scene must be drawn, all nodes of the graph handling drawing will be notified.\n\nExample of nodes:\n\n - ``PositionNode``: handle relative and absolute position\n - ``SpriteNode``: loads an asset and draw at a position\n - ``AnimatedSpriteNode``: loads multiple asset, change the frame on update, draw at a position\n - ``AreaNode``: notified when overlaps with another ``AreaNode``\n - ...\n\nIn order to create a ``Scene``, you just need to inherit from it, and creates your\nnodes in the ``load()`` method, and delete them in the ``unload()`` method.\n\n### Physic Engine\n\nSpecific nodes in the scene graph are used for collision detection:\n\n - ``BodyNode``: is notified for a collision\n - ``BoundingBoxNode``: as a child of the ``BodyNode``, defines a bounding box used to filter out nodes in the collision detection\n - ``CollisionShapeNode``: as a child of the ``BodyNode``, defines the shape used to check for accurate collision\n\n2-step collision detection:\n\n - for each ``BodyNode``, check if at least one child ``BoundingBoxNode`` is overlapping\n - for each ``BodyNode`` with at least one ``BoundingBoxNode`` overlapping, construct the ``ContactManifold`` for each child ``CollisionShapeNode``\n\nFinally, the ``BodyNode`` is notified of a collision by receiving the resulting ``ContactManifold``.\n\n### Initializers\n\nIf you want to initialize libraries (ie: Stemworks API) and unload them at shutdown,\njust inherit from ``Initializer`` and add it to the engine instance.\n\nAt the moment, the following initializers are enabled by default:\n\n - SDL2\n - SDL2_image\n - SDL2_ttf\n - SDL Window/Renderer creation\n\n### Configuration\n\nThe engine instance is initialized with a configuration object, used to customize\nhow the engine will works. Feel free to use it to customize:\n\n - actions (for configurable controls in your game)\n - some of your nodes\n - ...\n\n**NB:** The configuration object does not handle loading from a file and saves.\n\n## Build\n\nYou need ``cmake`` and a compiler supporting the **C++14** standard.\n\n    $ mkdir __build__\n    $ cd __build__\n    $ cmake ..\n    $ make\n\n## License\n\nThis project is released under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkdd%2Fsdl-game-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinkdd%2Fsdl-game-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkdd%2Fsdl-game-engine/lists"}