Irrlicht on iPhone in Landscape mode

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
mthud
Posts: 7
Joined: Sun Oct 30, 2011 7:13 am

Irrlicht on iPhone in Landscape mode

Post by mthud »

Hi Guys,

I'm using the great iPhone template provided at http://irrlicht.sourceforge.net/forum/v ... 5&start=90

But I want the project to be a landscape view rather than portrait on the iPhone. I've searched these forums but didn't find a method that worked for me.

I was hoping someone familiar with the template or even just irrlicht on iPhone in general would be able to provide some guidance.

Thanks in advance!
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Irrlicht on iPhone in Landscape mode

Post by mongoose7 »

Can't you just rotate the camera?
mthud
Posts: 7
Joined: Sun Oct 30, 2011 7:13 am

Re: Irrlicht on iPhone in Landscape mode

Post by mthud »

No, I've tried that, setUpVector(0,0,-90) will rotate the camera and skybox but gui elements and other objects appear on their side and incorrectly placed.

Anyone got any other ideas?
mthud
Posts: 7
Joined: Sun Oct 30, 2011 7:13 am

Re: Irrlicht on iPhone in Landscape mode

Post by mthud »

Another quick question that has also popped up and stumped me. If I load and display a png image it shows up as plain white, whereas jpg or bmp shows correctly.
Any clues?
Sky-Fox
Posts: 29
Joined: Fri Feb 04, 2011 10:49 am

Re: Irrlicht on iPhone in Landscape mode

Post by Sky-Fox »

I Rotate so

Code: Select all

 
#include <CoreGraphics/CoreGraphics.h>
#include <CoreGraphics/CGAffineTransform.h>
#define degreesToRadian(x) (M_PI * (x) / 180.0)
 
and

Code: Select all

 
 UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation];
    UIView * SupperView=[glView  superview];
    CGAffineTransform transform = CGAffineTransformIdentity; 
////////////////////    Landscape
    if(deviceOrientation==UIDeviceOrientationLandscapeRight)
    {
        transform = CGAffineTransformMakeRotation(degreesToRadian(270));
        [SupperView setTransform:transform];
        [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
    }
    else if(deviceOrientation==UIDeviceOrientationLandscapeLeft)
    {
        transform = CGAffineTransformMakeRotation(degreesToRadian(90));
        [SupperView setTransform:transform];
        [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft];
    }
////////////////////    Portrait
    else if(deviceOrientation==UIDeviceOrientationPortrait)
    {
        transform = CGAffineTransformMakeRotation(degreesToRadian(0));
        [SupperView setTransform:transform];
        [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
    }
    else if(deviceOrientation==UIDeviceOrientationPortraitUpsideDown)
    {
        transform = CGAffineTransformMakeRotation(degreesToRadian(180));
        [SupperView setTransform:transform];
        [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortraitUpsideDown];
    }
////////////////////    
 
Post Reply