Wednesday, December 24, 2014

Monkey - Drawing a rectangle below the mouse pointer code example.


The code below shows you how to draw a rectangle below the mouse. MouseX and MouseY is used for this.

Code below :

Import mojo

Class MyGame Extends App
    Method OnCreate()
        SetUpdateRate(60)
    End
    Method OnUpdate()
    End
    Method OnRender()
        Cls(0,0,0)
        SetColor(255,255,255)
        DrawRect(MouseX(),MouseY(),16,16)
        DrawText("Move the mouse across the window.",10,10)
    End
End

Function Main()
    New MyGame()
End

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.