Ah ok, I see, the applyLandscape is just another Transform at the root level, I thought it was doing something fancier when I first looked at it.
-(void) applyLandscape
{
// . . .
case CCDeviceOrientationPortraitUpsideDown:
glTranslatef(160,240,0);
glRotatef(180,0,0,1);
glTranslatef(-160,-240,0);
break;
// . . .
}
So in essence you do not even have to send a message to the director to do this. You can do it yourself on the root scene node just fine. I finally settled on this:
//******************************************************
// Device rotated
//******************************************************
- (void) DeviceRotated:(NSNotification *)notification
{
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
ccDeviceOrientation cor = (ccDeviceOrientation)orientation;
if( cor == UIDeviceOrientationLandscapeLeft)
{
[self runAction:[ScaleTo actionWithDuration:0.25f scale:1.5]];
[self runAction:[MoveTo actionWithDuration: 0.25f position:ccp(130, 0)]];
[self runAction:[RotateTo actionWithDuration:0.25f angle: 90]];
}
else if ( cor == UIDeviceOrientationLandscapeRight )
{
[self runAction:[ScaleTo actionWithDuration:0.25f scale:1.5]];
[self runAction:[MoveTo actionWithDuration: 0.25f position:ccp(-130, 0)]];
[self runAction:[RotateTo actionWithDuration:0.25f angle: -90]];
}
else if ( cor == UIDeviceOrientationPortrait )
{
[self runAction:[ScaleTo actionWithDuration:0.25f scale:1]];
[self runAction:[MoveTo actionWithDuration: 0.25f position:ccp(0, 0)]];
[self runAction:[RotateTo actionWithDuration:0.25f angle: 0]];
}
}
which keeps my game world "Upright" no matter how they have the phone rotated and when it switches, it switches with a nice scale / rotation smoothly.
"self" is my GameLayer and constitutes the 'world space'. So after the world is rotated and I want something to move to say pixel ( 150, 230 ) in my GameSprite, you can figure out what the Screen to Parent coordinates are with a call to convertToNode:
CGPoint sloc = ccp( 150, 230 );
parentloc = [parent convertToNodeSpace: sloc];
I wish there was an adoptNode and convertNodeToNode