SDL 1.3 on iOS - orientation weirdness

Hi,

I’m using SDL for a some games on iOS and running into some weird issues:

  • on the iPad, when you open the multitasking bar it slides into view
    appropriately according to the current orientation, and then jumps to
    home-button-right orientation no matter what. So it’s upside down or
    whatever.

  • some people have reported that on iPhone, when locked onto portrait
    orientation, it loads in landscape and they have to unlock, rotate,
    unrotate, lock to get it into portrait orientation. I haven’t been
    able to reproduce this on iPad and iPod; don’t have an iPhone myself.

Not sure if this is something I’m doing wrong or what.

Here’s the setup code:

SDL_Init(SDL_INIT_VIDEO);
window = SDL_CreateWindow(NULL, 0, 0, 768, 1024, SDL_WINDOW_OPENGL |
SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS |
SDL_WINDOW_RESIZABLE );
context = SDL_GL_CreateContext(window);
SDL_GetWindowSize(window, &actual_width, &actual_height);
glViewport(0,0, actual_width, actual_height);
bool screen_rotated = actual_width<actual_height;

(and then when window-resized-events happen, do getwindowsize again to
see what the new orientation is)

What seems like it might be off here is that I don’t know orientation
until after creating the window context - is it possible to query
orientation beforehand?
Or any other ideas that might help?

Thanks,
Michael

No ideas?
I’ve tried a bunch of stuff to no avail, it does seem like the library
isn’t handling orientations correctly. Has nobody done an ios app
with sdl that works in different orientations?On Thu, May 10, 2012 at 8:04 PM, wrote:

Message: 1
Date: Thu, 10 May 2012 15:36:10 +0100
From: Michael Brough <@Michael_Brough>
To: sdl at lists.libsdl.org
Subject: [SDL] SDL 1.3 on iOS - orientation weirdness
Message-ID:
? ? ? ?<CAD==P3NNNLtH3fwf=J4mcLv6UHBFf6XvJxrEDnUjSnrMjGrGLA at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I’m using SDL for a some games on iOS and running into some weird issues:

  • on the iPad, when you open the multitasking bar it slides into view
    appropriately according to the current orientation, and then jumps to
    home-button-right orientation no matter what. ?So it’s upside down or
    whatever.

  • some people have reported that on iPhone, when locked onto portrait
    orientation, it loads in landscape and they have to unlock, rotate,
    unrotate, lock to get it into portrait orientation. ?I haven’t been
    able to reproduce this on iPad and iPod; don’t have an iPhone myself.

Not sure if this is something I’m doing wrong or what.

Here’s the setup code:

SDL_Init(SDL_INIT_VIDEO);
window = SDL_CreateWindow(NULL, 0, 0, 768, 1024, SDL_WINDOW_OPENGL |
SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN ?| SDL_WINDOW_BORDERLESS |
SDL_WINDOW_RESIZABLE );
context = SDL_GL_CreateContext(window);
SDL_GetWindowSize(window, &actual_width, &actual_height);
glViewport(0,0, actual_width, actual_height);
bool screen_rotated = actual_width<actual_height;

(and then when window-resized-events happen, do getwindowsize again to
see what the new orientation is)

What seems like it might be off here is that I don’t know orientation
until after creating the window context - is it possible to query
orientation beforehand?
Or any other ideas that might help?

Thanks,
Michael