lib/gamnit: improve the gamnit README and fix the typo in its name
[nit.git] / lib / gamnit / README.md
1 Portable game and multimedia framework for Nit
2
3 _gamnit_ is a modular framework to create portable 2D or 3D apps in Nit.
4 It is based on the portability framework _app.nit_ and the OpenGL ES 2.0 standard.
5
6 # System configuration
7
8 To compile the _gamnit_ apps packaged with the Nit repositoy on GNU/Linux you need to install the dev version of a few libraries and some tools.
9 Under Debian 8.2, this command should install everything needed:
10
11 ~~~
12 apt-get install libgles2-mesa-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev inkscape mpg123
13 ~~~
14
15 # Services by submodules
16
17 _gamnit_ is modular, different services of the framework are available through different submodules:
18
19 * The main entrypoint `gamnit` provides low-level abstractions over some services of OpenGL ES 2.0, like textures, shaders and programs.
20   It defines the basic methods to implement in order to obtain a working game:
21   `App::frame_core` to update the screen and `App::accept_event` to receive user inputs.
22
23 * `flat` provides an easy to use API for 2D games based on sprites.
24   Clients of this API redefine `App::update` to update the game logic and fill lists of sprites with objects to draw.
25
26   `App::sprites` lists the sprites of the game world, they are drawn form the point of view of the `world_camera`.
27   This camera can be moved around in the world by updating the x and y of its `position`,
28   and the zoom can easily be set using `reset_depth(desired_world_units_on_y)` or the `z` of its `position`
29
30   `App::ui_sprites` lists the UI sprites drawn from the point of view of `ui_camera`.
31   By default, this camera is pixel-perfect with the origin in the top left corner of the window.
32   However to support screens with different DPI, it is recommended to standardize
33   the display size using `reset_depth(height_of_reference_display)`.
34
35 * `depth` defines an API for 3D games based on instances of `Actor`.
36
37   This framework is build upon `flat`, see the doc of this submodule first (just above).
38   As such, clients should still implement `update` with the game logic, and fill `ui_sprites` for UI elements.
39
40   At each frame, elements in the list `actors` are drawn to screen.
41   Each `Actor` is composed of a `Model` and other information specific to this instance:
42   position in the world, rotation and scaling.
43
44 * `limit_fps` refines existing services of _gamnit_ to limit the framerate to a customizable value.
45
46 * `keys` provides `app.pressed_keys` keeping track of the currently pressed keys.
47
48 * `model_parsers` provides services to read and parse models from the asset folder.
49
50 * `network` provides a simple communication framework for multiplayer client/server games.