Monkey: minimum base script for the diddy framework

Strict

Import mojo
Import diddy

Global titleScreen:TitleScreen

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

Class MyGame Extends DiddyApp
        Method OnCreate:Int()
                Super.OnCreate()
                titleScreen = New TitleScreen
                titleScreen.PreStart()
                Return 0
        End
End

Class TitleScreen Extends Screen
        Method New()
                name = "Title"
        End

        Method Start:Void()
                game.screenFade.Start(50, false)
        End

        Method Render:Void()
                Cls
                DrawText "TITLE SCREEN!", SCREEN_WIDTH2, SCREEN_HEIGHT2, 0.5, 0.5
                DrawText "Click to Play!", SCREEN_WIDTH2, SCREEN_HEIGHT2 + 20, 0.5, 0.5
                DrawText "Escape to Quit!", SCREEN_WIDTH2, SCREEN_HEIGHT2 + 40, 0.5, 0.5
        End

        Method Update:Void()
                If KeyHit(KEY_ESCAPE)
                        game.screenFade.Start(50, true)
                        game.nextScreen = game.exitScreen
                End
        End
End