// Project Example: GetResumed()
// Created: 2015-01-19
//Single sprite moves around the screen
//Put App into background,
//in Windows try minimising the window.
//When you bring App back to foreground
//a simple pause menu is displayed.
Setvirtualresolution(640,480)
SetOrientationAllowed( 0, 0, 1, 1 )
ResetTimer()
//Create a Green Cross Image
swap()
Drawline(0,0,30,30,0,255,0)
Update(0)
Render()
Drawline(0,30,30,0,0,255,0)
Update(0)
Render()
GetImage(1,0,0,30,30)
SetClearColor(50,50,100)
//Create Sprte using Green Cross Image
id=CreateSprite(1)
//Create a App paused menu button
AddVirtualButton(1,320,240,120)
SetVirtualButtonText(1,"App"+Chr(10)+"Paused")
//Hide the App Paused button
SetVirtualButtonVisible(1,0)
//Add a quit button.
AddVirtualButton(2,600,440,40)
SetVirtualButtonText(2,"Quit")
speed=8
play=1
Do
//If App is playing, move the sprite once every 5 loops
If speed=8 AND play=1 Then SetSpritePosition(id,Random(0,640),Random(0,480))
//If App comes back from background, pause the App
If GetResumed() OR play=0
play=0
//Show the pause menu
SetVirtualButtonVisible(1,1)
If GetVirtualButtonPressed(1)
//Resart the App and hide the pause menu
play=1
SetVirtualButtonVisible(1,0)
EndIf
EndIf
Sync()
If GetVirtualButtonPressed(2) Then Exit
//Do Loop speed control
Dec speed
If speed<1 Then speed=8
Loop
End
Help make AGK better by submitting an example for this command! (All examples are subject to approval)