Skip to content

Commit

Permalink
FlxG: add onMobile (#1904)
Browse files Browse the repository at this point in the history
  • Loading branch information
DleanJeans authored and Gama11 committed Aug 21, 2016
1 parent 4d99b19 commit 778891b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions flixel/FlxG.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions flixel/system/frontEnds/HTML5FrontEnd.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,7 +21,7 @@ class HTML5FrontEnd
{
browser = getBrowser();
platform = getPlatform();
isMobile = getIsMobile();
onMobile = getOnMobile();
}

private function getBrowser():FlxBrowser
Expand Down Expand Up @@ -90,7 +90,7 @@ class HTML5FrontEnd
else return FlxPlatform.UNKNOWN;
}

private function getIsMobile():Bool
private function getOnMobile():Bool
{
return
switch (platform)
Expand Down

0 comments on commit 778891b

Please sign in to comment.