-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcameratool.lua
More file actions
70 lines (61 loc) · 1.68 KB
/
Copy pathcameratool.lua
File metadata and controls
70 lines (61 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
local gr = love.graphics
local inspect = require "inspect"
local cam
local scale = require "scale"
local scalePoints2M = scale.points2M
local scalePoints2PIX = scale.points2PIX
local M2PIX = scale.M2PIX
local PIX2M = scale.PIX2M
function init(currentScene)
--print("cam", currentScene.cam)
--print("pworld", pworld)
--print("currentScene", inspect(currentScene))
if currentScene then
cam = currentScene.cam
end
end
function drawCameraInfo()
imgui.Begin("camera", true, "ImGuiWindowFlags_AlwaysAutoResize")
if cam then
imgui.LabelText("x, y", string.format("%f, %f", cam.x, cam.y))
imgui.LabelText("rot", string.format("%f", cam.rot))
imgui.LabelText("scale", string.format("%f", cam.scale))
end
if imgui.Button("reset scale") and cam then
cam.scale = 1
end
imgui.End()
gr.setColor{1, 1, 1, 1}
end
local function update()
--[[
[ local isDown = love.keyboard.isDown
[ if cam then
[ local camSpeed = 25 / cam.scale
[
[ if isDown("lshift") then
[ if isDown("left") then
[ cam:move(-camSpeed, 0)
[ elseif isDown("up") then
[ cam:move(0, -camSpeed)
[ elseif isDown("right") then
[ cam:move(camSpeed, 0)
[ elseif isDown("down") then
[ cam:move(0, camSpeed)
[ end
[ end
[
[ if isDown("z") then
[ cam:zoom(1.01)
[ elseif isDown("x") then
[ cam:zoom(0.99)
[ end
[ end
]]
end
return {
init = init,
draw = drawCameraInfo,
update = update,
mousemoved = mousemoved,
}