Monkey
Store
Community
Apps
Contact
Login or Signup

Code with several draw loops - structure?

Monkey Programming Forums/Monkey Programming/Code with several draw loops - structure?

GfK(Posted 1+ years ago) 
I have a bunch of classes, for example; frontend, intro, game, etc. Each of these classes has its own loop for drawing, updating and timing (its Blitzmax code). Here's a little example (that obviously doesn't work) to explain what I mean. How do I restructure this code for Monkey?:
Import mojo

Function Main()
	New myApp
End Function

Class myApp extends App
	Field frontEnd:cFrontEnd
        Field game:cGame
	Method OnCreate()
		Self.frontEnd = New cFrontEnd
		Self.frontEnd.Play()
	End Method
End Class

Class cFrontEnd
	Method Play()
		Repeat
			Self.UpdateLogic()
			Self.DrawScreen()
		Forever
	End Method
	
	Method UpdateLogic()
	End Method

	Method DrawScreen()
		Cls
		DrawText "Front End",50,50
	End Method

Class cGame
	Method Play()
		Repeat
			Self.UpdateLogic()
			Self.DrawScreen()
		Forever
	End Method
	
	Method UpdateLogic()
	End Method

	Method DrawScreen()
		Cls
		DrawText "Game",50,50
	End Method
End Class