• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android Surface image gets glitchy when phone resumes from sleep mode

Misu

The forum's immigrant
Not sure if this is the best place to ask but im having technical issues with my surface. I can run and draw my surface perfectly but whenever my phone resumes after being in sleep mode from during my app session (or even when I leave the app and resume back when multitasking) the surface colors alter in a glitchy (bad) way. Its a weird mixture of white and black going on to it. Is there a way to fix this problem or avoid it?
 

Misu

The forum's immigrant
Do you clear the surface before you use it?
There is one thing though... I need to draw my surface without clearing it. Im reapplying the same surface over itself continously, adding updates to it.

Also can you move this to the 1.4 subforum please. I accidentally posted this on the 2.0 by mistake. :)
 

ParodyKnaveBob

The Laughing Rogue
Surfaces are volatile. I understand your usage, but perhaps when you *know* you'll have an interruption (via os_is_paused() mainly) you might do a quick save of that surface to a sprite or background (or buffer? .. I still haven't actually looked at buffers, thus don't know what/how all you can do there).

I hope this helps,
Bob $:^ J
 

Misu

The forum's immigrant
Surfaces are volatile. I understand your usage, but perhaps when you *know* you'll have an interruption (via os_is_paused() mainly) you might do a quick save of that surface to a sprite or background (or buffer? .. I still haven't actually looked at buffers, thus don't know what/how all you can do there).

I hope this helps,
Bob $:^ J
Hey thanks. I actually do know how to use buffers and was actually thinking of saving the color map (surface image) into a buffer when the phone goes off but didnt knew how to detect when it idles out. Now that I know about os_is_paused, i can try this out. Much thanks :)
 

Mike

nobody important
GMC Elder
This has now been checked on a couple of Android devices, and it's working as expected - no changes or fixes are required. (This is for GMS2)
Any issues remaining therefore will be Android specific driver issues.


Pausing the app (with the task manager)
Putting the app into the background then back again
Incoming call
Switching the device into sleep mode (power button sleep - then back on)

All these result in a "surface lost". The code below works as expected

Code:
// Creation code
mysurf = -1;

// Draw code
if( !surface_exists(mysurf) ){
    mysurf = surface_create(64,64);
    surface_set_target(mysurf);
    draw_clear_alpha(0,0);

    // draw surface

    surface_reset_target();
}
 

T-bond

Member
Thank you. I will buy the mobile module for the 2.0 too in the following months, and will test it. :)
 
Top