curl: update test for latest changes
[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 repository on GNU/Linux you need to install the dev version of a few libraries and some tools.
9 On Debian 8.2, this command should install everything needed:
10
11 ~~~
12 apt-get install libgles2-mesa-dev libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev inkscape
13 ~~~
14
15 On Windows 64 bits, using msys2, you can install the required packages with:
16
17 ~~~
18 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
19 ~~~
20
21 While macOS isn't supported, it can create iOS apps.
22 You need to install and setup Xcode, and you may install the GLSL shader validation tool via `brew`:
23
24 ~~~
25 brew install glslang
26 ~~~
27
28 # Services by submodules
29
30 _gamnit_ is modular, different services of the framework are available through different submodules:
31
32 * The main entrypoint `gamnit` provides low-level abstractions over some services of OpenGL ES 2.0, like textures, shaders and programs.
33   It defines the basic methods to implement in order to obtain a working game:
34   `App::frame_core` to update the screen and `App::accept_event` to receive user inputs.
35
36 * `flat` provides an easy to use API for 2D games based on sprites.
37   Clients of this API redefine `App::update` to update the game logic and fill lists of sprites with objects to draw.
38
39   `App::sprites` lists the sprites of the game world, they are drawn form the point of view of the `world_camera`.
40   This camera can be moved around in the world by updating the x and y of its `position`,
41   and the zoom can easily be set using `reset_depth(desired_world_units_on_y)` or the `z` of its `position`
42
43   `App::ui_sprites` lists the UI sprites drawn from the point of view of `ui_camera`.
44   By default, this camera is pixel-perfect with the origin in the top left corner of the window.
45   However to support screens with different DPI, it is recommended to standardize
46   the display size using `reset_depth(height_of_reference_display)`.
47
48 * `depth` defines an API for 3D games based on instances of `Actor`.
49
50   This framework is build upon `flat`, see the doc of this submodule first (just above).
51   As such, clients should still implement `update` with the game logic, and fill `ui_sprites` for UI elements.
52
53   At each frame, elements in the list `actors` are drawn to screen.
54   Each `Actor` is composed of a `Model` and other information specific to this instance:
55   position in the world, rotation and scaling.
56
57 * `limit_fps` refines existing services of _gamnit_ to limit the framerate to a customizable value.
58
59 * `keys` provides `app.pressed_keys` keeping track of the currently pressed keys.
60
61 * `model_parsers` provides services to read and parse models from the asset folder.
62
63 * `network` provides a simple communication framework for multiplayer client/server games.