Monday, July 18, 2016

Monkey-X - Beginners - SetScissor - code example

Import mojo

Class MyGame Extends App

    Method OnCreate()
    End Method
    Method OnUpdate()        
    End Method
    Method OnRender()
        Cls 0,0,0 
        SetColor 255,255,255
        DrawText "SetScissor Example (x,y,w,h)",10,10
        ' SetScissor x,y,w,h
        ' Here we draw a image on the entire screen
        ' and that will only be drawn inside the 
        ' scissor area.
        SetColor 50,20,0
        Local cx:Float=320
           Local cy:Float=240
        For Local angle=0 Until 360-10 Step 32
            Local x1:Float=cx+Cos(angle)*640
            Local y1:Float=cy+Sin(angle)*480
            Local x2:Float=cx+Cos(angle+10)*640
            Local y2:Float=cy+Sin(angle+10)*480
    End Method
End Class

Function Main()
    New MyGame()
End function

No comments:

Post a Comment