Slick Forums

Discuss the Slick 2D Library
It is currently Sun May 26, 2013 3:29 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: resume call trouble
PostPosted: Fri Jul 29, 2011 1:42 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
Ever since I got the latest version of libgdx to work, my game has not crashed when switching orientations (or when the keyboard is exposed). Unfortunately it still resets the game, starting it from the very beginning. The log said something about an unexpcted resume. I'll get more. Any immediate ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 03, 2011 4:32 pm 
Offline

Joined: Sun Jul 24, 2011 3:52 pm
Posts: 19
I don't think there's actually any code to handle resuming in Slick-AE.

Pausing and resuming is handled by overriding the onPause and onResume methods in the Android Activity class. These methods are not overridden in the SlickActivity class so nothing is done.

I've added code so that hasFocus works (without it, my phone freezes up), but I still run into the reset from the beginning, or in my case, reset from the current state.

I'm going to look into it some more.


Top
 Profile  
 
PostPosted: Thu Aug 04, 2011 1:44 am 
Offline

Joined: Sun Jul 24, 2011 3:52 pm
Posts: 19
Regardless of whether your orientation is locked to landscape, add the following line to your manifest file within your activity definition:

Code:
android:configChanges="orientation|keyboard|keyboardHidden"


Then all you will need to do is implement some sort of code so that your game knows when it is paused.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 04, 2011 3:34 am 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
Thanks, that worked perfectly. Where did you find out so much about android manifests?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 04, 2011 2:56 pm 
Offline

Joined: Sun Jul 24, 2011 3:52 pm
Posts: 19
I've written up a few basic Android apps (a Calendar app, an invoicing app and a receipt app) for my dad who likes everything simple. Also, in this particular case I didn't actually know what to do.

I had a hunch it was a GDX issue as there's no Slick code for pausing or resuming and GDX spits some lines to the log when you resume or pause so I googled the issue with the words "gdx" included which is how I found out.

Unfortunately, if you plan on making your game resume when your phone resumes, you should be aware that it will run during your lockscreen so you should make it pause your game and make the user have to unpause it (as opposed to it automatically unpausing when you turn your phone back off).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group