Can't run very basic code - bbgamedelegate?

Monkey Forums/Monkey Programming/Can't run very basic code - bbgamedelegate?

John Galt(Posted 2013) [#1]
I'm trying to run a very basic mojo app- here in its entirety...

Import mojo.app
Import mojo.graphics

Class Game Extends App
    Method OnRender()
        DrawText "Hello World!",0,0 'hello
    End
End

Function Main()
	New Game
End

Monkey falls over in mojo.app complaining "app.monkey<30> : Error : Type 'BBGameDelegate' not found"

Any ideas?


John Galt(Posted 2013) [#2]
Never mind- I had C++ tool as target.


Midimaster(Posted 2013) [#3]
First delete the build folder of this project....

Then add some minimum requirements. I would suggest to always start form this minimum code:
Strict
Import mojo

Class Game Extends App

	Method OnCreate%()
		SetUpdateRate 60	
		Return 0
	End	


	Method OnUpdate%()
		If KeyHit(KEY_ESCAPE) Then Error ""
		Return 0
	End	


	Method OnRender%()
   		DrawText "Hello World!",0,0 
   		Return 0
	End	
	
End



Function Main%()
	New Game
	Return 0
End


Strict! Return Values! And SetUpdateRate()!!!

There is no OnRender() without a valid UpdateRate...


John Galt(Posted 2013) [#4]
Thanks, Midi. The code I posted was pretty verbatim from Monkey documentation, but you're right, it's missing a few basic bits.