user1235155
user1235155

Reputation: 457

Cocos2D autoration shifted by 90 Degrees

When autorotating, I set

GAME_AUTOROTATION = kGameAutorotationUIViewController

and

#elif GAME_AUTOROTATION == kGameAutorotationUIViewController    
    return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) );

This means that if I hold the device in either landscape orientation it will autorotate. The thing is, the rotation is always shifted by 90 degrees (ie when I rotate to landscape right I get portrait).

How do I go along in fixing this?

Upvotes: 0

Views: 130

Answers (1)

sergio
sergio

Reputation: 69027

The correct way to set GAME_AUTOROTATION is this:

#define GAME_AUTOROTATION kGameAutorotationUIViewController

(I have mine in GameConfig.h.)

I can't make sense of GAME_AUTOROTATION = kGameAutorotationUIViewController, so just thinking this could be the cause of the problem (if you used it like that).

In any case, if you still have problems with autorotation, set a breakpoint in willRotateToInterfaceOrientation and inspect what happens from there; same with willAnimateRotationToInterfaceOrientation.

Upvotes: 1

Related Questions