What this code will do is automatically rotate screen via iOS built in Orientation.
This is better than using Stage:setOrientation(orientation) because Stage:setOrientation(orientation) doesn't
rotate the Multi-taskbar, native popups, dialogs like the game center popup.
This is why I like to build my project on a local computer rather than a server like Corona. You have a lot more control.
O.K, add the code below to your AppNameViewController.mm. You will find the AppNameViewController.mm after
you export you project, it's in the Classes folder.
NOTE: AppNameViewController.mm will have a different name at the beginning. Just look for *******ViewController.mm
I added the code to the very bottom of the AppNameViewController.mm file, before the
@endI only tested on the iPad. It supports all orientations, you can set it to support whatever orientation you want.
After adding code to file, then save and build your project with Xcode.
This is for Landscape, change settings to use portrait mode.
NOTE: set these files to read only or you will have to keep replacing when rebuilding.
Add this code to Info.plist.
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array> |
--
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// return YES; to support all orientations. return NO; for no orientation.
// this is for portrait mode only
// return UIInterfaceOrientationIsPortrait(interfaceOrientation);
// this is for landscape mode only
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
} |
Comments
With the next version, the export option will have "export only asset files". So that you can safely export the project again and keep your modified project files untouched.
Can you include this code into the template so that you do not need to replace each time you rebuild?
This image is a landscape image.
It has something to do with (BOOL)shouldAutorotateToInterfaceOrientation running in
Landscape mode. Now if I run (BOOL)shouldAutorotateToInterfaceOrientation in
Portrait, the splash displays o.k, but then when I rotate the iPad to Portrait position
it display horizontally.
I know this has nothing to do with Gideros code, because everything is fine if I don't
use (BOOL)shouldAutorotateToInterfaceOrientation function, but I thought someone might know what could be wrong.
Thank you.
When there's no autorotation (Portrait mode) the resolution of iPad is 768x1024. When you enable autorotation and the application moves to Landscape mode, the resolution changes to 1024x768 but Gideros still thinks the resolution is 768x1024.
This issue will be fixed with the next version.
Please disable autorotation temporarily and work with Landscape mode until we release the next version.
Thank you again
something wrong. I spent all day trying to fix the problem.
I was going to change gdr_initialize((EAGLView *)self.view, 768, 1024, false); to
1024, 768 in the ViewController.mm. and go from there, but I'll wait for the fix.
Thank you very much for replying. I was going crazy trying to fix. :-??
Gideros. It uses a lot of animation, so MovieClip will help a lot. I'm also using my
own Highscore code which uses net commands and php code on the server. It looks Gideros
Has all the functions I need to make it work with Android. Ill be using Game Center for iOS apps.
I'm also using a custom keyboard, hopefully Gideros will use the native keyboard in a future release.
All my testing so far has been with iOS. I'll start testing Android next. I know a lot of
people are disappointment with Corona Android performance and compatibility problems, but I guess with all the different Android devices, it's going to happen.
One of our Android test device is a low-end device and we do performance tests on it. Usually the resulting performance is better than iPhone 3G. In the future, most probably, we meet performance problems on different Android devices but up to now we're happy and hopeful.
Thank you.