Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Phone Plugins/Scripts?

CT_Bolt

Global Moderator
Staff member
Resource Team
Xy$
0.02
I was just wondering how do I find out the screens orientation on a phone?
...or even force it to be only displayed one way even if not locked in the phone settings?
Also are there any plugins with certain features specially designed for phones?
Is any of this possible? (I'm sure there would be at least someway...)
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
I never noticed anything in the core scripts for mobile orientation, but when you create the manifest.json to create the app you can add your own lines of code to lock the orientation to landscape. Here i a link to explain that part, this is for browsers but when creating an app from the game via the help file in MV you will need to create a manifest file just like the one in the link and in this file is where you put the code.
"orientation": "landscape"
As for plugins specifically for phones, there are touch buttons overlay plugins but I don't think I noticed anything else around.
EDIT: forgot the link lol https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with-webapp-manifest-in-chrome-38-for-Android
 
You'd think that, in their infinite wisdom because they DID create something meant to be compatible with such devices, that they'd put something like this in the core code. However, that's the beauty it. Because it uses HTML5/JS for cross-compatibility, you can use the DeviceOrientationEvent.

In addition to the link that @LTN Games provided, there are two more that I know of (taken from my own bookmarks, since I'm a web designer):

This one on MDN and this one on HTML5 Rocks.

You can take advantage of window's inherent event listeners to add orientation options. As an example:

JavaScript:
var supportsOrientationChange = "onorientationchange" in window,
    orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";
console.log(supportsOrientationChange, orientationEvent);
will output "false" and "resize" in RMMV, meaning it doesn't support orientation change (I can just imagine trying to orientate the monitor! Haha!) but it does support window resizing. That's probably a poor example, but technically it can be done with a bit of work and tweaking. And, of course, a lot of testing on the devices themselves.
 
Top