Fixed some little errors with the drawing functions.
[luagame.git] / base / Circle.lua
blob75404cdc0e2a6cefc4784b371ce6b2db7b373919
1 --the Circle class
3 Circle = Object:new()
5 Circle.type = "Circle"
6 Circle.radius = 0
7 Circle.r = 0
8 Circle.g = 0
9 Circle.b = 0
10 Circle.a = 255
11 Circle.style = "outline" --can be "outline", "filled", or "both"
12 Circle.fcolor = false --set to true to have the filled circle use a different color
13 Circle.fr = 0
14 Circle.fg = 0
15 Circle.fb = 0
16 Circle.fa = 255
19 function Circle:new(o)
20 o = o or {}
21 setmetatable(o, self)
22 self.__index = self
23 return o
24 end
26 --updates the object's state
27 function Circle:update(delta)
28 Object.update(self, delta)
29 end
31 --default draw routine
32 function Circle:draw()
33 if(self.style == "filled" or self.style == "both") then
34 if(self.fcolor == true) then
35 draw_filled_circle(self.x, self.y, self.radius, self.fr, self.fg, self.fb, self.fa, self.rotation, self.scale_x, self.scale_y)
36 else
37 draw_filled_circle(self.x, self.y, self.radius, self.r, self.g, self.b, self.a, self.rotation, self.scale_x, self.scale_y)
38 end
39 end
41 if(self.style == "outline" or self.style == "both") then
42 draw_circle(self.x, self.y, self.radius, self.r, self.g, self.b, self.a, self.rotation, self.scale_x, self.scale_y)
43 end
44 end
46 --there is no predefined collision behavior
47 -- "ids" is the list of Rect ids that have been collided with
48 -- "type" is the type of the Object that is colliding
49 function Circle:collide(type, ids)
51 end