THIS IS A COPY OF PHILIP BOURKE'S REPO. IT HAS BEEN EDITTED TO WORK WITH C++
A cross-platform Makefile starter kit for building desktop and web applications using Raylib and Emscripten. This toolkit enables developers to create games that run on Linux, Windows, macOS, and web browsers from a single codebase.
This starter kit provides:
-
Cross-platform development environment setup
-
Desktop builds (Linux, Windows, macOS)
-
Web builds (HTML/JavaScript via Emscripten)
-
Automated toolchain setup scripts
-
Sample project structure
raylib_starter/ ├── include/ │ ├── game.h # Game update methods │ ├── player.h # (Optional) Player-related methods and data │ ├── enemy.h # (Optional) Enemy-related methods and data │ └── collision.h # (Optional) Collision detection functions ├── src/ │ ├── main.c # Hello Raylib and GameLoop │ ├── game.c # Game update implementation │ ├── player.c # (Optional) Player logic and update implementation │ ├── enemy.c # (Optional) Enemy logic and update implementation │ └── collision.c # (Optional) Collision detection logic ├── template/ │ └── template.html # Basic index HTML game page template ├── toolchain/ │ ├── build_web.sh # Build emcc web target │ ├── clone_repo.sh # Clone and build from source │ ├── toolchain_linux.sh # Debian, Ubuntu, Linux Mint, and WSL setup │ ├── toolchain_macos.sh # macOS setup │ ├── toolchain_windows.sh # Windows setup using MSYS2 │ └── resources/ # Resource files for messages, helpers, etc. │ ├── messages.mk # Standard messages for Makefile outputs │ └── messages.sh # MEssage functions ├── Makefile # Central build management with platform detection └── README.md # Project setup, usage, and contribution guide
- C/C++ development environment
- CMake (3.0 or higher)
- Git
- Platform-specific build tools
- Python (for web server)
-
Install Dependencies
# Update system packages sudo apt update sudo apt upgrade # Install build tools sudo apt install -y build-essential cmake git
-
Clone and Setup
# Clone repository git clone https://bitbucket.org/MuddyGames/raylib_starter.git cd raylib_starter # Set up toolchain chmod +x toolchain_linux.sh chmod +x build_web.sh make
-
Install MSYS2
- Download MSYS2 from msys2.org
- Run the installer and follow the setup instructions
- Open MSYS2 UCRT64 terminal
-
Setup Development Environment
# Update package database pacman -Syu # Install required tools pacman -S git make mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake
-
Clone and Setup
git clone https://bitbucket.org/MuddyGames/raylib_starter.git cd raylib_starter make
-
Install Dependencies
# Install Homebrew if not already installed /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install required packages brew update brew install cmake brew install gcc brew install git
-
Clone and Setup
# Clone repository git clone https://bitbucket.org/MuddyGames/raylib_starter.git cd raylib_starter # Set up toolchain chmod +x toolchain_macos.sh make
Use the following make commands to build and run your project:
# Build all targets (desktop)
make all
# Build desktop version
make build
# Run desktop version
make run
# Build web version
make build_web
# Run web version (starts local server)
make run_web
# Clean build files
make clean
# Clean toolchain files
make clean_toolchain
# Build release (desktop)
make CONFIG=releaseThe web version requires Emscripten for compilation. The toolchain script will handle the installation automatically. To run the web version:
-
Build the web version:
make build_web
-
Start the local server:
make run_web
-
Open your browser and navigate to
http://localhost:8000
For questions and support, contact:
- MuddyGames