1pushbutton = class:new()
2
3function pushbutton:init(x, y, dir)
4	self.cox = x
5	self.coy = y
6	self.dir = dir
7
8	self.out = false
9	self.outtable = {}
10
11	adduserect(x-10/16, y-12/16, 4/16, 12/16, self)
12
13	self.timer = pushbuttontime
14end
15
16function pushbutton:update(dt)
17	if self.timer < pushbuttontime then
18		self.timer = self.timer + dt
19		if self.timer >= pushbuttontime then
20			self.pusheddown = false
21			self.timer = pushbuttontime
22		end
23	end
24end
25
26function pushbutton:draw()
27	local quad = 1
28	if self.pusheddown then
29		quad = 2
30	end
31
32	local horscale = scale
33	if self.dir == "right" then
34		horscale = -scale
35	end
36
37	love.graphics.drawq(pushbuttonimg, pushbuttonquad[quad], math.floor((self.cox-0.5-xscroll)*16*scale), (self.coy-1.5)*16*scale, 0, horscale, scale, 8)
38end
39
40function pushbutton:addoutput(a)
41	table.insert(self.outtable, a)
42end
43
44function pushbutton:used()
45	if self.timer == pushbuttontime then
46		self.pusheddown = true
47		self.timer = 0
48		for i = 1, #self.outtable do
49			if self.outtable[i].input then
50				self.outtable[i]:input("toggle")
51			end
52		end
53	end
54end