{"id":18805587,"url":"https://github.com/melchor629/retro","last_synced_at":"2025-04-13T19:12:30.366Z","repository":{"id":145875603,"uuid":"125076107","full_name":"melchor629/retro","owner":"melchor629","description":"A simple retro-pixelart 2D game engine (Hacker's Week 5 workshop)","archived":false,"fork":false,"pushed_at":"2018-03-21T15:00:21.000Z","size":227,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T09:51:52.741Z","etag":null,"topics":["android","cmake","engine","game","glm","ios","linux","macos","retro","sdl2","sdl2-mixer","sdl2-ttf","stb-image","windows","workshop"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/melchor629.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":"2018-03-13T15:48:36.000Z","updated_at":"2024-04-11T17:49:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"6d9a1ce8-762f-4d2d-b01a-2b12aae675cc","html_url":"https://github.com/melchor629/retro","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melchor629%2Fretro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melchor629%2Fretro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melchor629%2Fretro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melchor629%2Fretro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melchor629","download_url":"https://codeload.github.com/melchor629/retro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248766743,"owners_count":21158301,"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":["android","cmake","engine","game","glm","ios","linux","macos","retro","sdl2","sdl2-mixer","sdl2-ttf","stb-image","windows","workshop"],"created_at":"2024-11-07T22:44:27.139Z","updated_at":"2025-04-13T19:12:30.360Z","avatar_url":"https://github.com/melchor629.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# retro++\n\n`retro++` is a simple retro-pixelart 2D game engine that aims to help to introduce anybody with knowledge of programming (specially with C++) into the world of game development without having to deal with the low-level APIs OpenGL or DirectX, or with newer APIs like Vulkan or Metal (both unsupported in this engine).\n\n## Clone the repo\n\n`git clone --recursive https://github.com/melchor629/retro`\n\nThe repo has submodules on it, so it will initialize them when cloning.\n\n## CMake\n\nTo build the project, and do it consistently among Windows, Linux and macOS computers, retro++ uses [CMake][6] to generate the necessary files depending on the platform.\n\nThe `CMakeFile.txt` on Windows and macOS will call a script that will download the SDL2 libraries and headers for you. If one of the scripts fail, try executing them manually, specially if you are on Windows because the script is a PowerShell script and executing them requires Administrator permissions in some cases. In both platforms, using CMake GUI is enough and it is not needed to make any changes to the configuration to make it work.\n\nOn Linux, while debugging, you should set `CMAKE_BUILD_TYPE` to `Debug` using either the CMake GUI or in terminal with `-DCMAKE_BUILD_TYPE=Debug`.\n\n## How to prepare the project\n\n### Windows\n\nMingw nor Cygwin are supported, so you must use [Visual Studio 2015 or 2017][7] with C/C++ support to compile the project. You can install the compilers only. It's up to you.\n\nThe project is created through [CMake][6]. Download the [app][8] (search for \"Latest Release...\") and install it (if you downloaded the installer) or decompress it anywhere (if you downloaded the zip).\n\nIf you have Windows 7, ensure that PowerShell is installed to. The CMake script executes a PowerShell script that download the libraries needed for you :)\n\nTo prepare the Visual Studio solution, open CMake. In the first text field, labelled with _Where is the source code?_ select the path where you cloned or downloaded this repo. Then copy that path and paste it in the second text field, labelled with _Where to build the source code_ and append `/build` at the end. An example:\n\n  - Where is the source code? `C:/Users/melchor629/Documents/GitHub/retro++`\n  - Where to build the source code? `C:/Users/melchor629/Documents/GitHub/retro++/build`\n\nOnce done, press the **Configure** button. A window will open telling you to \"specify the generator for this project\", and more. For that dropdown, check that says _Visual Studio ?? 201? Win64_ where you must select 2015 or 2017 version depending on what you have installed. Important that the _generator_ ends with Win64. 32bit Windows is not supported. When the _generator_ is selected, press **Finish**. When the configuration step is done, you can press **Generate** and will generate the solution. Now you can press **Open Project**. Happy coding :)\n\n### Debian and Ubuntu based Linux distros\n\nFirst, you must install the compilers, some tools and the dependencies. This is done with the following command:\n\n```bash\nsudo apt update\nsudo apt install build-essential g++ cmake libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev timidity\n```\n\nThen, execute `g++ --version`. If the version is below 7, then you must install GNU G++ 7 (6 is untested, might work without using 7). To do it in Ubuntu and Linux Mint, execute:\n\n```bash\nsudo add-apt-repository ppa:ubuntu-toolchain-r/test\nsudo apt update\nsudo apt install g++-7\n```\n\nOn Debian 8 or 9, see https://stackoverflow.com/questions/43151627/installing-g-7-0-1-on-debian-8-7.\n\nAfter installing dependencies and the compilers, `cd` to the cloned directory. Then create a `build` directory (`mkdir build`) and `cd` to it. If you didn't have to install g++-7 separately, you can execute:\n\n```bash\ncmake -DCMAKE_BUILD_TYPE=Debug ..\nmake -j2 #You can put another number, if you have 8 cores, put 8 fe\n./retro++ #This executes the game, if everything went good\n```\n\nIf you had to install g++-7 separately, you will execute:\n\n```bash\ncmake -DCMAKE_CXX_COMPILER=$(which g++-7) -DMAKE_C_COMPILER=$(which gcc-7) -DCMAKE_BUILD_TYPE=Debug ..\nmake -j2 #You can put another number, if you have 8 cores, put 8 fe\n./retro++ #This executes the game, if everything went good\n```\n\nAnd that's all. Now you have the project files to compile the game. Happy coding :)\n\nTo make a release build, to be able to export or install anywhere, execute the `cmake` command changing _Debug_ with _Release_. Also could be good to specify where you want to \"export\" the game. That can be done by adding `-DCMAKE_INSTALL_PREFIX=YOUR_PATH` before the dots. Then, with `make install` (may need `sudo`) you will have an exportable version of your game.\n\n### Arch Linux based Linux distros\n\nFirst, you must install the compilers, some tools and the dependencies. This is done with the following command:\n\n```bash\nsudo pacman -S cmake sdl2 sdl2_ttf sdl2_mixer #-Syu is also valid instead of -S\n```\n\nThen, `cd` to the cloned directory. Then create a `build` directory (`mkdir build`) and `cd` to it. Execute this:\n\n```bash\ncmake -DCMAKE_BUILD_TYPE=Debug ..\nmake -j2 #You can put another number, if you have 8 cores, put 8 fe\n./retro++ #This executes the game, if everything went good\n```\n\nAnd that's all. Now you have the project files to compile the game. Happy coding :)\n\nTo make a release build, to be able to export or install anywhere, execute the `cmake` command changing _Debug_ with _Release_. Also could be good to specify where you want to \"export\" the game. That can be done by adding `-DCMAKE_INSTALL_PREFIX=YOUR_PATH` before the dots. Then, with `make install` (may need `sudo`) you will have an exportable version of your game.\n\n### macOS\n\nFirst you must install [Xcode][9]. Then download [CMake app][8] and put it where you want. When both apps are ready, open Xcode, if it is the first time you do, it will install the compilers and some tools.\n\nThen, open CMake. In the first text field, labelled with _Where is the source code?_ select the path where you cloned or downloaded this repo. Then copy that path and paste it in the second text field, labelled with _Where to build the source code_ and append `/build` at the end. An example:\n\n  - Where is the source code? `/Users/melchor629/Documents/GitHub/retro++`\n  - Where to build the source code? `/Users/melchor629/Documents/GitHub/retro++/build`\n\nOnce done, press the **Configure** button. A window will open telling you to \"specify the generator for this project\", and more. For that dropdown, check that says _Xcode_, it is usually selected. You can also use `Makefile` if you prefer the Linux approach. When the _generator_ is selected, press **Finish**. When the configuration step is done, you can press **Generate** and will generate the Xcode project, or the Makefiles. Now you can press **Open Project** in case of select Xcode, and compile from terminal if you selected Makefiles. In Xcode, search for the Play - Stop buttons at the top-left corner, and change the target from `ALL_BUILD` to `retro++`. Happy coding :)\n\n  \u003e **Note**: If you select `Makefile`, search the property `CMAKE_BUILD_TYPE` and write `Debug`.\n\nFor export an `.app` of your game, first search in CMake the property `CMAKE_INSTALL_PREFIX` and put where you want to export your game. If you selected `Makefile` as the generator, also modify `CMAKE_BUILD_TYPE` to `Release`. Then press generate. In Xcode, change the target (its near the Play - Stop buttons) from `retro++` to `INSTALL`, and press the Play button. For `Makefile`, execute `make install`. _Game exported_.\n\n### Android\n\nTo make an Android version of your game, first follow the following tutorial for your platform [da tutorial][1]. After this, download the sources for [SDL2][2], [SDL_ttf][3] and [SDL_mixer][4]. Put them under the folder `jni`. Then, create symbolic links of `src/base`, `src/editor`, `src/game`, `lib/glm`, `lib/json`, `lib/stb` and `lib/utfcpp`.\n\n```bash\n#It's only an example, for illustrate you\nln -s \"/Users/melchor9000/Desktop/retro++/src/base\" \"/Users/melchor9000/Desktop/retro++/src/editor\" \"/Users/melchor9000/Desktop/retro++/src/game\" .\nln -s \"/Users/melchor9000/Desktop/retro++/lib/glm\" \"/Users/melchor9000/Desktop/retro++/lib/json\" \"/Users/melchor9000/Desktop/retro++/lib/stb\" \"/Users/melchor9000/Desktop/retro++/lib/utfcpp\" .\n```\n\nAnd then, modify `app/src/main/jni/src/Android.mk` to look like the one that you can find in [android/app/src/main/jni/src/Android.mk](https://github.com/melchor629/retro/blob/master/android/app/src/main/jni/src/Android.mk).\n\nModify `app/src/main/jni/Application.mk` to look like this one [android/app/src/main/jni/Application.mk](https://github.com/melchor629/retro/blob/master/android/app/src/main/jni/Application.mk).\n\nAlso modify `app/src/AndroidManifest.xml`, following the commentaries found there.\n\nCopy the contents of `android/app/src/main/java/` (from the [repo](https://github.com/melchor629/retro/blob/master/android/app/src/main/java/)) into your project. Contains only an Activity. That activity calls some C++ code required for the engine. While editing the manifest, create a new Activity that extends `me.melchor9000.retro.RetroActivity`, in your desired package.\nMake that new activity your default activity.\n\nIf you get an error compiling SDL_mixer, try to download [SDL_mixer][5] from there.\n\n### iOS\n\nTo make an iOS version of your game, first download the sources for [SDL2][2], [SDL_ttf][3] and [SDL_mixer][4]. Put them under the root folder of the iOS project. Then, create symbolic links of `src/base`, `src/editor`, `src/game`, `lib/glm`, `lib/json`, `lib/stb` and `lib/utfcpp`.\n\n```bash\n#It's only an example, for illustrate you\nln -s \"/Users/melchor9000/Desktop/retro++/src/base\" \"/Users/melchor9000/Desktop/retro++/src/editor\" \"/Users/melchor9000/Desktop/retro++/src/game\" .\nln -s \"/Users/melchor9000/Desktop/retro++/lib/glm\" \"/Users/melchor9000/Desktop/retro++/lib/json\" \"/Users/melchor9000/Desktop/retro++/lib/stb\" \"/Users/melchor9000/Desktop/retro++/lib/utfcpp\" .\n```\n\nThen, go to `SDL2-2.0.7/Xcode-iOS/Template/SDL iOS Application` and copy that folder to `SDL2-2.0.7/SDL iOS Application`. Remove the Xcode project and paste the one inside `ios`. Should work correctly.\n\nThe Xcode project defines the macro `__IOS__` to differentiate between macOS and iOS.\n\n## inspect.py\n\nThis Python 3 script allows you to use the Inspection API quickly. To send commands, write them argument as arguments. If you want to modify an attribute, add at the end `=THE_VALUE`. If the value is an object, use JSON format.\n\n`python3 inspect.py game::currentLevel::uiObjects::0::text=\"Some text\" game::currentLevel::uiObjects::0::font='{\"size\": 10}'`\n\n## Where's the resources?\n\nYou can find the resources in [this link][10]. Download it, and extract it in `res`.\n\n## Libraries\n \n`retro++` uses the following great libraries:\n\n  - [SDL2](https://www.libsdl.org/)\n  - [SDL2_ttf](https://www.libsdl.org/projects/SDL_ttf/)\n  - [SDL2_mixer](https://www.libsdl.org/projects/SDL_mixer/)\n  - [nlohmann/json](https://github.com/nlohmann/json)\n  - [nothings/stb (stb_image)](https://github.com/nothings/stb)\n  - [nemtrif/utfcpp](https://github.com/nemtrif/utfcpp)\n  - [glm](https://github.com/g-truc/glm)\n\n  [1]: http://lazyfoo.net/tutorials/SDL/52_hello_mobile/index.php\n  [2]: https://www.libsdl.org/release/SDL2-2.0.8.tar.gz\n  [3]: https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz\n  [4]: https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.2.tar.gz\n  [5]: https://hg.libsdl.org/SDL_mixer/archive/tip.zip\n  [6]: https://cmake.org\n  [7]: https://www.visualstudio.com/\n  [8]: https://cmake.org/download/\n  [9]: https://itunes.apple.com/es/app/xcode/id497799835?mt=12\n  [10]: https://www.dropbox.com/s/w2jafy4b5rtpwox/resources-retro%2B%2B.7z?dl=1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelchor629%2Fretro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelchor629%2Fretro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelchor629%2Fretro/lists"}