Finished ParticleSystem and delta-animation support.
[luagame.git] / base / Ellipse.lua
blobd75dfa8f487d9dc1c663ca3bd3bf5e53b62b978e
1 --the Ellipse class
3 Ellipse = Object:new()
5 Ellipse.type = "Ellipse"
6 Ellipse.radius_x = 0
7 Ellipse.radius_y = 0
8 Ellipse.r = 0
9 Ellipse.g = 0
10 Ellipse.b = 0
11 Ellipse.a = 255
12 Ellipse.style = "outline" --can be "outline", "filled", or "both"
13 Ellipse.fcolor = false --set to true to have the filled circle use a different color
14 Ellipse.fr = 0
15 Ellipse.fg = 0
16 Ellipse.fb = 0
17 Ellipse.fa = 255
20 function Ellipse:new(o)
21 o = o or {}
22 setmetatable(o, self)
23 self.__index = self
24 return o
25 end
27 --updates the object's state
28 function Ellipse:update(delta)
29 Object.update(self, delta)
30 end
32 --default draw routine
33 function Ellipse:draw()
34 if(self.style == "filled" or self.style == "both") then
35 if(self.fcolor == true) then
36 draw_filled_ellipse(self.x,self.y,self.radius_x,self.radius_y,self.fr,self.fg,self.fb,self.fa)
37 else
38 draw_filled_ellipse(self.x,self.y,self.radius_x,self.radius_y,self.r,self.g,self.b,self.a)
39 end
40 end
42 if(self.style == "outline" or self.style == "both") then
43 draw_ellipse(self.x,self.y,self.radius_x,self.radius_y,self.r,self.g,self.b,self.a)
44 end
45 end
47 --there is no predefined collision behavior
48 -- "ids" is the list of Rect ids that have been collided with
49 -- "type" is the type of the Object that is colliding
50 function Ellipse:collide(type, ids)
52 end