diff --git a/flixel/FlxG.hx b/flixel/FlxG.hx index 3caee2e6b3..e9ef27e38c 100644 --- a/flixel/FlxG.hx +++ b/flixel/FlxG.hx @@ -117,6 +117,9 @@ class FlxG */ public static var drawFramerate(default, set):Int; + @:isVar + public static var onMobile(get, never):Bool; + public static var renderMethod(default, null):FlxRenderMethod; public static var renderBlit(default, null):Bool; @@ -707,6 +710,11 @@ class FlxG { return game._state; } + + private static inline function get_onMobile():Bool + { + return #if js html5.onMobile #elseif mobile true #else false #end; + } } enum FlxRenderMethod diff --git a/flixel/system/frontEnds/HTML5FrontEnd.hx b/flixel/system/frontEnds/HTML5FrontEnd.hx index 0bbcc9f700..f47f0a040b 100644 --- a/flixel/system/frontEnds/HTML5FrontEnd.hx +++ b/flixel/system/frontEnds/HTML5FrontEnd.hx @@ -11,7 +11,7 @@ class HTML5FrontEnd { public var browser(default, null):FlxBrowser; public var platform(default, null):FlxPlatform; - public var isMobile(default, null):Bool; + public var onMobile(default, null):Bool; public var browserWidth(get, never):Int; public var browserHeight(get, never):Int; public var browserPosition(get, null):FlxPoint; @@ -21,7 +21,7 @@ class HTML5FrontEnd { browser = getBrowser(); platform = getPlatform(); - isMobile = getIsMobile(); + onMobile = getOnMobile(); } private function getBrowser():FlxBrowser @@ -90,7 +90,7 @@ class HTML5FrontEnd else return FlxPlatform.UNKNOWN; } - private function getIsMobile():Bool + private function getOnMobile():Bool { return switch (platform)