zzxzzk115 / GameEngineStarter

A minimal C++ game engine starter project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GameEngineStarter

GameEngineStarter is a minimal C++ game engine starter project.

Have fun and for free use this template to make your game engine!

Features

  • Cross-Platform: Windows, macOS, Linux, ARM Linux (Raspberry Pi), Emscripten (WASM) and Modern Android.
  • Minimal & Popular Dependencies: Only spdlog, glad, imgui, glfw, sdl2.

    For Android, we need GameActivity and EGL.

  • Using XMake as Project Generator & Builder: Combining the functionalities of various build tools, incorporating the speed of Ninja, and introducing customizable library repositories, results in a versatile and efficient build system.
  • Minimal system implemented: A simple cross-platform window is implemented using either GLFW or SDL2 paired with OpenGL. This provides a fundamental GL/GLES context for basic graphics operations.

Windows GLFW OpenGL

Showcases

For more showcases, please visit Media/Showcases

Prerequisites

Ensure to globally replace instances of SomeEngine with the name of your game engine and replace SOME_ENGINE with the designated macro prefix for your game engine.

Windows

  • XMake
  • Visual Studio 2019 (or above) with C++ Desktop Development Environment
  • Git 2.1 (or above)

macOS

  • XMake
  • XCode 13 (or above)
  • Git 2.1 (or above)

To install XMake on macOS, you can use HomeBrew:

brew install xmake

Linux

Ubuntu / Raspberry Pi OS / Other Debian Systems

To install XMake, simply use curl:

curl -fsSL https://xmake.io/shget.text | bash

Install other packages:

sudo apt-get install build-essential cmake git clang libx11-dev libxrandr-dev libxrender-dev libglvnd-dev libxinerama-dev libxcursor-dev libxi-dev

Other Linux Systems

TODO

Emscripten

  • Install Xmake as above.
  • Install Emscripten by following official documentation.

Build Engine

Clone this repo and go to the root directory first:

git clone git@github.com:zzxzzk115/GameEngineStarter.git --recursive
cd GameEngineStarter

Build on Windows

In CMD or Powershell, at the Source directory, execute xmake -v -y.

Or simply double click xmake_windows.bat.

Build on macOS / Linux

cd Source
xmake -v -y

Build for Emscripten

cd Source
xmake f -p wasm
xmake -v -y

Build for Android

Currently, I've made a demo that shows how to use xmake to build an Android Native project by using GameActivity and xmake-gradle.

Now you can build an Android demo by executing the:

cd GameTemplate/Android/android
./gradlew app:assembleDebug
# ./gradlew app:assembleRelease

You may have to set the JAVA_HOME system environment.

The generated APK file will be at GameTemplate/Android/android/app/build/outputs/apk/{mode}

The virtual keyboard is not working, which I'll fix later on.

Build Options

Window Option

Switch to SDL2:

xmake f --window=sdl2
xmake

Switch to GLFW:

xmake f --window=glfw
xmake

Clear configs

xmake f -c

Run projects

Run all programs:

xmake run

Run a specific programe:

xmake run Playground

Debug projects

For example, debug Playground:

cd Source
xmake f -m debug # Switch to debug mode

# Switch to release mode:
# xmake f -m release

xmake -v -y
xmake run Playground

If you want to know more about XMake, please visit their official document website.

FAQ

Q: Why not using CMake, Premake, Scons and other project generators or build systems?

A: CMake can be challenging to use. Premake and Scons offer easier alternatives, but they both lack a dedicated package manager. XMake, on the other hand, comes with its official repository serving as a cross-platform package manager. Additionally, it allows you to fork it and implement your own package manager. Leveraging XMake makes managing dependencies a more straightforward process.

Q: Can I integrate other build system project, for example, use CMake and Makefile projects? Premake? Scons?

A: Yes, you certainly can. XMake inherently supports various build tools. If you can't locate a project in the official repository, you have the flexibility to utilize package managers such as vcpkg, conda, homebrew, pacman, apt, and more. Additionally, you have the option to fork the official repository and independently add a package to suit your needs.

License

This project is licensed under the MIT license.

About

A minimal C++ game engine starter project.

License:MIT License


Languages

Language:C++ 91.5%Language:C 4.6%Language:Lua 2.4%Language:Kotlin 1.5%Language:Batchfile 0.0%