lib/gamnit: intro gamnit depth
[nit.git] / lib / gamnit / depth / README.md
1 gamnit depth, a framework to create portable 3D games in Nit.
2
3 This framework is based on a list of `Actor`, in `app::actors`, which are drawn to the screen at each frame. Each actor is composed of a model and other information specific to this instance: position in the world, rotation and scaling. Each `Model` is either a composite of models or it is composed of a `Mesh` defining its geometry and a `Material` defining how to draw the model. `Material` can be subclassed to use custom shaders.
4
5 # Assets
6
7 gamnit depth is built upon to portability framework _app.nit_ which provides a simple system to package and use asset files. Every file in the `assets/` folder at the root of a projet is packaged with the program at compilation for mobiles devices. These files can be loaded during execution using the many subclasses of `Asset`.
8
9 ~~~
10 var my_texture = new Texture("textures/texture.png")
11 var my_sound = new Sound("sounds/my_sound.mp3")
12 var my_model = new Model("models/my_model.obj")
13 var my_text = new TextAsset("simple_text_file.txt")
14 ~~~
15
16 # In relation to gamnit _flat_
17
18 gamnit flat is a framework for 2D games based on simple sprites and two drawing contexts: UI and world.
19
20 The UI context works well with _depth_. It should be used to display simple 2D UI elements and to create menus with ease.
21
22 However, the world context is difficultly compatible with _depth_. Only the `world_camera` from the _flat_ framework is used to display the world objects in the _depth_ framework as well.
23
24 # Examples
25
26 Take a look at the `model_viewer` project for a basic usage of the _depth_ framework combined with the _flat_ framework for the UI. Becaus of its simple goal, this projet has no game logic and only manipulates graphical objects. This projet is located in the `contrib` folder of the Nit repository.