SDL2/Android Dies on Rotation |
alexmarkley
|
Hello all,
My name is Alex Markley, and although this is my first post, I've been lurking+using SDL for quite some time. I have a deep appreciation for SDL, both the engineering it represents and the raw labor. You guys rock! I'm working on a personal project that puts some higher level layers on top of SDL and is intended to run perfectly on various modern systems. iOS, Android, and BB10 are all in my sights. (Actually, there could be a whole discussion around BB10, because my code is running perfectly on BlackBerry PlayBook right now, and it could potentially form the basis of a BB10 port of SDL2?) Over the past few days, I have gotten my project running on real Android hardware using an hg clone of SDL2 from a couple days ago. It seems nice, but I'm running into some problems. In particular, when I rotate the phone, the program shuts down. I'm asking SDL for a resizable window, but upon inspection of the flags the resizable flag is being unset. And I found this comment in SDL_androidwindow.c: /* window is NEVER resizeable */ So is rotating/resizing window support not yet implemented in the Android port? It works semi-acceptably on iOS, and I presume the goal is to have a similar feature set across all platforms. I suppose I could have simply posted a bug report and left it at that, but I wanted to send an email because I would rather be part of the solution. I'm competent in C and if somebody would be willing to point me in the right direction I would love to start working on a patch or two. Thanks for reading. — Alex Markley 740.927.3588 http://AlexMarkley.com http://MarkleyBros.com PS. I registered for the forum, but apparently I don't have permission to post? I'm also lurking in IRC as malexmedia or alexmarkley. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|
SDL2/Android Dies on Rotation |
SDL2/Android Dies on Rotation |
alexmarkley
|
Gabriel,
Thanks for getting back to me! On 09/02/2012 11:59 AM, Gabriel Jacobo wrote:
I'm testing against a Motorola Droid A855 (Original) that I picked up for a song and a dance the other week. I have it running Cyanogenmod 7.2.0, which equates to Android 2.3.7. Here are the logs that immediately follow rotation of the device: I/WindowManager( 1162): Setting rotation to 1, animFlags=0 I/ActivityManager( 1162): Config changed: { scale=1.0 imsi=310/4 loc=en_US touch=3 keys=2/1/2 nav=2/2 orien=2 layout=34 uiMode=17 seq=16 themeResource=null} D/PhoneWindow( 2332): couldn't save which view has focus because the focused view net.malexmedia.epicmaze.SDLSurface@40523a10 has no id. V/SDL ( 2332): onDestroy() I/epicmaze( 2332): Got SDL2 Event: 0x100 D/dalvikvm( 2332): threadid=12: thread exiting, not yet detached (count=0) I/epicmaze( 2332): Tore down sdlsgi driver (Backend SDL2) I/epicmaze( 2332): Game uninitialized. I/epicmaze( 2332): Display List: Tore down 326 element(s). I/epicmaze( 2332): Display List: Tore down 2 groups(s). (0 of those group(s) did not appear to be in use.) I/epicmaze( 2332): Geometry Buffer: At uninitialization, freed up 2048 triangle slots for a total of 221184 bytes. I/epicmaze( 2332): Texture: Tore down 802 texture map(s), 1 texture atlas(es), and 768 packing corner(s). I/epicmaze( 2332): Engine gracefully shut down. I/WindowManager( 1162): WIN DEATH: Window{40771490 net.malexmedia.epicmaze/net.malexmedia.epicmaze.SDLActivity paused=false} I/ActivityManager( 1162): Process net.malexmedia.epicmaze (pid 2332) has died. I/WindowManager( 1162): WIN DEATH: Window{407890b8 SurfaceView paused=false} Since you mention it's been working for you, I imagine I might be doing something wrong. However, after the rotation, the only event I get is SDL_QUIT, so I don't know what I could be doing differently... Thanks in advance for any thoughts! — Alex Markley 740.927.3588 http://AlexMarkley.com http://MarkleyBros.com _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
SDL2/Android Dies on Rotation |
José Luis Pereira
Guest
|
Hi! You might want to try adding android:configChanges="orientation" to your activity in androidmanifest.xml..
Best ------ José Pereira On Sun, Sep 2, 2012 at 6:00 PM, Alex Markley wrote:
|
|||||||||||||||
|
SDL2/Android Dies on Rotation |
alexmarkley
|
On 09/02/2012 04:39 PM, José Luis Pereira wrote:
Thank you very much! That worked like a charm. I added some others too because my Droid has a keyboard, and when the keyboard is revealed that ALSO causes the app to quit aside from the pure orientation change. So my android:configChanges line looks like this: android:configChanges="keyboard|keyboardHidden|orientation|screenSize" Thanks again guys! — Alex Markley 740.927.3588 http://AlexMarkley.com http://MarkleyBros.com _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Nathaniel J Fries
|
Alex, it would be much appreciated if you were to keep a blog about your experiences with porting to the less standard systems like Android. I am sure that future users of SDL2 will be thankful for it.
|
|||||||||||
|
alexmarkley
|
I think I can do better than that. I've got a game-engine-like project that I'm planning on open-sourcing. The feature I'm working on at the moment is project generation for all supported targets. So in theory, if you follow the documentation to set up your build environment, you can generate an Android project or an Xcode project (iOS or Mac) in a couple of commands. I'll be pleased to release my notes and documentation along with the project so people (including myself) don't have to duplicate the effort too much. :) I'm 90% of the way to having something to show off. If there's any interest, that will help spur me on I think. https://twitter.com/AlexMarkley/status/242438449087537152 |
|||||||||||||
|