Skip to content

Commit

Permalink
FlxG: onMobile docs + formatting (#1904)
Browse files Browse the repository at this point in the history
Also removed the unnecessary @:isVar.
  • Loading branch information
Gama11 committed Aug 21, 2016
1 parent 778891b commit 81967ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
15 changes: 13 additions & 2 deletions flixel/FlxG.hx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ class FlxG
*/
public static var drawFramerate(default, set):Int;

@:isVar
/**
* Whether the game is running on a mobile device.
* If on HTML5, it returns `FlxG.html5.onMobile`.
* Otherwise, it checks whether the `mobile` haxedef is defined.
*/
public static var onMobile(get, never):Bool;

public static var renderMethod(default, null):FlxRenderMethod;
Expand Down Expand Up @@ -713,7 +717,14 @@ class FlxG

private static inline function get_onMobile():Bool
{
return #if js html5.onMobile #elseif mobile true #else false #end;
return
#if js
html5.onMobile
#elseif mobile
true
#else
false
#end;
}
}

Expand Down
5 changes: 2 additions & 3 deletions flixel/system/frontEnds/HTML5FrontEnd.hx
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,13 @@ class HTML5FrontEnd

private function getOnMobile():Bool
{
return
switch (platform)
return switch (platform)
{
case ANDROID, BLACKBERRY, WINDOWS_PHONE, IOS(_):
true;
default:
false;
};
}
}

private function userAgentContains(substring:String, toLowerCase:Bool = false)
Expand Down

0 comments on commit 81967ad

Please sign in to comment.