From 1d723e1d0ececfb1b44c3837f9e0d71214b2fd41 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Fri, 31 Jul 2015 19:44:03 -0700 Subject: [PATCH] Add window.display --- lime/ui/Window.hx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lime/ui/Window.hx b/lime/ui/Window.hx index e83ec2634..c9dd8b0ac 100644 --- a/lime/ui/Window.hx +++ b/lime/ui/Window.hx @@ -6,6 +6,9 @@ import lime.app.Config; import lime.app.Event; import lime.graphics.Image; import lime.graphics.Renderer; +import lime.math.Vector2; +import lime.system.Display; +import lime.system.System; class Window { @@ -13,6 +16,7 @@ class Window { public var currentRenderer:Renderer; public var config:Config; + public var display (get, null):Display; public var enableTextEvents (get, set):Bool; public var fullscreen (get, set):Bool; public var height (get, set):Int; @@ -259,6 +263,29 @@ class Window { + @:noCompletion private function get_display ():Display { + + var center = new Vector2 (x + (width / 2), y + (height / 2)); + var numDisplays = System.numDisplays; + var display; + + for (i in 0...numDisplays) { + + display = System.getDisplay (i); + + if (display.bounds.containsPoint (center)) { + + return display; + + } + + } + + return null; + + } + + @:noCompletion private inline function get_enableTextEvents ():Bool { return backend.getEnableTextEvents ();