lib/gamnit: intro `GamnitDisplay::aspect_ratio`
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 29 Sep 2015 20:49:40 +0000 (16:49 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 10 Dec 2015 20:32:47 +0000 (15:32 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/gamnit/display.nit

index 94ece8a..97d82b5 100644 (file)
@@ -32,6 +32,9 @@ class GamnitDisplay
        # Height of the display, in pixels
        fun height: Int is abstract
 
+       # Aspect ratio of the screen, `width / height`
+       var aspect_ratio: Float is lazy do return width.to_f / height.to_f
+
        # Prepare this display
        #
        # The implementation varies per platform.