Game Development Reference
In-Depth Information
Figure 9-12. Text displayed in the Gideros Player with modified text color
Drawing Shapes
Gideros Studio also has a Shape object, which you might use when you want to create vector
shapes like lines, rectangles, and so on. Drawing shapes in Gideros is based on the same principles
as drawing on a deviceContext in many other languages. This section will help you get started by
describing how to create lines and rectangles, as well as how to fill shapes.
Lines
Lines are the simplest shapes to draw. A line is basically defined as four points: a starting x,y-coordinate
and an ending x,y-coordinate. The line joins these two points.
function newLine(x1, y1, x2, y2)
local obj = Shape.new()
obj:setLineStyle(2, 0x000000)
obj:beginPath()
obj:moveTo(x1, y1)
obj:lineTo(x2, y2)
obj:endPath()
stage:addChild(obj)
return obj
end
 
Search WWH ::




Custom Search