Apple iOS 4.X

Previous topic - Next topic

ggindlesperger

If this has been answered before I appologize. I have read over various posts and am unsure of where GLBasic stands with iOS4. I read that the Pause and Resume functions fixed it, but then I believe I read somewhere other issues cropped up. I have been compiling on iOS4 for a few weeks and I have been using the UIApplicationOnExitSuspend to disable multitasking and I get mixed results. Sometimes when you start the App back up it just hangs at a blankscreen. Last time I tried using Pause and Resume I always crashed, BUT then I was probably doing something wrong.

I would like to hear from someone who is better at this than me say if it is working good or not yet.

Thanks so much

Kitty Hello

Hm. I don't have a device that supports MT, yet. But I think it was all fixed.

ggindlesperger

Thanks for the reply Kitty....I am having no luck though. Maybe I just do not know what I should have it do at the Pause and Resume functions. I have a 32 gig iPod and quite a few iPhone 4's of some friends that I have been installing on and either the App will not start back up and go right back to home or I get a black screen.

Can anyone provide some info on what I want to happen at the pause and resume? I tried just doing something simple like mousewait when it was paused, but that did not work. Is there anything else I need to include in the program to make the new routines work? To this point I have been doing what Kitty has in the help files about disabling multitask. This way it does not crash, but starts over after every interruption. I am just afraid in the near future, if not already, Apps will not be accepted like that.

Thanks so much,

MrTAToad

What is generally advised is that when ON_PAUSE/ON_RESUME, you set a flag that your current main loop will respond to, usually doing nothing much.

This is because ON_PAUSE/ON_RESUME should do as little as possible.

For example :

Code (glbasic) Select
ALLOWESCAPE FALSE // if you don't do that, "the button" will exit your app right away.

WHILE TRUE
// doing some opengl drawings (that's the code for testing landscape grabsprite)
STARTPOLY -1,0
POLYVECTOR 0,0,0,0,0x0000ff
POLYVECTOR 0,480,0,0,0x00ffff
POLYVECTOR 640,480,0,0,0x00ff00
POLYVECTOR 640,0,0,0,0xff0000
ENDPOLY

DRAWRECT 100,50, 100,50,0xffffff
DRAWRECT 101,51,98,48,0x000000
DRAWLINE 102,50,130,50,0xcc00cc
PRINT "ABC", 101,51

DRAWRECT 300,50, 79,37,0x0000ff

GRABSPRITE 1, 100,50, 77,35
DRAWSPRITE 1, 301,51


STARTPOLY 1, 0
POLYVECTOR 0,0,0,0,0xffffff
POLYVECTOR 0,64,0,64,0xffffff
POLYVECTOR 128,64,128,64,0xffffff
POLYVECTOR 128,0,128,0,0xffffff
ENDPOLY

LOCAL cx%, cy%
GETSCREENSIZE cx%, cy%
PRINT "screen: "+cx+" x "+cy, 0,300

SHOWSCREEN
WEND

// you get this when you get a call or multitasking switches you awa
// DO SAVE HERE. You will not get an GLB_ON_QUIT in iOS4!
// Maybe if you hog too much memory, but I'm uncertain.
SUB GLB_ON_PAUSE:
STDOUT "on pause\n"
ENDSUB

// you get that when you see you game again after the interruption
SUB GLB_ON_RESUME:
STDOUT "on resume\n"
ENDSUB

// That's (I think) only called on iOS3, and maybe on an
// applicationDidReceiveMemoryWarning()
SUB GLB_ON_QUIT:
STDOUT "on quit\n"
ENDSUB

ggindlesperger

Thank you for the help...I got it working and it seems to work great. I can hit the home button and go back right to where it left off.

I saw Kitty's snippet of code before, but my problem was I was trying my own little thing on pause and resume. I was trying to get it to switch to a pause screen and that was my problem.
I used the stdout function and it works fine.