-
Notifications
You must be signed in to change notification settings - Fork 435
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
HTML5FrontEnd: Add platform and mobile detection #1897
Conversation
@@ -59,6 +61,49 @@ class HTML5FrontEnd | |||
{ | |||
return Browser.window.innerHeight; | |||
} | |||
|
|||
private inline function get_platform():FlxPlatform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is way to long to be a good candidate for inline
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably just run this entire thing once in new()
and cache the result? It's not like it's gonna change at runtime, right? :)
private function new() | ||
{ | ||
browser = getBrowser(); | ||
browserWidth = getBrowserWidth(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Browser width and height could change at runtime, so I don't think caching those is a good idea.
WINDOWS; | ||
LINUX; | ||
UNIX; | ||
MAC; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... MAC
isn't used anywhere?
I think we really need more people to test this |
Sorry for my ignorance. Here's my reference. So you're saying it should be removed? |
I'm not sure, I was mostly asking out of ignorance as well. ;) |
Maybe it's for some kind of Unix-based OS which is probably rarely used by our users. So I guess it should be removed anyway. |
Replace iOS with iPhone/Pad/Pod Add missing Mac (oops) Remove Unix
It feels a bit strange to have IPOD / IPAD / IPHONE in the enum directly, since everything else in there is an OS... It might make sense to continue having |
Thanks! :) |
I added
platform
andisMobile
variables toFlxG.html5
.Tested on Windows and Android. Not sure about the others. Here's a test (https://github.com/DleanJeans/flixel-html5-platform-test).