what is Cls mean?

Monkey Forums/Monkey Beginners/what is Cls mean?

luren(Posted 2016) [#1]
I am new to monkey x
I am learning its language and that cls(under OnRender ()) shows up every examples but I cannot find any useful information about what it really mean...


Pakz(Posted 2016) [#2]
Cls means, clear the sceen.

It basically draws a rectangle on the entire screen thus erasing everything on it,


dawlane(Posted 2016) [#3]
Monkey X has its origins in the Beginners All purpose Symbolic Instruction Code (BASIC) and has a few keywords that would still be recognised from over 50 years ago.
Cls is an acronym for CLear the Screen. But when SetScissor is set. Then only that part of the screen defined by the SetScissor command is cleared.
The usage in MonkeyX is:
Cls
Cls(R,G,B)

Where RGB are colour intensity of Red, Green, Blue in the range of 0-255.
Use of Cls without any RGB values defaults to black. R=0,G=0,B=0

Strict
Import mojo

Class CGame Extends App
	Field c:Int
	Field d:Int=1
	Method OnCreate:Int()
		SetUpdateRate(60)
		Return 0
	End Method
	Method OnUpdate:Int()
		Return 0
	End Method
	Method OnRender:Int()
		SetColor(Rnd(255),Rnd(255),Rnd(255))
		SetAlpha(Rnd(1.0))
		DrawRect(Rnd(640),Rnd(480),Rnd(100),Rnd(100))
		FastCircle(Rnd(640),Rnd(480),Rnd(100))
		SetScissor(50,50,DeviceWidth()-100,DeviceHeight()-100)
		If (Millisecs()/1000) Mod 60
			Cls(0,c,c)
			c+=d
			If c>255 Then d=-1
			If c<0 Then d=1
		Else
			Cls
		EndIf
		Return 0
	End Method
End Class

Function FastCircle:Void(xc:Float,yc:Float,r:Float)
	Local x:Float=r,y:Float=0,cd2:Float=0
	If Not r Return
	DrawPoint(xc-r,yc)
	DrawPoint(xc+r,yc)
	DrawPoint(xc,yc-r)
	DrawPoint(xc,yc+r)
	
	While (x>y)
		x-=1
		y+=1
		cd2-=(x-y)
		If cd2<0
			x+=1
			cd2+=x
		Endif
		DrawPoint(xc-x,yc-y)
		DrawPoint(xc-y,yc-x)
		DrawPoint(xc+y,yc-x)
		DrawPoint(xc+x,yc-y)
		DrawPoint(xc-x,yc+y)
		DrawPoint(xc-y,yc+x)
		DrawPoint(xc+y,yc+x)
		DrawPoint(xc+x,yc+y)		
	Wend
End Function