Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

Mojo App

nitrologic edited this page Mar 30, 2013 · 9 revisions

If you are building an app in Monkey you can begin by extending the mojo App Class.

For starters, read the monkey manual entry on mojo, if you get to this bit, you are on the right page:

Mojo functions should not be called until your application's OnCreate method is called. This means you cannot initialize global variables with values returned by mojo functions such as MilliSecs - you must instead initialize such variables in your application's OnCreate method or later.

The following app will verify that Monkey is configured to work on the platform you are targetting and that the logging command Print produces visible output:

	Import mojo
	
	Class MyApp Extends App
	
		Method OnCreate()
			Print Millisecs
		End		
	End
	
	Function Main()
		New MyApp
	End

The three primary methods of the App class come with caveats:

OnCreate

Do

  • Call SetUpdateRate 60 so your game will refresh

Don't

  • Draw anything

OnUpdate

Do

  • Update user input

Don't

  • Draw anything

OnRender

Do

  • Draw to the display

Don't

  • Do evil
Clone this wiki locally