; CreateBrush Example ; ------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,45,45,0 ; A crate to paint. A brush is a 'paint recipe' - colour, alpha, texture ; and so on - which is applied to entities with PaintEntity. crate=CreateCube() PositionEntity crate,0,0,5 SeedRnd MilliSecs() ; Create a brush with an initial colour (the r,g,b arguments are optional) brush=CreateBrush(0,120,255) PaintEntity crate,brush While Not KeyDown(1) ; Space creates a fresh brush with a random colour and repaints the crate If KeyHit(57) FreeBrush brush brush=CreateBrush(Rand(0,255),Rand(0,255),Rand(0,255)) PaintEntity crate,brush EndIf TurnEntity crate,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"Space: paint with a new random brush Arrows: camera Esc: exit" Flip Wend End