lib/vsm: access to non-existing keys return 0.0
[nit.git] / lib / gamnit / gamnit_linux.nit
index b0c4241..b86f8e5 100644 (file)
@@ -37,6 +37,7 @@ redef class App
                        if sdl_event isa SDLWindowEvent and sdl_event.is_resized then
                                display.width = sdl_event.data1
                                display.height = sdl_event.data2
+                               display.aspect_ratio = sdl_event.data1.to_f / sdl_event.data2.to_f
                                on_resize display
                        end
 
@@ -47,6 +48,10 @@ redef class App
        end
 end
 
+redef class GamnitDisplay
+       redef var aspect_ratio = super is lazy
+end
+
 # ---
 # Redef services from `sdl2::events`