GithubHelp home page GithubHelp logo

zzxzzk115 / gameenginestarter Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 26.33 MB

A minimal C++ game engine starter project.

License: MIT License

C++ 91.46% C 4.60% Lua 2.39% Batchfile 0.03% Kotlin 1.52%
cpp17 game-engine glfw imgui opengl opengl-es sdl2 spdlog

gameenginestarter's Introduction

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 [email protected]: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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.