how to "pause" my app?

Previous topic - Next topic

Jonás Perusquía

Hi, i come again to ask you how to pause an App for example, you are playing and you have to stop, so you just click on an icon and the game becomes paused, then if you want to unpause it, just click same icon...

i have tried with SLEEP and HIBERNATE commands but none seems to work as i would like...

Would sub GLB_ON_PAUSE work?
any help? thanks in advance

Code (glbasic) Select
TYPE _pause
a
    FUNCTION pause:
      AUTOPAUSE self.a
    ENDFUNCTION

ENDTYPE

GLOBAL pauses[] AS _pause;
GLOBAL pausegame AS _pause;

WHILE TRUE
IF KEY(57) = 1; DIMPUSH pauses[],pausegame; ENDIF
FOR contadorPauses=0 TO LEN(pauses[])-1
  IF contadorPauses>0
     pauses[contadorPauses].a=.5
     pauses[contadorPauses].pause()
     IF KEY(57) = 1
     pauses[contadorPauses].a=60
     DIMDEL pauses[],contadorPauses
     ENDIF
     ENDIF
     NEXT
WEND
<HTML><BASIC><EC>
Be free and do good things

matchy

 ::) I think it's like...:
Code (glbasic) Select

TYPE _app
pause = 0
exit = 0
ENDTYPE
GLOBAL app as _app

loop()

SUB loop:
AUTOPAUSE TRUE
WHILE app.exit = 0
  IF app.pause = 0
  // do main
  ENDIF
WEND
ENDSUB

// these are called internally
SUB GLB_ON_PAUSE:
app.paused = 1
ENDFUNCTION

SUB GLB_ON_RESUME:
app.paused = 0
ENDFUNCTION

SUB GLB_ON_QUIT:
END
ENDFUNCTION