nit.git
6 years agoa_star: don't crash on deserialization errors and limit static types
Alexis Laferrière [Sat, 22 Jul 2017 01:08:10 +0000 (21:08 -0400)]
a_star: don't crash on deserialization errors and limit static types

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoserialization: implement serialization for classes of `core::queue`
Alexis Laferrière [Sat, 22 Jul 2017 01:19:04 +0000 (21:19 -0400)]
serialization: implement serialization for classes of `core::queue`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agotests: add formal types to serialization tests
Alexis Laferrière [Sat, 22 Jul 2017 12:39:57 +0000 (08:39 -0400)]
tests: add formal types to serialization tests

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agofrontend: don't deserialization code with warnings
Alexis Laferrière [Sat, 22 Jul 2017 02:22:06 +0000 (22:22 -0400)]
frontend: don't deserialization code with warnings

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agofrontend: don't mention JSON in general deserialization error
Alexis Laferrière [Sat, 22 Jul 2017 12:57:00 +0000 (08:57 -0400)]
frontend: don't mention JSON in general deserialization error

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agofrontend: safer deserialization of parameter and virtual types
Alexis Laferrière [Sat, 22 Jul 2017 01:26:15 +0000 (21:26 -0400)]
frontend: safer deserialization of parameter and virtual types

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agojson: standardize error messages
Alexis Laferrière [Sat, 22 Jul 2017 20:07:43 +0000 (16:07 -0400)]
json: standardize error messages

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agojson: deserialize Maps keys first, in the same order as they are written
Alexis Laferrière [Mon, 24 Jul 2017 14:35:27 +0000 (10:35 -0400)]
json: deserialize Maps keys first, in the same order as they are written

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agojson: use GetName to restrict deserialized formal types
Alexis Laferrière [Sat, 22 Jul 2017 01:18:20 +0000 (21:18 -0400)]
json: use GetName to restrict deserialized formal types

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoserialization: intro `AttributeMissingError`
Alexis Laferrière [Mon, 24 Jul 2017 14:07:56 +0000 (10:07 -0400)]
serialization: intro `AttributeMissingError`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoserialization: update some doc
Alexis Laferrière [Sat, 22 Jul 2017 12:47:49 +0000 (08:47 -0400)]
serialization: update some doc

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agonitserial: intrude import modules when needed
Alexis Laferrière [Sat, 22 Jul 2017 01:23:07 +0000 (21:23 -0400)]
nitserial: intrude import modules when needed

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogen_nit: accept complete import declarations
Alexis Laferrière [Sat, 22 Jul 2017 01:21:58 +0000 (21:21 -0400)]
gen_nit: accept complete import declarations

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: typing: new warning `useless-truism` to catch trainees.
Jean Privat [Tue, 18 Jul 2017 12:38:12 +0000 (08:38 -0400)]
Merge: typing: new warning `useless-truism` to catch trainees.

Warning on `if a == true then` constructions.

Pull-Request: #2520
Reviewed-by: Jean-Christophe Beaupré <jcbrinfo.public@gmail.com>

6 years agoMerge: gamnit: scale text, add custom characters and create links with `BMFont`
Jean Privat [Tue, 18 Jul 2017 12:38:09 +0000 (08:38 -0400)]
Merge: gamnit: scale text, add custom characters and create links with `BMFont`

This PR adds more customization options when drawing text using `BMFont`:

* Change the size of the text with a simple attribute `TextSprites::scale`.
* Insert artificial chars to a `BMFont` using the more permissive `BMFontChar`. This way, one can set custom textures for a letter, an emojis or any character from the private use areas.
* Add "links" to the text using Markdown-like syntax (`[my link]` or `[pretty name](internal name)`). Note that the links are not clickable by themselves. However, the client code can access the sprites representing the link to change their style or to get their position. This will work well with a rumored future feature making sprites clickable...

Notice the colored links and the smaller text box in the following screenshot of `fonts_showcase`:
![screenshot from 2017-07-13 22-09-20](https://user-images.githubusercontent.com/208057/28196740-8f8630b6-6820-11e7-8915-1df02b4edee5.png)

---

Once again, these new features are not implemented for `TileSetFont`. I'm considering keeping the API of `TileSetFont` but replacing its implementation by a `BMFont` for it to gets all the new shiny features.

Pull-Request: #2527
Reviewed-by: Jean Privat <jean@pryen.org>

6 years agogamnit: add new features to the fonts_showcase example
Alexis Laferrière [Fri, 14 Jul 2017 03:03:07 +0000 (23:03 -0400)]
gamnit: add new features to the fonts_showcase example

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: add markdown-like links to `TextSprites` with `BMFont`
Alexis Laferrière [Wed, 12 Jul 2017 13:15:32 +0000 (09:15 -0400)]
gamnit: add markdown-like links to `TextSprites` with `BMFont`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agolib&contrib: remove some useless truisms.
Jean Privat [Wed, 28 Jun 2017 19:14:31 +0000 (15:14 -0400)]
lib&contrib: remove some useless truisms.

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agoMerge: model: group parameter types in `MSignature::to_s`
Jean Privat [Mon, 17 Jul 2017 13:53:32 +0000 (09:53 -0400)]
Merge: model: group parameter types in `MSignature::to_s`

Modify `MSignature::to_s` to make its output a shorter valid Nit signature. This helps readability and shortens error messages allowing them to fit more easily on a single line or within a text editor.

Example program:
~~~nit
import geometry
var b = new Box3d[Float] # <- error
~~~

Previous error message:
~~~
Error: expected 6 argument(s) for `init(left: Float, right: Float, top: Float, bottom: Float, front: Float, back: Float)`; got 0. See introduction at `core::Object::init`.
~~~

New error message:
~~~
Error: expected 6 argument(s) for `init(left, right, top, bottom, front, back: Float)`; got 0. See introduction at `core::Object::init`.
~~~

Pull-Request: #2529

6 years agoMerge: quadtree: use an array, fix warnings and standardize the doc
Jean Privat [Mon, 17 Jul 2017 13:53:31 +0000 (09:53 -0400)]
Merge: quadtree: use an array, fix warnings and standardize the doc

Replace the 4 attributes by an array of all the children. This new structure lightens the code and allows to fix 65 `method call on a nullable receiver` warnings. As this is already a significant refactor, I avoided modifying further the implementations to avoid breaking things.

Pull-Request: #2528

6 years agoMerge: gamnit: control drawing order
Jean Privat [Mon, 17 Jul 2017 13:53:30 +0000 (09:53 -0400)]
Merge: gamnit: control drawing order

When two sprites are overlapped, a non-opaque pixel drawn before the sprite behind it may be blended with the wrong color. The only solution is to control the draw order to ensure that sprites in the back are drawn first. However, this is hard to automate when grouping sprites in buffers to optimize the drawing of a very large number of sprites (as gamnit does). It requires to break off groups in layers and this may be very costly if the sprites move on the Z axis.

The solution it to let the programmer choose a draw order only when needed. This works pretty well in 2D games where some objects stay on the same relative depth layer.

> Example artifacts on the left, and the fixed result (with a `sprite.draw_order = 1`) on the right:
>
> ![bug1](https://user-images.githubusercontent.com/208057/28196073-3e0ec6fc-681c-11e7-98d0-019e25a7f9c3.png) ![fixed1](https://user-images.githubusercontent.com/208057/28196072-3dfe075e-681c-11e7-9f4d-8d08a45b9661.png)

This PR introduces the attribute `Sprite::draw_order` that can be set to a higher value (default at 0) for the sprite to be drawn later. In general, sprites with a non-opaque `texture` and sprites closer to the camera should have a higher value to be drawn last.

Sprites sharing a `draw_order` are drawn in the same pass. The sprite to sprite draw order is undefined and may change when adding and removing sprites, or changing their attributes. A future improvement could sort sprites in the same group automatically if it becomes an issue.

Note that changing the `draw_order` may have a negative performance impact if there are many different `draw_order` values across many sprites. This may break the grouping optimization by creating too many small groups.

---

I plan on adding the draw order to `gamnit::depth` actors too. This will be useful for games than mix 2D with 3D. However, I would have to apply a different strategy for pure 3D games, implementing two main passes, one for opaque objects and one for non-opaque objects.

Pull-Request: #2526
Reviewed-by: Jean Privat <jean@pryen.org>

6 years agoMerge: gtksourceview: Add the missing `kwnull` context
Jean Privat [Mon, 17 Jul 2017 13:53:28 +0000 (09:53 -0400)]
Merge: gtksourceview: Add the missing `kwnull` context

Renderings for `test_syntax.nit`:
* [Classic](https://github.com/nitlang/nit/files/1148477/gtksourceview-classic.pdf)
* [Kate](https://github.com/nitlang/nit/files/1148476/gtksourceview-kate.pdf)
* [Solarized Clear](https://github.com/nitlang/nit/files/1148474/gtksourceview-solarized-clear.pdf)
* [Tango](https://github.com/nitlang/nit/files/1148475/gtksourceview-tango.pdf)

For comparison, see #2515.

![WHOOPS!!](https://user-images.githubusercontent.com/6044484/28213673-23e5b296-6875-11e7-8a2b-494652afe064.png "WHOOPS!!")

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

Pull-Request: #2525

6 years agoMerge: vim plugin: list introduction and redefinition locations to goto files
Jean Privat [Mon, 17 Jul 2017 13:53:27 +0000 (09:53 -0400)]
Merge: vim plugin: list introduction and redefinition locations to goto files

This PR improves the functions `:Nitdoc` and `:NitGitGrep` for easier navigation in large Nit projects.

### :Nitdoc

When calling `:Nitdoc write_and_make`, or simply `:Nitdoc` with the cursor above the word `write_and_make`, or even using the recommended shortcut Ctrl-D, the preview window now lists the relevant files after the doc of the two different methods accessible from `nitc`:

~~~markdown
# nitc::abstract_compiler$ModelBuilder$write_and_make(compiler: AbstractCompiler)

Simple indirection to `Toolchain::write_and_make`

## Location of introduction and refinements
* src/compiler/abstract_compiler.nit:112,2--119,4
* src/compiler/compiler_serialization.nit:22,2--38,4

# nitc$Toolchain$write_and_make

Write all C files and compile them

## Location of introduction and refinements
* src/compiler/abstract_compiler.nit:154,2--155,31 (1 more)
~~~

The path format is supported by Vim, so you can move the cursor above a path and hit `gF` (goto file) to open the file at the first line. There are alternatives to `gF`, I personally mapped `Ctrl-W gF` to `Ctrl-A` to open the file in a new tab.

### :NitGitGrep

Calling `:NitGitGrep` (or using the recommended Ctrl-G) search for the word under the cursor in Nit files in the local Git repo. This PR changes a few settings are in order to:

* Print line number after the file path, so you can use `gF` here too.
* Show the introduction(s) before the redefs.
* Search for the complete word under the cursor.
* Search only in Nit source files.
* Avoid duplicating results.

When called above `write_and_make` the preview window lists the intros first, then the redefs and then the other references after a blank line:
~~~
src/compiler/abstract_compiler.nit:113: protected fun write_and_make(compiler: AbstractCompiler)
src/compiler/abstract_compiler.nit:155: fun write_and_make is abstract
src/compiler/java_compiler.nit:64: fun write_and_make(compiler: JavaCompiler) do
src/compiler/abstract_compiler.nit:162: redef fun write_and_make
src/compiler/compiler_serialization.nit:22: redef fun write_and_make(compiler)

src/compiler/abstract_compiler.nit:112: # Simple indirection to `Toolchain::write_and_make`
src/compiler/abstract_compiler.nit:118: toolchain.write_and_make
src/compiler/abstract_compiler.nit:578: # Set by `modelbuilder.write_and_make` and permit sub-routines to access the current toolchain if required.
src/compiler/global_compiler.nit:67: write_and_make(compiler)
src/compiler/java_compiler.nit:60: write_and_make(compiler)
src/compiler/separate_compiler.nit:126: write_and_make(compiler)
src/compiler/separate_erasure_compiler.nit:77: write_and_make(compiler)
~~~

Note that searching only for the word itselt, the result doesn't distinguish between the 3 versions of `write_and_make`, including one not imported by `nitc`.

Pull-Request: #2524

6 years agogamnit: make `BMFontChar` more permissive to accept artificial fonts
Alexis Laferrière [Wed, 12 Jul 2017 02:28:13 +0000 (22:28 -0400)]
gamnit: make `BMFontChar` more permissive to accept artificial fonts

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agomodel: group types in `MSignature::to_s`
Alexis Laferrière [Fri, 14 Jul 2017 00:48:36 +0000 (20:48 -0400)]
model: group types in `MSignature::to_s`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogtksourceview: Add the missing `kwnull` context
Jean-Christophe Beaupré [Fri, 14 Jul 2017 13:07:01 +0000 (09:07 -0400)]
gtksourceview: Add the missing `kwnull` context

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

6 years agonitpick & vim: list concerned files in doc
Alexis Laferrière [Sat, 8 Jul 2017 15:53:32 +0000 (11:53 -0400)]
nitpick & vim: list concerned files in doc

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agovim: improve NitGitGrep
Alexis Laferrière [Sun, 2 Jul 2017 01:50:50 +0000 (21:50 -0400)]
vim: improve NitGitGrep

* Print line number after the file path, so you can use `gF` here too.
* Show the introduction(s) before the redefs.
* Search for the complete word under the cursor.
* Search only in Nit source files.
* Avoid duplicating results.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogeometry: fix warnings in quadtree structures and standardize the doc
Alexis Laferrière [Thu, 18 May 2017 19:52:59 +0000 (12:52 -0700)]
geometry: fix warnings in quadtree structures and standardize the doc

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: intro `TextSprite::scale`
Alexis Laferrière [Wed, 12 Jul 2017 00:42:07 +0000 (20:42 -0400)]
gamnit: intro `TextSprite::scale`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: intro `Sprite::draw_order`
Alexis Laferrière [Fri, 7 Jul 2017 20:47:16 +0000 (16:47 -0400)]
gamnit: intro `Sprite::draw_order`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agomore_collections: intro HashMap4
Alexis Laferrière [Fri, 7 Jul 2017 20:22:35 +0000 (16:22 -0400)]
more_collections: intro HashMap4

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: frontend: run code generation phases only in engines (and nitmetrics)
Jean Privat [Tue, 11 Jul 2017 13:01:32 +0000 (09:01 -0400)]
Merge: frontend: run code generation phases only in engines (and nitmetrics)

Some frontend phases generate Nit code (usually method implementations) that is ignored by some tools, including `nitpick`, `nitserial` and `nitrestful`. When running `nitpick` on WBTW, a serialization heavy project, the code generation part of `serialization_phase` uselessly took ~10% of the work time. This extra time adds up quickly as `nitpick` is invoked each time we save a file in vim.

This PR extracts some code generation phases from the main frontend. Compilers and interpreters must import the code generation phases (`frontend::code_gen`) but most others only need the main frontend (`frontend`). Analysis tools may import the code generation phases ito analyze the generated code, or import only the main frontend phases to analyze only the user code.

In this PR, only two phases have been moved: half of `serialization_phase` which was the most costly in my use case, and `actors_generation_phase` because it was already nicely decoupled (well done @BlackMinou!). Others phases could be divided and moved to the code generation frontend if they happen to be a performance bottleneck: `i18n_phase`, `parallelization_phase` and maybe `deriving`.

Note that there is no implementation change to the serialization phase, I simply split the module in two.

Pull-Request: #2523

6 years agoMerge: poset: add lookup services in Map to search using keys in hierarchies.
Jean Privat [Tue, 11 Jul 2017 12:59:58 +0000 (08:59 -0400)]
Merge: poset: add lookup services in Map to search using keys in hierarchies.

3 main methods:

* `Map::lookup_all_values` collect all values of the greaters of an element
* `Map::lookup_values` collect only the values of the most specific greaters of an element
* `MultiHashMap::lookup_joined_values` collect and join the values of the most specific greaters of an element

Since many models entities in nitc are in some poset, these services could be used
to add and retrieve metadata while automatically taking in account inheritance or importation.

Signed-off-by: Jean Privat <jean@pryen.org>

Pull-Request: #2500

6 years agoMerge: gmp: Introduce Long and Ratio
Jean Privat [Tue, 11 Jul 2017 12:59:05 +0000 (08:59 -0400)]
Merge: gmp: Introduce Long and Ratio

Signed-off-by: PatrickBlanchette <PatrickBlanchette@users.noreply.github.com>

Pull-Request: #2508
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>
Reviewed-by: Jean-Christophe Beaupré <jcbrinfo.public@gmail.com>

6 years agogmp: Introduce BigInt and Ratio
PatrickBlanchette [Tue, 20 Jun 2017 14:24:08 +0000 (10:24 -0400)]
gmp: Introduce BigInt and Ratio

Signed-off-by: PatrickBlanchette <PatrickBlanchette@users.noreply.github.com>

6 years agosrc: fix typos in test_test_phase.nit and nitmetrics.nit
Alexis Laferrière [Fri, 30 Jun 2017 18:25:43 +0000 (14:25 -0400)]
src: fix typos in test_test_phase.nit and nitmetrics.nit

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agofrontend: extract code generation modules from the strictly frontend
Alexis Laferrière [Fri, 30 Jun 2017 16:57:56 +0000 (12:57 -0400)]
frontend: extract code generation modules from the strictly frontend

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: gamnit: refactor the `flat` 2D API to include more services by default
Jean Privat [Fri, 30 Jun 2017 13:51:00 +0000 (09:51 -0400)]
Merge: gamnit: refactor the `flat` 2D API to include more services by default

The use of `import gamnit::flat` will now include more services useful to most games: `Sound`, `Font`, `pressed_keys`, etc. If a project doesn't want to include them for any reason, it can still `import gamnit::flat_core` and hand pick other services.

Pull-Request: #2522

6 years agogamnit: `flat` includes more optional modules
Alexis Laferrière [Thu, 29 Jun 2017 13:41:02 +0000 (09:41 -0400)]
gamnit: `flat` includes more optional modules

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: move `flat` to a group
Alexis Laferrière [Thu, 29 Jun 2017 13:30:43 +0000 (09:30 -0400)]
gamnit: move `flat` to a group

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: gtksourceview: Rewrite the language definition
Jean Privat [Wed, 28 Jun 2017 19:58:50 +0000 (15:58 -0400)]
Merge: gtksourceview: Rewrite the language definition

The new definition includes:
* A more accurate and up-to-date grammar
* A more accurate style list
* A list of built-in annotations
* Heuristics for embedded languages
* Spell-checking only enabled for comments
* Styles for operators and lower-case identifiers available if needed
  (but not highlighted by default)

## Previews
Here are the PDF outputs of various black-on-white style schemes for `examples/syntax.nit`:
* [Classic](https://github.com/nitlang/nit/files/1109793/gtksourceview-classic.pdf)
* [Kate](https://github.com/nitlang/nit/files/1109794/gtksourceview-kate.pdf)
* [Solarized Clear](https://github.com/nitlang/nit/files/1109795/gtksourceview-solarized-clear.pdf)
* [Tango](https://github.com/nitlang/nit/files/1109796/gtksourceview-tango.pdf)

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

Pull-Request: #2515
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: gamnit: fix integer overflow when there's more than 16,383 sprites
Jean Privat [Wed, 28 Jun 2017 19:39:25 +0000 (15:39 -0400)]
Merge: gamnit: fix integer overflow when there's more than 16,383 sprites

This PR fixes a problem when more than 16,383 sprites used the same texture, thus shared a buffer. This was caused by a `short int` overflow in the vertices indices passed to OpenGL ES. Now, large groups of sprites are simply broken up into smaller groups and buffers.

In the future, if there are too many such groups we could use a larger integer.

Pull-Request: #2519

6 years agoMerge: gamnit: premultiply alpha for a nicer alpha blending
Jean Privat [Wed, 28 Jun 2017 19:39:24 +0000 (15:39 -0400)]
Merge: gamnit: premultiply alpha for a nicer alpha blending

Premultiplying RBG pixels values by their alpha reduces visible artifacts when blending between different opacity levels. It also allows for mixing obstructing blending (like smoke hiding the background) and additive blending (like explosions amplifying each other, as in the second screenshot below).

Here are the old and new explosion effects in Jump 'n' Gun (using the same texture as Action Nitro):
![old](https://user-images.githubusercontent.com/208057/27644667-22a0f3d0-5bf2-11e7-884b-2e21555e5e68.png) ![new](https://user-images.githubusercontent.com/208057/27644776-619601c0-5bf2-11e7-84c4-f884533efaf0.png)

By default, textures are expected to be straight (the classic not-premultiplied) and are premultiplied at loading. It can be deactivated for asset files that are already premultiplied (as with the explosion texture above).

The color services in both APIs are also affected. `Sprite::tint` remains the same, using straight colors, the easier alternative. However, `SmoothMaterial::ambient_color`, `diffuse_color` and `specular_color` should be premultiplied, giving more possibility to the clients. Alternatively, `Actor::alpha` is applied to material colors, so while RGB values of `ambient_color` are not premultiplied by `ambient_color[3]` they are premultiplied by `Actor::alpha`.

On Android, pixel values are automatically premultiplied when loaded from a file by the system, so we unpremultiply them as needed (with a strong possibility of data loss on additive blending effects). To fix this, this PR intro a new module `gamnit::android19` using services from the API 19 to disable the premultiply. This module is optional (for now) but it should be imported by all Android games with premultiplied texture asset files.

As a bonus, fix the support for Action Nitro on Android via F-Droid. The latest performance improvements to gamnit makes the game run nicely on mobiles devices!

Pull-Request: #2518

6 years agoMerge: some Docker update
Jean Privat [Wed, 28 Jun 2017 19:39:15 +0000 (15:39 -0400)]
Merge: some Docker update

* stretch (thus java8)
* new libs
* better usable android
* better usable java
* opengl validator

Pull-Request: #2517
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: neo4j: fix cypher syntax for `Neo4jClient::nodes_with_labels`
Jean Privat [Wed, 28 Jun 2017 19:39:15 +0000 (15:39 -0400)]
Merge: neo4j: fix cypher syntax for `Neo4jClient::nodes_with_labels`

newer versions of neo4j seem more picky

Pull-Request: #2516

6 years agonitc: remove some useless truisms.
Jean Privat [Wed, 28 Jun 2017 19:14:18 +0000 (15:14 -0400)]
nitc: remove some useless truisms.

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agotyping: new warning `useless-truism` to catch trainees.
Jean Privat [Wed, 28 Jun 2017 18:55:15 +0000 (14:55 -0400)]
typing: new warning `useless-truism` to catch trainees.

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agogtksourceview: Rewrite the language definition
Jean-Christophe Beaupré [Mon, 26 Jun 2017 18:42:21 +0000 (14:42 -0400)]
gtksourceview: Rewrite the language definition

The new definition includes:
* A more accurate and up-to-date grammar
* A more accurate style list
* A list of built-in annotations
* Heuristics for embedded languages
* Spell-checking only enabled for comments
* Styles for operators and lower-case identifiers available if needed
  (but not highlighted by default)

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

6 years agoexamples: Add a test case for syntax highlighters
Jean-Christophe Beaupré [Wed, 28 Jun 2017 18:20:56 +0000 (14:20 -0400)]
examples: Add a test case for syntax highlighters

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

6 years agogamnit: don't overflow `short int` used as vertices index
Alexis Laferrière [Mon, 26 Jun 2017 16:23:29 +0000 (12:23 -0400)]
gamnit: don't overflow `short int` used as vertices index

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoaction_nitro: remove dead code
Alexis Laferrière [Mon, 26 Jun 2017 18:10:30 +0000 (14:10 -0400)]
action_nitro: remove dead code

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoaction_nitro: clean Makefile and fix fdroid support
Alexis Laferrière [Wed, 28 Jun 2017 15:02:29 +0000 (11:02 -0400)]
action_nitro: clean Makefile and fix fdroid support

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoaction_nitro: support premultiplied textures on Android
Alexis Laferrière [Wed, 28 Jun 2017 14:54:33 +0000 (10:54 -0400)]
action_nitro: support premultiplied textures on Android

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoaction_nitro: prettier particles
Alexis Laferrière [Mon, 26 Jun 2017 18:09:53 +0000 (14:09 -0400)]
action_nitro: prettier particles

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agomodel_viewer: use premultiplied colors on clouds and atmospheric layers
Alexis Laferrière [Wed, 28 Jun 2017 16:02:50 +0000 (12:02 -0400)]
model_viewer: use premultiplied colors on clouds and atmospheric layers

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: use API 19 services to fix premultiplied texture on Android
Alexis Laferrière [Wed, 28 Jun 2017 14:30:19 +0000 (10:30 -0400)]
gamnit: use API 19 services to fix premultiplied texture on Android

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: leave it up to the clients to set premultiplied colors in Materials
Alexis Laferrière [Wed, 28 Jun 2017 16:55:30 +0000 (12:55 -0400)]
gamnit: leave it up to the clients to set premultiplied colors in Materials

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: use premultiplied alpha
Alexis Laferrière [Mon, 26 Jun 2017 15:44:53 +0000 (11:44 -0400)]
gamnit: use premultiplied alpha

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agodocker-full: java: setup needed environment variables
Jean Privat [Wed, 28 Jun 2017 15:40:38 +0000 (11:40 -0400)]
docker-full: java: setup needed environment variables

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agodocker-full: install OpenGL validator
Jean Privat [Wed, 28 Jun 2017 15:38:34 +0000 (11:38 -0400)]
docker-full: install OpenGL validator

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agodocker-full: install the android platforms needed by current packages
Jean Privat [Wed, 28 Jun 2017 15:38:08 +0000 (11:38 -0400)]
docker-full: install the android platforms needed by current packages

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agodocker-full: android make tool executable by all users
Jean Privat [Wed, 28 Jun 2017 15:36:36 +0000 (11:36 -0400)]
docker-full: android make tool executable by all users

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agodocker-full: install libgmp-dev & libreadline-dev
Jean Privat [Wed, 28 Jun 2017 15:36:05 +0000 (11:36 -0400)]
docker-full: install libgmp-dev & libreadline-dev

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agodocker: use stretch instead of jessie
Jean Privat [Wed, 28 Jun 2017 15:35:11 +0000 (11:35 -0400)]
docker: use stretch instead of jessie

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agogamnit: by default, use the generated mipmap for minification
Alexis Laferrière [Tue, 27 Jun 2017 12:15:58 +0000 (08:15 -0400)]
gamnit: by default, use the generated mipmap for minification

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoneo4j: fix cypher syntax for `Neo4jClient::nodes_with_labels`
Jean Privat [Wed, 28 Jun 2017 13:39:39 +0000 (09:39 -0400)]
neo4j: fix cypher syntax for `Neo4jClient::nodes_with_labels`

newer versions of neo4j seem more picky

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agoMerge: gamnit: Sprite animations
Jean Privat [Tue, 27 Jun 2017 13:17:25 +0000 (09:17 -0400)]
Merge: gamnit: Sprite animations

Implement 2D animations on `Sprite`. The animations are started by calling `Spite::animate(animation, loops)`, stopped with `animate_stop` and can be paused/accelerated using `SpriteSet::time_mod`.

Animations are graphical only so the logic is almost entirely implemented on the GPU, the CPU acts only when the animation is explicitly changed. The drawback is that the animation pixel data must be simple: all frames share a texture, are on a line, are spaced equally and have the same dimensions. To simplify creating such animations, `Animation` has named constructors reading from the assets folder.

As usage examples, this PR reimplements the running animation in Action Nitro and adds an animation when opening the parachute. These animations test both the use of a distinct file and the use of subtextures in a larger spritesheet.

In the future, we can probably use the new `RelativeSubtexture` to gradually replace `AbsoluteSubtexture` as it doesn't require loading the texture to get its size and to create the underlying coordinates.

Pull-Request: #2509

6 years agoMerge: gamnit: performance improvements for Dawn Arrival
Jean Privat [Tue, 27 Jun 2017 13:16:52 +0000 (09:16 -0400)]
Merge: gamnit: performance improvements for Dawn Arrival

This PR applies a few tweaks to optimize performances of the 2D API:

* Each sprite now caches its index in the GPU buffers, replacing the use of `index_of`. This one has the largest performance gain, especially when there is a large number of sprites using the same texture.
* Cache the last sprite on which was called `needs_update` to avoid double or triple adding it to the set of sprites to update on the GPU. This provides a small but notable gain as when a sprite's X and Y coordinates are modified, it was added twice to the set.
* Use a boolean flag instead of the set `sprites_to_update` when all sprite must be updated after a buffer resize.

These changes were tested on [Dawn Arrival](https://gitlab.com/jeremlvt/dawn_arrival) and they cut about 25-50% of the computing time.

Pull-Request: #2513

6 years agoaction_nitro: animate the parachute opening
Alexis Laferrière [Mon, 19 Jun 2017 20:30:46 +0000 (16:30 -0400)]
action_nitro: animate the parachute opening

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoaction_nitro: update to use gamnit animations
Alexis Laferrière [Mon, 19 Jun 2017 00:53:45 +0000 (20:53 -0400)]
action_nitro: update to use gamnit animations

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: add animations to Sprites
Alexis Laferrière [Mon, 19 Jun 2017 20:01:44 +0000 (16:01 -0400)]
gamnit: add animations to Sprites

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: don't use `sprites_to_update` after a GPU buffer resize
Alexis Laferrière [Fri, 23 Jun 2017 04:08:39 +0000 (00:08 -0400)]
gamnit: don't use `sprites_to_update` after a GPU buffer resize

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: cache the last sprite added to `sprites_to_update`
Alexis Laferrière [Fri, 23 Jun 2017 04:08:06 +0000 (00:08 -0400)]
gamnit: cache the last sprite added to `sprites_to_update`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: cache sprite GPU index, as index_of is very costly
Alexis Laferrière [Fri, 23 Jun 2017 02:28:39 +0000 (22:28 -0400)]
gamnit: cache sprite GPU index, as index_of is very costly

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: add a subtexture with relative border coordinates
Alexis Laferrière [Mon, 19 Jun 2017 20:02:15 +0000 (16:02 -0400)]
gamnit: add a subtexture with relative border coordinates

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: pass the elapsed time in the world of each sprite set to the shader
Alexis Laferrière [Sun, 18 Jun 2017 00:31:46 +0000 (20:31 -0400)]
gamnit: pass the elapsed time in the world of each sprite set to the shader

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoasteronits: convert sound effect from a broken mp3 to ogg
Alexis Laferrière [Sun, 18 Jun 2017 03:06:03 +0000 (23:06 -0400)]
asteronits: convert sound effect from a broken mp3 to ogg

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: Clean benches
Jean Privat [Mon, 19 Jun 2017 20:23:40 +0000 (16:23 -0400)]
Merge: Clean benches

Some cleanup in the benchmark/ directory to remove the yellow dots in http://gresil.org/jenkins/job/nit_bench/

Pull-Request: #2505

6 years agoMerge: frontend: introduce `parse_annotations` phase
Jean Privat [Mon, 19 Jun 2017 20:23:39 +0000 (16:23 -0400)]
Merge: frontend: introduce `parse_annotations` phase

A simple annotations access framework.

Useful when you only need to know if a module, class or property definition contains an annotation in its source code and you don't have a modelbuilder.

One the phase is applied one can access the annotations through the related MEntity:
~~~nit
fun is_annotated_with_foo(mentity: AnnotatedMEntity): Bool do
    return mentity.has_annotation("foo")
end
~~~

I introduced a specific super class to avoid the introduction of `annotations` directly into the MEntity since the concept of annnotations is weird when talking about a MClass or a MType.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

Pull-Request: #2504

6 years agoMerge: neo4j: Prevent accidental code injections in the tests
Jean Privat [Mon, 19 Jun 2017 20:23:26 +0000 (16:23 -0400)]
Merge: neo4j: Prevent accidental code injections in the tests

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

Pull-Request: #2503

6 years agobench/engines: add a sanitary check to just run the various benched programs
Jean Privat [Mon, 19 Jun 2017 20:03:17 +0000 (16:03 -0400)]
bench/engines: add a sanitary check to just run the various benched programs

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agobench/engines: remove `jwrapper` output directory
Jean Privat [Mon, 19 Jun 2017 19:59:16 +0000 (15:59 -0400)]
bench/engines: remove `jwrapper` output directory

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agobench/markdown: disable pandoc
Jean Privat [Mon, 19 Jun 2017 19:41:50 +0000 (15:41 -0400)]
bench/markdown: disable pandoc

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agobench/string: check force run on fast instances
Jean Privat [Mon, 19 Jun 2017 19:19:52 +0000 (15:19 -0400)]
bench/string: check force run on fast instances

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agobench/string: fix typo in shell script
Jean Privat [Mon, 19 Jun 2017 19:19:25 +0000 (15:19 -0400)]
bench/string: fix typo in shell script

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agofrontend: introduce `parse_annotations` phase
Alexandre Terrasa [Mon, 19 Jun 2017 17:03:04 +0000 (13:03 -0400)]
frontend: introduce `parse_annotations` phase

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agoneo4j: Prevent accidental code injections in the tests
Jean-Christophe Beaupré [Sat, 17 Jun 2017 04:50:22 +0000 (00:50 -0400)]
neo4j: Prevent accidental code injections in the tests

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

6 years agoneo4j: Fix the example for `CypherQuery::set`
Jean-Christophe Beaupré [Sat, 17 Jun 2017 04:45:50 +0000 (00:45 -0400)]
neo4j: Fix the example for `CypherQuery::set`

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

6 years agoMerge: Use prefixed chars instead of raw values
Jean Privat [Sat, 17 Jun 2017 00:25:19 +0000 (20:25 -0400)]
Merge: Use prefixed chars instead of raw values

The title says everything, basically all uses of `0xXXu8` in `core::text::flat` were replaced by their prefixed versions for better readability.

This PR will however need c_src to be regenerated for integration.

I PR this now however to make sure it is not forgotten when a c_src is later regenerated and for review purposes.

Pull-Request: #2059
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Jean-Christophe Beaupré <jcbrinfo.public@gmail.com>

6 years agoMerge: subset: Add grammar and kind
Jean Privat [Sat, 17 Jun 2017 00:24:44 +0000 (20:24 -0400)]
Merge: subset: Add grammar and kind

Implement the syntactic, inheritance and instantiation rules.

Obsoletes: #2469

Pull-Request: #2483
Reviewed-by: Jean Privat <jean@pryen.org>

6 years agoMerge: gamnit: customize writing with BMFont
Jean Privat [Sat, 17 Jun 2017 00:24:33 +0000 (20:24 -0400)]
Merge: gamnit: customize writing with BMFont

Add format services to `TestSprites` implemented (only) by `BMFont`: `align, valign, wrap, max_width` and `max_height`. You can see the result in the screenshot of the new showcase/test program:

![screenshot from 2017-06-15 15 53 28](https://user-images.githubusercontent.com/208057/27199185-1b9a36dc-51e3-11e7-9700-8dde5724e98a.png)

Pull-Request: #2499
Reviewed-by: Jean Privat <jean@pryen.org>

6 years agogamnit: add an example to showcase fonts support
Alexis Laferrière [Tue, 13 Jun 2017 14:36:02 +0000 (10:36 -0400)]
gamnit: add an example to showcase fonts support

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: implement new `TextSprites` settings in `BMFont`
Alexis Laferrière [Wed, 14 Jun 2017 13:35:16 +0000 (09:35 -0400)]
gamnit: implement new `TextSprites` settings in `BMFont`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: add customization settings to `TextSprites`
Alexis Laferrière [Tue, 13 Jun 2017 14:34:58 +0000 (10:34 -0400)]
gamnit: add customization settings to `TextSprites`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: fix actually using the attribute partial_line_skip
Alexis Laferrière [Tue, 13 Jun 2017 11:50:59 +0000 (07:50 -0400)]
gamnit: fix actually using the attribute partial_line_skip

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: accept float values in `BMFont`
Alexis Laferrière [Mon, 12 Jun 2017 20:26:40 +0000 (16:26 -0400)]
gamnit: accept float values in `BMFont`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: oot: add 2 random projects found on the Internet.
Jean Privat [Fri, 16 Jun 2017 18:56:43 +0000 (14:56 -0400)]
Merge: oot: add 2 random projects found on the Internet.

They seems to be free software, so I think it is ok to include them...

Pull-Request: #2484
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: neo4j: Add a fluent interface to set queries’ parameters
Jean Privat [Fri, 16 Jun 2017 18:56:41 +0000 (14:56 -0400)]
Merge: neo4j: Add a fluent interface to set queries’ parameters

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

Pull-Request: #2498

6 years agoMerge: modelize_property: Add a variable to shorten some code
Jean Privat [Fri, 16 Jun 2017 18:56:04 +0000 (14:56 -0400)]
Merge: modelize_property: Add a variable to shorten some code

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

Pull-Request: #2492