V8 beta

Previous topic - Next topic

Kyo

Hi,
I download the version 7.341, how to compile for iPAD ?????

In version 7.341 the Polyvector don't show, in old version work fine ...

Kitty Hello

Download the new SDK. It's V8. There's an forum thread about iPad - just search.

The GLB_ON_PAUSE is just a "trigger" function to tell you that it's going to pause now. DO NOT LOOP HERE!

You can reset a time here, or put a global gPaused% flag.
The GLB_ON_RESUME tells you that the app is about to restart. Both command happen within a SHOWSCREEN if that matters. They can be called twice, yes. Just set global flags and maybe allocat

Slydog

Does that mean your normal code keeps running after a GLB_ON_PAUSE is triggered?
(and therefore need to implement GameState logic, like GS_RUNNING = 1, GS_PAUSED = 2, etc to be called in your main loop)
Or does all your code stop until a GLB_ON_RESUME is encountered?
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

MrTAToad

The main code carries on execution

Kitty Hello

Yes. Otherwise I had no idea about when it's resuming and stuff. Windows programs always run, they just idle sometimes.

jaywat

#185
Ok. I'm a bit confused. So GLB_ON_PAUSE executes its code, then returns to your main code? But, certainly to be consistent cross platform, you should definitely not do a SHOWSCREEN anywhere (an iPhone app is killed off if it attempts to draw to screen when it doesnt have focus) ... so I'll have to implement a completely seperate 'lostfocus' routine in addition to my 'normal' pause routine, because that of course shows the 'paused-click to continue' type stuff and SHOWSCREENs.

But the thing is, in my experience, if you have ANY kind of loop WITHOUT a showscreen, that can kill your app too.... so my original question remains... what do I *do* while paused, even if I'm going to do it outside those subs, even if I want to do nothing but wait for the app to resume so I can display stuff again?

For example. Here's some really simple test code as a basic framework to include losing and regaining focus... except it crashes (app becomes non-responsive under Windows)... it never resumes from pause (and of course I can't step through it to debug!). So what should I be doing instead?

Just to clarify my point about a loop crashing if no showscreen... IF you add SHOWSCREEN to the lostFocusLoop in this code, it no longer crashes under Windows... except that's no good to me at all on an iPhone, because that WILL crash it!

Code (glbasic) Select


GLOBAL a%
GLOBAL b%
GLOBAL hasLostFocus%

mainLoop:

WHILE TRUE
IF hasLostFocus = FALSE
INC a%
PRINT a%,0,0
PRINT b%,0,20
SHOWSCREEN
ELSEIF hasLostFocus = TRUE
GOTO lostFocusLoop
ENDIF
WEND

lostFocusLoop:

WHILE hasLostFocus = TRUE
INC b%
WEND

GOTO mainLoop

SUB GLB_ON_RESUME:
hasLostFocus% = FALSE
ENDSUB

SUB GLB_ON_PAUSE:
hasLostFocus% = TRUE
ENDSUB

Kitty Hello

Ok, here's the background:

Windows programs work like:
Code (glbasic) Select

while true
    GetMessage()
    HandleMessage()
wend


Now, that does not fit into the procedural approach GLBasic has. So for your convenience I do:
Code (glbasic) Select

while true
  run, run, run
  showscreen
wend


where "showscreen" internally does:
Code (glbasic) Select

flip_backbuffer()
while(PeekMessage) {GetMessage(); HandleMessage()}


The "HandleMessage", however is where the "lost focus" hapens. There I kick-call the GLB_ON_PAUSE SUB to notify you. The game will not return from the showscreen command until it's unpaused again. (assuming AUTOPAUSE TRUE).

Did that clear things?



jaywat

#187
Quote from: Kitty Hello on 2010-Aug-25
Did that clear things?

Not really, to be honest. I may just be being thick.

Given the example I posted above, how can I make a version of that basic framework that will work on my windows machine for development that will also work on an iphone? Ie, if I'm paused, 'do nothing', when I'm resumed... resume.

Or are you saying that for the purpose of development, I now need to have evaluations and code based on platform, then strip all the windows specific stuff out for final iphone deployment?

I guess all I'm really asking for is a working cross platform example of how to use these subs. Because everything I've tried so far just crashes.

Kitty Hello

Like this?
Code (glbasic) Select

GLOBAL gPause=FALSE

game:
if gPause
   DisplayPauseMessage();
   showscreen
   keywait
else
   UpdateGame()
   DrawGame()
   showscreen
endif
GOTO game

SUB GLB_ON_PAUSE:
gPause=TRUE
MUSICVOLUME 0
ENDSUB

SUB GLB_ON_RESUME:
MUSICVOLUME 1
ENDSUB



jaywat

#189
Well, yes, except that doesnt work on a multi-tasking iPhone. Just tried it. It doesn't display the contents of my DisplayPauseMessage(), or wait for the keywait/mousewait, and the program executes from the beginning again (I just increment a variable and printed it, so it's pretty obvious to see if it continues from where it left off on resume or whether it restarts the whole app).

Which is pretty much what the symptoms were before GLB_ON_RESUME and GLB_ON_PAUSE were implemented.

Oh, and still gives the same 'Background GPU access not permitted' error if connected to xcode debugger.

EDIT: oh wait. that's because on the iPhone you HAVE to have AUTOPAUSE TRUE set for it to work, whereas on the PC, it works exactly the same without AUTOPAUSE set as it does with

EDIT2: Oh. No, still doesn't work. I'm not even going to try and describe the symptoms because it's different every time I run it. But most of the time, the app still crashes out completely per my original bug report

Kitty Hello

Do you have an 3GS or iPhone4? The others don't support multitasking.

jaywat

#191
We're testing on a 3rd gen iPod Touch 32gb but also have access to an iPhone 3GS. If it didn't support multi-tasking, we couldnt be testing putting apps to the multi-task bar and resuming them!

namco

Quote
You can't update from v7.XXX to the new v8.XXX via the usual "INTERNET UPDATE" method - GLBasic produces an error message and bugs out (on Windows 7 anyway). Looking at the site's log file, versi 8.050 was non-beta and it's been updated a couple of times since. The new download is available here - http://www.glbasic.com/main.php?lang=en&site=download It states that it's v7, but it is actually v8.

Yeah I get the same problem in XP. It says something about the updater program terminating in an unusual way and seems to be tied to the mscrvt8.dll (I think).

I'm just going to back up the glbasic game source files, uninstall the old ver and install v8

Kitty Hello

That's the way to go. You can't live-update Version X to version Y. There's new compilers and stuff included.

MrTAToad

Dont forget to update the text on http://www.glbasic.com/main.php?lang=en&site=download - it still mentions V7 :)