This is an attempt at recoding another project written in C# and Unity into C++ and Raylib.
The original game can be found here:
This game can now be found here:
Basically documented stages of development, deemed worthy enough of writing down or taking a picture of.
- Support added to build the game so that it runs on Android 9+
- Android support is pared back, such as there's no sidebar (score/level) visuals.
- Gesture input detection has been added to provide support for Android, but not limited to.
- Upgraded to Raylib v4.5.0
- Support added to build the game so that it runs in a browser, using Emscripten.
- Various minor bug fixes, some form before the switch to support browsers, some after.
- Player now has a death "scene"
- Background now resets when progression to the next level happens.
- Level progression is handled by an events system.
- Enemies now spawn as a random type.
- There's a difficulty level, which contributes to the score amount.
- Enemies also now spawn at random positions.
- Pause mechanism, starts paused and can be toggled by the letter 'p'.
- Background now progresses from solid to alternating blocks.
- Player can fire bullets and kill enemies.
- Enemies move and can kill players thus ending the game.
- There's a visible score, although only one enemy to score off of.
- Game has been scaled up by a factor of 2 from before.
- Has its first starting background (the brick border to the left and right)
- Has an "enemy" and "player" drawn, with some example fired bullets.
- The game does include the ability to move the player, but no limits on where and nothing else moves.
| Action | Keyboard | Touch |
|---|---|---|
| Pause | P | N/A |
| Move Left | A, Left Arrow | Swipe Left |
| Move Right | D, Right Arrow | Swipe Right |
| Shoot | Space | Tap |
Supported:
- Windows 10
- Linux
- Web
- Android
Unlikely future support:
- iOS
- MacOS
This is for building in Windows to be able to run on Windows.
- Create the Windows based toolchain based on the bundled MinGW in CLion.
- Create a CMake profile based on the toolchain.
- Build, run and debug as normal.
Basically this is the normal build in Windows to be able to run on Windows type thing.
-
Install MinGW natively on Windows, I use https://community.chocolatey.org
choco install mingw
-
Create a toolchain using MinGW and set the environment to the location of mingw and let it do its detection magic, for me mingw got installed under:
C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64 -
Create a CMake profile that uses the MinGW Windows toolchain.
-
Build, run and debug as normal now.
Basically this is build in Linux (Ubuntu) to be able to run on Windows.
-
Install MinGW in the WSL environment.
sudo apt install cmake mingw-w64 gdb-mingw-w64
-
Manually create the toolchain instead of relying on the CMake auto-detection.
CMake: /usr/bin/cmake Make: /usr/bin/make C Compiler: /usr/bin/x86_64-w64-mingw32-gcc C++ Compiler: /usr/bin/x86_64-w64-mingw32-g++ Debugger: /usr/bin/x86_64-w64-mingw32-gdb -
Create a CMake profile that uses the WSL MinGW tool chain and in the CMake options field add:
-DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake -
Build, run and debug as normal now.
Basically this is to build in Linux (Ubuntu) to be able to run on Linux.
-
Install some stuff for building
sudo apt install cmake build-essential gdb-multiarch
-
Install some stuff for Raylib dependencies
sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev
-
Create a toolchain using WSL and let the default defection to work as it should pick up the Linux GNU commands.
-
Create another CMake profile that uses the Linux WSL toolchain.
-
Update the run configuration for the GUI app you want to build and run from WSL to include the DISPLAY value for your machine. I could get away with setting
DISPLAY=%HOSTNAME%.mshome.net:0, but basically it's the same value as laid out in xlaunch/README.md. -
Build, run and debug as normal now.
This is to build in order to run in a browser, these instructions focus on Windows, but should be possible on Linux too.
-
Install Emscripten on Windows, I used https://community.chocolatey.org/packages/emscripten, there are more officially supported ways, but I'm lazy https://emscripten.org/docs/getting_started/downloads.html
choco install emscripten
-
Create a toolchain on the same platform as your Emscripten install and add in the CMake options field add:
-DCMAKE_TOOLCHAIN_FILE=${EMSDK_HOME}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DPLATFORM=Web -
Build as normal now but remember it is going to create a HTML page, which you can't launch like an executable.
Build this and it should it work on Android, if its not too old a version, API versions may need tweaking to add support.
This project was successfully compiled using NDK v26, older versions might not work.
Setup your local.properties to tell Gradle where your Android SDK is:
sdk.dir=C\:\\Android\\SdkUsing Gradle on the command line, this will build the native library and the Android APK:
./gradlew assembleDebugTo both build and install to an emulator or connect device run:
./gradlew installDebugUsing CLion, this optional only allows for building the native library for the Android project, create a new CMake
profile named Android using the same toolchain as the desktop, with these CMake options set:
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake
-DPLATFORM=Android
-DANDROID_ABI=x86
-DANDROID_PLATFORM=android-28


















