This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Iphone Orientation Issue


Iphone Orientation Issue

Postby Raymond » Jun 7, 2010 @ 11:32am

Hello,

I am a new user of the EdgeLib, and I want to use it to make some iPad applications.
An iPad application must support at least 2 orientations to be validated and submitted.

So, I want to know how to rotate the application when the device's orientation change.

I have try many things :
- Use the callback OnDisplayChange, try to printf something inside, but this method's never called, so I don't understand what's the use of this callback.
- create a new class (.mm) and a method which check the UIDevice orientation. I call this method every frame (OnNextFrame), but the orientation of UIDevice never changes.
- I also try to add some options in the Info.plist as UISupportedInterfaceOrientations etc.. but nothing.

So what is the correct method to handle the orientation's change event?

Thanks in advance,

Raymond
Raymond
pm Member
 
Posts: 2
Joined: Jun 7, 2010 @ 11:23am


Re: Iphone Orientation Issue

Postby edge » Jun 8, 2010 @ 5:30pm

Hi Raymond,

The OnDeviceChanged callback is used for other mobile platforms and has no use for iPhone. We will research orientation handling on the iPad in combination EDGELIB. Either way, when using OpenGL ES you need to manually rotate (using glRotate and glTranslate) for orientations other than portrait mode.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Re: Iphone Orientation Issue

Postby Raymond » Jun 8, 2010 @ 5:36pm

Hi, thanks for your answer.

I agree, but my problem is the handling of the orientation's change event.
I don't know how to know when does the user move his device to other orientation!

I find some ways to rotate the screen manually (as you said), but no way to know when to do it !

Some applications (angry birds) developped with edgelib manage perfectly the rotation, so it is possible.

I don't know if I am clear..

Please help me!

Thanks
Raymond
pm Member
 
Posts: 2
Joined: Jun 7, 2010 @ 11:23am


Re: Iphone Orientation Issue

Postby Dan East » Jun 8, 2010 @ 6:20pm

The app probably monitors the accelerometer.
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Re: Iphone Orientation Issue

Postby edge » Jun 16, 2010 @ 9:26am

Hi Raymond,

To get orientation events you need to register a callback function from the notification center:
Code: Select all


[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil];
2 lines; 0 keywds; 0 nums; 17 ops; 0 strs; 0 coms    Syntactic Coloring v0.4 - Dan East  


And finally, implement the callback:
Code: Select all






//Orientation change callback
- (void)orientationDidChange:(NSNotification *)notification
{
    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
    //Handle orientation event
}
6 lines; 1 keywds; 0 nums; 15 ops; 0 strs; 2 coms    Syntactic Coloring v0.4 - Dan East  
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Re: Iphone Orientation Issue

Postby totoch » Sep 15, 2010 @ 5:20am

Could you make a short tutorial about that ? That would be greatly appreciated.
Also, is there any chance this feature would be integrated in an upcoming release ?
Thanks!
totoch
pm Member
 
Posts: 20
Joined: Sep 20, 2009 @ 10:27pm


Re: Iphone Orientation Issue

Postby edge » Sep 16, 2010 @ 3:48pm

Hi,

The above two functions are written in Objective-C and can be implemented in your application. To do this, create an .mm source file with these functions inside (these can be part of a C++ class). The header file can be included in your c++ program, as long as there is no objective-c code inside that header file.

We may choose to implement a more convenient way of handling this in a future version of EDGELIB, however this isn't planned yet.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron