SDL landscape mode on iphone

Reading the recent posts of the list it seems that the SDL landscape mode
for iphone was “ready”, so I got the last HG (less than 12 hours ago), built
SDL and start trying to use it.

I’ve seen that the system reports both 480x320 / 320x480, so I thought that
was enough to “activate” it simply request a SDL_Window of 480x320 instead
of 320x480, but the simulator still shows me part of the window in portrait
mode, so I tried to force landscape mode configuring
LandscapeOrientationRight and HideStatusBar in the Info.plist.

The simulator now starts in landscape mode, but my window is still in
"portrait", I also had to specify SDL_WINDOW_BORDERLESS to make the
statusbar disappear.

Looking inside the HG repository history it seems that Ryan updated some
code for landscape mode, in particular I found the code to “rotate” the
window with SDL_WINDOW_RESIZED, so I tried to make my app handle
SDL_WINDOW_RESIZED but the event never fires so I keep staying “portrait”.

Can someone give me some hints?

Do we still need to rotate our bitmaps and our touch coordinates ourselves
with the current version?

Thanks in advance,
Gabry

Hi,On 4/12/11 9:38 AM, Gabriele Greco wrote:

Looking inside the HG repository history it seems that Ryan updated some
code for landscape mode, in particular I found the code to “rotate” the
window with SDL_WINDOW_RESIZED, so I tried to make my app handle
SDL_WINDOW_RESIZED but the event never fires so I keep staying “portrait”.
The event fired is SDL_WINDOWEVENT, that event structure has an extra
field called window.event which then is SDL_WINDOWEVENT_RESIZED for the
rotation of the screen.

Regards,
Armin

code for landscape mode, in particular I found the code to “rotate” the
window with SDL_WINDOW_RESIZED, so I tried to make my app handle
SDL_WINDOW_RESIZED but the event never fires so I keep staying
"portrait".
The event fired is SDL_WINDOWEVENT, that event structure has an extra
field called window.event which then is SDL_WINDOWEVENT_RESIZED for the
rotation of the screen.

I’ve been able to use “landscape mode” with SDL_WINDOW_RESIZABLE, but not
without.

I’ve looked at the sources and it seems the problem is related to the fact
that also if you FORCE landscape mode in your Info.plist when
SDL_uikitwindow.m:SetupWindowData is called the orientation is still
"portrait".

It becomes “landscape” with an event that is fired maybe once the view is
created, but since didRotateFromInterfaceOrientation does nothing if
SDL_WINDOW_RESIZABLE is not set the app remain in portrait mode with part of
the view offscreen.

I’ve a few problems with mouse events also if I use SDL_WINDOW_RESIZABLE in
landscape mode:

I cannot get mouse clicks if x > 320 in LandscapeRight, and with X < 160 in
LandscapeLeft.

Anyway I’m working on it to provide a patch.–
Ing. Gabriele Greco, DARTS Engineering
Tel: +39-0105761240 Fax: +39-0105760224
s-mail: Via G.T. Invrea 14 - 16129 GENOVA (ITALY)