Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlxG: Add FlxG.onMobile #1904

Merged
merged 3 commits into from
Aug 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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