mirror of
https://github.com/vrld/hump.git
synced 2024-11-23 12:24:19 +00:00
Function renames
This commit is contained in:
parent
ded2110ab3
commit
cfd4cfb28e
10
camera.lua
10
camera.lua
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user