Active Topics

 


Reply
Thread Tools
Posts: 108 | Thanked: 329 times | Joined on Apr 2010 @ Bosnia and Herzegovina
#1
Hi. I spent most of the day porting my old C++ SDL/OpenGL 2D sprite "library" to OpenGL-ES and I managed to do it, it runs quite good. But now I'd like to build a Tetris-like game that would run in portrait mode. As I expected, trying to set 480x800 fullscreen mode in SDL fails. Is there a way to get portrait SDL? Rotate the screen with some API call and then set portrait resolution? I searched around and I mostly found some auto-rotation scripts in Python. So, does anyone know how to do this in C++/SDL/GLES or has some sources to point me to? Thanks!
 
javispedro's Avatar
Posts: 2,355 | Thanked: 5,249 times | Joined on Jan 2009 @ Barcelona
#2
Unfortunately, you would need to first trigger the rotation in hildon-desktop then reinitialize SDL so that it gets the new list of valid resolutions.

This is a bit hard (a method that comes to mind is opening a window using Xlib, set the required atoms, then call SDL_Init, then set the required atoms in the SDL created window, then close the Xlib created window).

I have few suggestions here :
a) Avoid using SDL
b) Create the SDL window with 800x480 but rotate stuff on your own in the game (since you're using OpenGL, it should be a coordinate system change away).
c) Fix SDL (so that it listens to xrandr notifications and changes the list of valid resolutions after a hildon-desktop rotation), then ship the fixed version with your application.

Last edited by javispedro; 2010-12-24 at 16:05.
 

The Following User Says Thank You to javispedro For This Useful Post:
Posts: 108 | Thanked: 329 times | Joined on Apr 2010 @ Bosnia and Herzegovina
#3
Yeah, I was afraid of such answer. Guess I'll have to invent some clean and simple logic in my engine to do the rotation. I don't want to avoid SDL, because as it is now, the same code compiles on Win32, Ubuntu x86 and Maemo, and I would really like to keep that feature. I also depend on it for input handling, etc. Well, back to work. And also, one big THANK YOU, not just for this answer but for all the other stuff you've done around here, I really admire your work

EDIT : I've done a "soft" rotation, it was simpler than I thought it would be, a quick fix on 2 on 3 places in my code. But it would still be nice to have a rotateScreen(LEFT) function call available.

Last edited by TheBurek; 2010-12-24 at 16:54. Reason: Status update
 
Reply


 
Forum Jump


All times are GMT. The time now is 15:10.