Schlagwort-Archive: monkey

Monkey: basic app structure

 

Strict

Import mojo

Function Main:Int()
  New MyGame()
  Return 0
End Function

Class MyGame Extends App

  'Called once, do your initialization here!
  Method OnCreate:Int()
    SetUpdateRate(30)
    Return 0
  End Method

  'Called 30 times per second (normally)
  Method OnUpdate:Int()
    Return 0
  End Method

  'This is called when the user pressed the home button!
  Method OnSuspend:Int()
    Return 0
  End Method

  'This is called when the user switches back to your app and it's still alive!
  Method OnResume:Int()
    Return 0
  End Method

  'This is called when something is rendered to the screen
  Method OnRender:Int()
    Cls()
    DrawText( "Hello there", 10, 10 )
    Return 0
  End Method

  'This is called when the back button was pressed!
  Method OnBack:Int()
    'Ok, just exit the app for test purposes!
    EndApp()
    Return 0
  End Method
End Class