Merge: gamnit: dynamic window resize
authorJean Privat <jean@pryen.org>
Fri, 9 Jun 2017 14:55:13 +0000 (10:55 -0400)
committerJean Privat <jean@pryen.org>
Fri, 9 Jun 2017 14:55:13 +0000 (10:55 -0400)
commitf27c228f0097cb7a76c3b79edbb47e16d98bca24
treeae0b9193973703d640a388f56b0722c33c8dd29d
parent128a55d26f53b70426dd0bfc138d1b253330876b
parentebb24c6cbf0b7435392e68e795917442fe65e20b
Merge: gamnit: dynamic window resize

Enable dynamic window resizing on desktop computers. It follows the current behavior to preserve the virtual height of 1080 units while adapting the width to respect the window aspect ratio. This is the foolproof behavior, but clients can redef `on_resize` to configure the display as needed, or disable window resizing by setting a custom `GamnitDisplay::sdl_window_flags`.

As support, move `IPoint3d::offset` out of `gamnit` to `geometry` so it can be used by game logic (not just UI logic). And rework sprite positions derived from a camera anchor (such as `ui_camera.center` or `ui_camera.top_left`) to update them when the display is resized.

If needed, we could add a service to preserve the aspect ratio to the desired value. However, since mobile platforms are first class targets, gamnit games should support different resolutions. So have a range of accepted aspect ratios could be a solution to avoid unexpected ratios.

![screenshot from 2017-06-06 20 06 23](https://user-images.githubusercontent.com/208057/26857006-a295d456-4af5-11e7-9d47-1321319b5887.png)
![screenshot from 2017-06-06 20 06 32](https://user-images.githubusercontent.com/208057/26857008-a587c034-4af5-11e7-9816-358e8999a239.png)
![screenshot from 2017-06-06 20 06 37](https://user-images.githubusercontent.com/208057/26857010-a8c33e9a-4af5-11e7-9c61-3117a68f51ef.png)
![screenshot from 2017-06-06 20 06 40](https://user-images.githubusercontent.com/208057/26857016-aae02224-4af5-11e7-84ff-07f092f0289b.png)

Pull-Request: #2477
Reviewed-by: Jean Privat <jean@pryen.org>
contrib/action_nitro/src/action_nitro.nit
lib/gamnit/display_linux.nit