FindClass / rokon

Automatically exported from code.google.com/p/rokon
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Getting white screen when coming back from lock screen. #174

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Hitting the "lock" button to put your phone to sleep.
2. Unlocking the phone and come back into the game.
3.

What is the expected output?
I would expect the last scene to show up.

What do you see instead?
A white screen and a title bar that has the name of my game at the top.

What version of Rokon are you using?
My source is from 10-27-10.

On which version of Android are you experiencing this?
My phone is running 2.1 (Samsung Captivate)

Please provide any additional information below.
Am I not handling this right?  Is there something special I should be doing on 
the onResume and onPause of each scene?  I know the onDestroy is called when 
you put the phone into this state but what is the general way to get all these 
scenes back?

Original issue reported on code.google.com by PPro.Gam...@gmail.com on 25 Nov 2010 at 8:11

GoogleCodeExporter commented 9 years ago
So here's what I've done to test this... and maybe this is something completely 
retarded that I'm leaving out. I'm using the 2.0.3 rokon jar for my project. 
I've dropped my code to be one simple scene that has a background. And this 
still doesn't wake back up properly. My RokonActivity looks like this :

public void onCreate() {
debugMode();
forceFullscreen();
forceLandscape();
GAME_WIDTH = setGameSize(GAME_WIDTH, GAME_HEIGHT);
setDrawPriority(DrawPriority.PRIORITY_NORMAL);
setGraphicsPath("graphics/");
createEngine();
 }

@Override public void onLoadComplete() {
Textures.loadTextures();
menuScene = new MenuScene();
setScene(menuScene);
 }

My MenuScene looks like this :

public MenuScene() {
              superr(1, 5); // Setup the scene to have 1 layer of sprites.
              // (note that the background does NOT count as a sprite)

transTo = -1;
scene = null;
 }
@Override public void onGameLoop() {
        // I just left some random code here otherwise it wouldn't start up.
if (transTo > -1) {
    boolean doTrans = false;
    switch (transTo) {
    case 1: // game mode
        break;
    case 2: // instructions mode
        break;
    case 4: // high scores
        break;
    }
    if (doTrans) {
        transTo = -1;
        logoSprite.hide();
    }
}
 }

@Override public void onPause() {
 }

@Override public void onResume() {
 }

@Override public void onReady() {
Textures.loadTextures();
setBackground(menuBackground = new FixedBackground(Textures.menuBackground));
 }

Any ideas? This is as basic as it gets using Rokon. Is this something the 
engine is doing or something I am leaving out?

Original comment by PPro.Gam...@gmail.com on 27 Nov 2010 at 2:07

GoogleCodeExporter commented 9 years ago
Ok so here is the problem that I am seeing after some debugging.  When I come 
back from onDestroy onResume is called.  At that point my Rokon activity has 
the same id# as it had when it first ended.  Then, for some reason, a second 
onResume is called.  That second onResume is showing that the RokonActivity's 
id has changed.  I'm assuming that means a new Rokon activity is created.  How 
am I supposed to be handling this in the onPause and onResumes of the 
individual scenes?

Original comment by PPro.Gam...@gmail.com on 28 Nov 2010 at 6:36

GoogleCodeExporter commented 9 years ago
Ignore this.  I was being stupid and wasn't reloading my textures in the 
onResume of each scene.

Original comment by PPro.Gam...@gmail.com on 2 Dec 2010 at 11:53