New games every week!
Where is it? I don't know! Blog
6th April 2011
Today, another one of those mindbogglingly annoying issues that stops you, makes you scratch your head, then makes you go "Well sod that then!" and enjoy the sun for a bit.

I'll do this again, tomorrow!
-=-=-



Today's issue was as follows.

Cocos2D contains a lovely method which spins the screen around whenever the player flips over their iPhing.
The spin works nicely, everything is neat, and the screen co-ordinates wrap to their new rotation.

Something else, though, doesn't flip.
The Accelerometer stays in the direction it should, with a tilt one way being constantly "that tilt".

If I knew the orientation of the screen, I could pass a set of faked values to the lovely framework.
Except.. How do I find the orientation of the screen?!
I don't know!!! Do you know!?!
Surely Cocos knows, because, from what I read, it's Cocos that's doing the screen flip thing.. And cocos knows, because it's changing my screen co-ordinates..
But..
What's the orientation?
"[CCDirector sharedDirector] deviceOrientation]" is 100% adamant that the iPhing is in Portrait, even when it's not.
Grrr..
Lots of retrys, today, and I didn't get anywhere.

Tomorrow I try again, and hopefully I'll do a bit better.


Today's screenshot, 1x Background Gradient, 150x BG Tile, 150x sprites, 150x stars, 1 "You're overdoing it again!" low fps, and two coordinates which show the current x/y accelerometer stats.
The stars do indeed move based on the angle of the iPhing, but all go the wrong way if you turn the device upside down... Grrr...
Views 8, Upvotes 3  
Daily Blog
New games every week!
Site credits : Jayenkai put all his heart and soul into everything you can see on this site.
(c) Jayenkai 2023 and onwards, RSS feed

Blog - Where is it? I don't know! - AGameAWeek