This variation can show more models specified on the command line.
- ~~~
+ ~~~raw
bin/model_viewer [path_to_model ...]
~~~
* Compile and run on the desktop (GNU/Linux and OS X) with:
- ~~~
+ ~~~raw
make
bin/calculator
~~~
* Compile for Android and install on a device or emulator with:
- ~~~
+ ~~~raw
make bin/android.apk
adb install -r bin/calculator.apk
~~~
* Compile for iOS and run on the simulator with:
- ~~~
+ ~~~raw
make bin/android.app
ios-sim launch bin/calculator.app
~~~
## Usage Example
-~~~
+~~~nitish
module my_module is
app_name "My App"
app_namespace "org.example.my_app"
* The mixin option (`-m module`) imports an additional module before compiling.
It can be used to load platform specific implementations of the _app.nit_ portable UI.
- ~~~
+ ~~~raw
# GNU/Linux version, using GTK
nitc calculator.nit -m linux
Continuing with the calculator example, it is adapted for Android by the module `android_calculator.nit`.
This module imports both `calculator` and `android`, it can then use Android specific code.
- ~~~
+ ~~~nitish
module android_calculator
import calculator
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:
-~~~
+~~~raw
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:
-~~~
+~~~raw
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`:
-~~~
+~~~raw
brew install glslang
~~~
redef fun ==(o) do return o isa SELF and partner_a == o.partner_a and partner_b == o.partner_b
redef fun hash do return partner_a.hash + 1024*partner_b.hash
end
+class Person
+end
~~~
### Scope of the `serialize` annotation
* A module declaration annotated with `serialize` states that all its class definitions
and locally declared attributes are serializable.
- ~~~
+ ~~~nitish
module shared_between_clients is serialize
~~~
two serialization services: `User::core_serialize_to` and
`Deserializer::deserialize_class`.
-~~~
+~~~nitish
module user_credentials
# User credentials for a website
The main implementations of these services are `JsonSerializer` and `JsonDeserializer`,
from the `json_serialization` module.
-~~~
+~~~nitish
import json
import user_credentials