mirror of
https://github.com/vrld/hump.git
synced 2024-11-23 12:24:19 +00:00
Function rename
This commit is contained in:
parent
1f69ddb249
commit
b8dc9b6592
@ -36,18 +36,18 @@ function camera:draw(func)
|
||||
self:postdraw()
|
||||
end
|
||||
|
||||
function camera:toScreenCoords(p)
|
||||
function camera:toCameraCoords(p)
|
||||
local w,h = love.graphics.getWidth(), love.graphics.getHeight()
|
||||
local p = p - self.pos
|
||||
return vector((p.x+w/2) * self.zoom, (p.y+h/2) / self.zoom):rotate_inplace(self.rot)
|
||||
end
|
||||
|
||||
function camera:toCameraCoords(p)
|
||||
function camera:toWorldCoords(p)
|
||||
local w,h = love.graphics.getWidth(), love.graphics.getHeight()
|
||||
p = vector((p.x-w/2) / self.zoom, (p.y-h/2) / self.zoom):rotate_inplace(-self.rot)
|
||||
return p + self.pos
|
||||
end
|
||||
|
||||
function camera:mousepos()
|
||||
return self:toCameraCoords(vector(love.mouse.getPosition()))
|
||||
return self:toWorldCoords(vector(love.mouse.getPosition()))
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user