Function renames

This commit is contained in:
Matthias Richter 2010-09-15 11:15:23 +02:00
parent ded2110ab3
commit cfd4cfb28e

View File

@ -17,7 +17,7 @@ function camera:translate(t)
self.pos = self.pos + t self.pos = self.pos + t
end end
function camera:apply() function camera:predraw()
local center = vector(love.graphics.getWidth(), love.graphics.getHeight()) / (self.zoom * 2) local center = vector(love.graphics.getWidth(), love.graphics.getHeight()) / (self.zoom * 2)
love.graphics.push() love.graphics.push()
love.graphics.scale(self.zoom) love.graphics.scale(self.zoom)
@ -26,17 +26,17 @@ function camera:apply()
love.graphics.translate((-self.pos):unpack()) love.graphics.translate((-self.pos):unpack())
end end
function camera:deapply() function camera:postdraw()
love.graphics.pop() love.graphics.pop()
end end
function camera:draw(func) function camera:draw(func)
self:apply() self:predraw()
func() func()
self:deapply() self:postdraw()
end end
function camera:transform(p) function camera:toCameraCoords(p)
local w,h = love.graphics.getWidth(), love.graphics.getHeight() local w,h = love.graphics.getWidth(), love.graphics.getHeight()
p = vector((p.x-w/2) / self.zoom, (p.y-w/2) / self.zoom):rotate_inplace(-self.rot) p = vector((p.x-w/2) / self.zoom, (p.y-w/2) / self.zoom):rotate_inplace(-self.rot)
return p + self.pos return p + self.pos