Portable game and multimedia framework for Nit

gamnit is a modular framework to create portable 2D or 3D apps in Nit. It is based on the portability framework app.nit and the OpenGL ES 2.0 standard.

System configuration

To compile the gamnit apps packaged with the Nit repository on GNU/Linux you need to install the dev version of a few libraries and some tools. On Debian 8.2, this command should install everything needed:

apt-get install libgles2-mesa-dev libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev inkscape

On Windows 64 bits, using msys2, you can install the required packages with:

pacman -S mingw-w64-x86_64-angleproject-git mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_image mingw-w64-x86_64-SDL2_mixer

While macOS isn't supported, it can create iOS apps. You need to install and setup Xcode, and you may install the GLSL shader validation tool via brew:

brew install glslang

Services by submodules

gamnit is modular, different services of the framework are available through different submodules:

  • The main entrypoint gamnit provides low-level abstractions over some services of OpenGL ES 2.0, like textures, shaders and programs. It defines the basic methods to implement in order to obtain a working game: App::frame_core to update the screen and App::accept_event to receive user inputs.

  • flat provides an easy to use API for 2D games based on sprites. Clients of this API redefine App::update to update the game logic and fill lists of sprites with objects to draw.

    App::sprites lists the sprites of the game world, they are drawn form the point of view of the world_camera. This camera can be moved around in the world by updating the x and y of its position, and the zoom can easily be set using reset_depth(desired_world_units_on_y) or the z of its position

    App::ui_sprites lists the UI sprites drawn from the point of view of ui_camera. By default, this camera is pixel-perfect with the origin in the top left corner of the window. However to support screens with different DPI, it is recommended to standardize the display size using reset_depth(height_of_reference_display).

  • depth defines an API for 3D games based on instances of Actor.

    This framework is build upon flat, see the doc of this submodule first (just above). As such, clients should still implement update with the game logic, and fill ui_sprites for UI elements.

    At each frame, elements in the list actors are drawn to screen. Each Actor is composed of a Model and other information specific to this instance: position in the world, rotation and scaling.

  • limit_fps refines existing services of gamnit to limit the framerate to a customizable value.

  • keys provides app.pressed_keys keeping track of the currently pressed keys.

  • model_parsers provides services to read and parse models from the asset folder.

  • network provides a simple communication framework for multiplayer client/server games.

All subgroups and modules

module android19

gamnit :: android19

Variation using features from Android API 19
module bmfont

gamnit :: bmfont

Parse Angel Code BMFont format and draw text
module camera_control

gamnit :: camera_control

Simple camera control for user, as the method accept_scroll_and_zoom
module camera_control_android

gamnit :: camera_control_android

Two fingers camera manipulation, pinch to zoom and slide to scroll
module camera_control_linux

gamnit :: camera_control_linux

Mouse wheel and middle mouse button to control camera
module cameras

gamnit :: cameras

Camera services producing Model-View-Projection matrices
module cameras_cache

gamnit :: cameras_cache

Cache the Matrix produced by Camera::mvp_matrix
group depth

gamnit > depth

gamnit depth, a framework to create portable 3D games in Nit.
module display

gamnit :: display

Abstract display services
module display_android

gamnit :: display_android

Gamnit display implementation for Android
module display_ios

gamnit :: display_ios

Gamnit display implementation for iOS
module display_linux

gamnit :: display_linux

Gamnit display implementation for GNU/Linux using egl, sdl and x11
module dynamic_resolution

gamnit :: dynamic_resolution

Virtual screen with a resolution independent from the real screen
module egl

gamnit :: egl

Use of EGL to implement Gamnit on GNU/Linux and Android
group flat

gamnit > flat

Simple API for 2D games, built around Sprite and App::update
module font

gamnit :: font

Abstract font drawing services, implemented by bmfont and tileset
module gamnit

gamnit :: gamnit

Game and multimedia framework for Nit
module gamnit_android

gamnit :: gamnit_android

Support services for Gamnit on Android
module gamnit_ios

gamnit :: gamnit_ios

Support services for gamnit on iOS
module gamnit_linux

gamnit :: gamnit_linux

Support services for Gamnit on GNU/Linux
module input_ios

gamnit :: input_ios

Gamnit event support for iOS
module keys

gamnit :: keys

Simple service keeping track of which keys are currently pressed
module landscape

gamnit :: landscape

Lock the application in the landscape orientation
module limit_fps

gamnit :: limit_fps

Frame-rate control for applications
group network

gamnit > network

Easy client/server logic for games and simple distributed applications
module portrait

gamnit :: portrait

Lock the application in the portrait orientation
module programs

gamnit :: programs

Services for graphical programs with shaders, attributes and uniforms
module texture_atlas_parser

gamnit :: texture_atlas_parser

Tool to parse XML texture atlas and generated Nit code to access subtextures
module textures

gamnit :: textures

Load textures, create subtextures and manage their life-cycle
module tileset

gamnit :: tileset

Support for TileSet, TileSetFont and drawing text with TextSprites
group virtual_gamepad

gamnit > virtual_gamepad

Virtual gamepad mapped to keyboard keys for quick and dirty mobile support
package_diagram gamnit\> gamnit ...gamnit\> ... ...gamnit\>->gamnit\> android android android->gamnit\> gamnit\>flat\> flat gamnit\>flat\>->gamnit\> gamnit\>virtual_gamepad\> virtual_gamepad gamnit\>virtual_gamepad\>->gamnit\> gamnit\>virtual_gamepad\>->gamnit\>flat\> app app app->android egl egl egl->android gamnit gamnit gamnit->android gamnit->gamnit\>flat\> glesv2 glesv2 glesv2->android app... ... app...->app egl... ... egl...->egl gamnit... ... gamnit...->gamnit glesv2... ... glesv2...->glesv2 gamnit\>depth\> depth gamnit\>depth\>->gamnit\>flat\> gamnit\>depth\>... ... gamnit\>depth\>...->gamnit\>depth\> gamnit\>virtual_gamepad\>... ... gamnit\>virtual_gamepad\>...->gamnit\>virtual_gamepad\>

Ancestors

group bundle

android > bundle

A mapping class of String to various value types used by the
group c

c

Structures and services for compatibility with the C language
group cocoa

cocoa

Cocoa API, the development layer of OS X
group codecs

core > codecs

Group module for all codec-related manipulations
group collection

core > collection

This module define several collection classes.
group curl

curl

Data transfer powered by the native curl library
group gtk

gtk

GTK+ widgets and services
group java

java

Supporting services for the FFI with Java and to access Java libraries
group json

json

read and write JSON formatted text
group jvm

jvm

Java Virtual Machine invocation API and others services from the JNI C API
group meta

meta

Simple user-defined meta-level to manipulate types of instances as object.
group parser_base

parser_base

Simple base for hand-made parsers of all kinds
group pipeline

pipeline

Pipelined filters and operations on iterators.
group poset

poset

Pre order sets and partial order set (ie hierarchies)
group pthreads

pthreads

POSIX Threads support
group serialization

serialization

Abstract serialization services
group shared_preferences

android > shared_preferences

Services allowing to save and load datas to internal android device
group sqlite3

sqlite3

Services to manipulate a Sqlite3 database
group template

template

Basic template system
group text

core > text

All the classes and methods related to the manipulation of text entities
group ui

android > ui

Views and services to use the Android native user interface
group v3_4

gtk > v3_4

group xdg_basedir

xdg_basedir

Services for using the XDG Base Directory specification

Parents

group android

android

Android platform support and APIs
group app

app

app.nit, a framework for portable applications
group core

core

Nit common library of core classes and methods
group dom

dom

Easy XML DOM parser
group egl

egl

Interface between rendering APIs (OpenGL, OpenGL ES, etc.) and the native windowing system.
group flat

gamnit > flat

Simple API for 2D games, built around Sprite and App::update
group gen_nit

gen_nit

Support to generate and otherwise manipulate Nit code
group geometry

geometry

Basic geometry data structures and services.
group glesv2

glesv2

OpenGL graphics rendering library for embedded systems, version 2.0
group ios

ios

iOS support for app.nit
group linux

linux

Implementation of app.nit for the Linux platform
group matrix

matrix

Services for matrices of Float values
group mnit

mnit

group more_collections

more_collections

Highly specific, but useful, collections-related classes.
group opts

opts

Management of options on the command line
group performance_analysis

performance_analysis

Services to gather information on the performance of events by categories
group realtime

realtime

Services to keep time of the wall clock time
group sdl2

sdl2

This is a low-level wrapper of the SDL 2.0 library (as sdl2) and SDL_image 2.0 (as sdl2::image).

Children

group android

android

Android platform support and APIs
group flat

gamnit > flat

Simple API for 2D games, built around Sprite and App::update
group virtual_gamepad

gamnit > virtual_gamepad

Virtual gamepad mapped to keyboard keys for quick and dirty mobile support

Descendants

group bundle

android > bundle

A mapping class of String to various value types used by the
group depth

gamnit > depth

gamnit depth, a framework to create portable 3D games in Nit.
group egl

egl

Interface between rendering APIs (OpenGL, OpenGL ES, etc.) and the native windowing system.
group examples

app > examples

group glesv2

glesv2

OpenGL graphics rendering library for embedded systems, version 2.0
group intent

android > intent

Services allowing to launch activities and start/stop services using
group notification

android > notification

Services to show notification in the Android status bar
group service

android > service

Android service support for app.nit centered around the class Service
group shared_preferences

android > shared_preferences

Services allowing to save and load datas to internal android device
group src

android > examples > src

group ui

android > ui

Views and services to use the Android native user interface