Skip to content

dennerkrans/raylib-game-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Default Raylib Game Template

A C++ application game template using raylib

Prerequisites

  • CMake 3.24 or higher
  • Ninja build system
  • C++17 compatible compiler
  • For web builds:
    • Emscripten SDK
    • Python 3 (for local web server)

Project Structure

.
├── .vscode/            # VSCode configuration
├── src/                # Source files
├── vendor/             # External dependencies (auto-downloaded)
│   └── raylib-5.5/     # raylib library
└── build/              # Build output

Building and Running

Desktop Build

  1. Configure the project:

    cmake -B build -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DPLATFORM=Desktop
  2. Build:

    cmake --build build

The executable will be created in build/default-game/.

Web Build

  1. Configure the project with Emscripten:

    emcmake cmake -B build-web -G Ninja -DPLATFORM=Web
  2. Build:

    cmake --build build-web
  3. Serve the web build:

    cd build-web/default-game && python3 -m http.server 8080
  4. Open http://localhost:8080/default-game.html in a web browser

VSCode Integration

The project includes VSCode configuration for seamless development:

Available Tasks

  • configure desktop: Configure for desktop build
  • configure web: Configure for web build
  • build debug: Build debug version (desktop)
  • build release: Build release version (desktop)
  • build web: Build web version
  • clean desktop: Clean desktop build
  • clean web: Clean web build
  • serve web: Start local server for web build

Launch Configurations

  • Debug: Launch desktop debug build
  • Release: Launch desktop release build
  • Launch Web Browser: Build, serve, and open web version in Chrome

Building and Debugging

  1. Press Cmd/Ctrl+Shift+B to build (defaults to debug build)
  2. Press F5 to build and debug
  3. Use the VSCode Command Palette to access other tasks

Development

  • The project uses C++17
  • raylib 5.5 is automatically downloaded to the vendor directory
  • Source files are in the src/ directory
  • Resources (images, sounds, etc.) should be placed in src/resources/

License

[Your license information here]

About

A base template for a raylib game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors