https://github.com/jhasse/jngl
Easy to use cross-platform 2D game library for C++
https://github.com/jhasse/jngl
android cross-platform game-engine game-engine-2d gamedev ios linux macos nintendo-switch openal opengl windows xbox
Last synced: 16 days ago
JSON representation
Easy to use cross-platform 2D game library for C++
- Host: GitHub
- URL: https://github.com/jhasse/jngl
- Owner: jhasse
- License: zlib
- Created: 2011-01-31T20:07:16.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2025-03-31T18:43:27.000Z (24 days ago)
- Last Synced: 2025-04-02T07:02:32.326Z (23 days ago)
- Topics: android, cross-platform, game-engine, game-engine-2d, gamedev, ios, linux, macos, nintendo-switch, openal, opengl, windows, xbox
- Language: C++
- Homepage: https://bixense.com/jngl/
- Size: 37.5 MB
- Stars: 293
- Watchers: 9
- Forks: 21
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-game-engine-dev - JNGL - 2D framework. Develop anywhere, deploy everywhere. (Libraries / C++)
- awesome-gamedev - JNGL
- AwesomeCppGameDev - JNGL
- awesome-game-engines - jngl - Easy to use cross-platform 2D game library for C++ (Uncategorized / Uncategorized)
README
# JNGL - Just a Neat Game Library
[🌐 Website](https://bixense.com/jngl/)
[🏃 Quickstart](https://github.com/jhasse/jngl/wiki/JNGL-Quickstart)
[🎓 Tutorial](https://github.com/pinguin999/my-jngl-starter)
[📚 Documentation](https://bixense.com/jngl/annotated.html)[](https://discord.gg/254P43HvWJ)
An easy to use C++ game library for Linux, Windows, macOS, Android, iOS, Xbox, the Nintendo Switch,
LG webOS and the Web.[](https://portaldogs.com/)
### Building from Source
```bash
cmake -Bbuild
cmake --build build
./build/jngl-test
```## Linux
### Ubuntu
```bash
sudo apt-get install libgl1-mesa-dev libfreetype6-dev libfontconfig1-dev libpng-dev \
libxxf86vm-dev libvorbis-dev cmake g++ libwebp-dev git libsdl2-dev
```
### Fedora
```bash
sudo dnf install fontconfig-devel freetype-devel libvorbis-devel libwebp-devel \
cmake SDL2-devel gcc-c++ libatomic
```
### Arch Linux
```bash
pacman -Syu --needed cmake gcc sdl2 pkg-config fontconfig libwebp libvorbis
```## Windows
### MSYS2 / MinGW-w64
Set up [MSYS2](https://www.msys2.org/) and install the following in a MinGW-w64 Win64 Shell:
```bash
pacman -Syu --needed mingw-w64-x86_64-gcc \
mingw-w64-x86_64-freetype mingw-w64-x86_64-libvorbis mingw-w64-x86_64-libwebp \
mingw-w64-x86_64-dlfcn mingw-w64-x86_64-cmake make mingw-w64-x86_64-gdb \
mingw-w64-x86_64-libtheora mingw-w64-x86_64-SDL2
```
### Visual Studio 2017 or newer
```bash
cmake -Bbuild -DFETCHCONTENT_QUIET=0
```
Then open `build/jngl.sln` in Visual Studio.## macOS
Use [Homebrew](http://brew.sh/) to install the build dependencies:
```bash
brew install sdl2 freetype libvorbis webp pkg-config cmake
```## Android
1. Install the Android SDK and set `ANDROID_HOME` to point to it.
2. In the Android SDK Manager, install the NDK build tools.
3. Run the following command to test via ADB:
```bash
make -C android run
```
Alternatively, open `android/test` in Android Studio and build from there.## iOS
Generate an Xcode project using CMake:
```bash
cmake -Bbuild-ios -GXcode -DCMAKE_TOOLCHAIN_FILE=cmake/iOS.toolchain.cmake -DIOS_PLATFORM=SIMULATOR
```
Then open and build `build-ios/jngl.xcodeproj` in Xcode.## Xbox
```bash
cmake -Bbuild-uwp -DCMAKE_SYSTEM_NAME=WindowsStore "-DCMAKE_SYSTEM_VERSION=10.0"
```
Then open `build-uwp/jngl.sln` in Visual Studio.## Example Usage
Here's a simple "Hello, World!" example in JNGL:
```cpp
#include
#includeclass MyGame : public jngl::Scene {
void step() override {
// game logic
}
void draw() const override {
text.draw(jngl::modelview().translate({ -100, 0 }));
}
jngl::Font font{ "Arial.ttf", 12 };
jngl::TextLine text{ font, "Hello World!" };
};jngl::AppParameters jnglInit() {
jngl::AppParameters params;
params.start = []() {
return std::make_shared();
};
return params;
}
```For a more complete starting point (i.e. project structure, etc.) check out the
[JNGL project template](https://github.com/jhasse/jngl-starter).