- Notifications
You must be signed in to change notification settings - Fork22
Easy to use cross-platform 2D game library for C++
License
jhasse/jngl
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
🌐 Website🏃 Quickstart🎓 Tutorial📚 Documentation
An easy to use C++ game library for Linux, Windows, macOS, Android, iOS, Xbox, the Nintendo Switch,LG webOS and the Web.
cmake -Bbuildcmake --build build./build/jngl-test
sudo apt-get install libgl1-mesa-dev libfreetype6-dev libfontconfig1-dev libpng-dev \libxxf86vm-dev libvorbis-dev cmake g++ libwebp-dev git libsdl2-dev
sudo dnf install fontconfig-devel freetype-devel libvorbis-devel libwebp-devel \cmake SDL2-devel gcc-c++ libatomic
pacman -Syu --needed cmake gcc sdl2 pkg-config fontconfig libwebp libvorbis
Set upMSYS2 and install the following in a MinGW-w64 Win64 Shell:
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
cmake -Bbuild -DFETCHCONTENT_QUIET=0
Then openbuild/jngl.sln
in Visual Studio.
UseHomebrew to install the build dependencies:
brew install sdl2 freetype libvorbis webp pkg-config cmake
- Install the Android SDK and set
ANDROID_HOME
to point to it. - In the Android SDK Manager, install the NDK build tools.
- Run the following command to test via ADB:
make -C android run
Alternatively, openandroid/test
in Android Studio and build from there.
Generate an Xcode project using CMake:
cmake -Bbuild-ios -GXcode -DCMAKE_TOOLCHAIN_FILE=cmake/iOS.toolchain.cmake -DIOS_PLATFORM=SIMULATOR
Then open and buildbuild-ios/jngl.xcodeproj
in Xcode.
cmake -Bbuild-uwp -DCMAKE_SYSTEM_NAME=WindowsStore"-DCMAKE_SYSTEM_VERSION=10.0"
Then openbuild-uwp/jngl.sln
in Visual Studio.
Here's a simple "Hello, World!" example in JNGL:
#include<jngl.hpp>#include<jngl/init.hpp>classMyGame :publicjngl::Scene {voidstep()override {// game logic }voiddraw()constoverride { text.draw(jngl::modelview().translate({ -100,0 })); } jngl::Font font{"Arial.ttf",12 }; jngl::TextLine text{ font,"Hello World!" };};jngl::AppParametersjnglInit() { jngl::AppParameters params; params.start = []() {return std::make_shared<MyGame>(); };return params;}
For a more complete starting point (i.e. project structure, etc.) check out theJNGL project template.
About
Easy to use cross-platform 2D game library for C++
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors8
Uh oh!
There was an error while loading.Please reload this page.