Game Development Reference
In-Depth Information
prop = MOAIProp2D.new ()
prop:setDeck ( scriptDeck )
layer:insertProp ( prop )
Drawing Filled Rectangles
You can use the function MOAIDraw.fillRect(x1, y1, x2, y2) to draw a filled rectangle. This
function takes four parameters, similar to the drawRect function. The fill color is set using the
MOAIGfxDevice.setPenColor function. The code draws a filled rectangle on the screen as seen in
Figure 10-4 below.
Figure 10-4. Drawing a rectangle with a fill color and no stroke
MOAISim.openWindow ( "test", 320, 480 )
viewport = MOAIViewport.new ()
viewport:setSize ( 320, 480 )
viewport:setScale ( 320, -480 )
layer = MOAILayer2D.new ()
layer:setViewport ( viewport )
MOAISim.pushRenderPass ( layer )
 
Search WWH ::




Custom Search