Can expand and reduce canvass with lctrl and lshift. (Bug: all tiles get erased :c)

This commit is contained in:
lustlion
2022-01-31 01:22:15 +01:00
parent 727592ac55
commit e1bfd4f7f5
3 changed files with 106 additions and 18 deletions

View File

@@ -115,34 +115,35 @@ function EditorDoEdit()
and LevelTiles[vertical][horizontal] ~= nil
and love.keyboard.isDown("lshift") ~= true
and love.keyboard.isDown("lctrl") ~= true
and selecting_tile ~= nil
then
if Keybind:CheckDown(Keybind.generic.lclick) then
InstanceTile(vertical,horizontal,selecting_tile)
if Keybind:CheckDown(Keybind.generic.lclick)
and selecting_tile ~= nil
then
SetTile(vertical,horizontal,selecting_tile)
elseif Keybind:CheckDown(Keybind.generic.rclick) then
InstanceTile(vertical,horizontal,0)
SetTile(vertical,horizontal,0)
end
LevelReloadTiles()
--[[
elseif love.keyboard.isDown("lshift") then
--ExpandCanvas(math.sign(expand_h),math.sign(expand_v))
elseif Keybind:HasPressed(Keybind.generic.lshift) then
LevelExpandCanvas(math.sign(expand_h),math.sign(expand_v))
if expand_h < 0 then
Camera.pos.x = Camera.pos.x - expand_h*tileProperties.scale*tileProperties.width
Camera.pos.x = Camera.pos.x - math.sign(expand_h)*tileProperties.scale*tileProperties.width
end
if expand_v < 0 then
Camera.pos.y = Camera.pos.y - expand_v*tileProperties.scale*tileProperties.height
Camera.pos.y = Camera.pos.y - math.sign(expand_v)*tileProperties.scale*tileProperties.height
end
elseif love.keyboard.isDown("lctrl") then
--ReduceCanvas(math.sign(expand_h),math.sign(expand_v))
elseif Keybind:HasPressed(Keybind.generic.lctrl) then
LevelReduceCanvas(math.sign(expand_h),math.sign(expand_v))
if expand_h < 0 then
Camera.pos.x = Camera.pos.x - expand_h*tileProperties.scale*tileProperties.width
Camera.pos.x = Camera.pos.x - math.sign(expand_h)*tileProperties.scale*tileProperties.width
end
if expand_v < 0 then
Camera.pos.y = Camera.pos.y - expand_v*tileProperties.scale*tileProperties.height
end]]
Camera.pos.y = Camera.pos.y - math.sign(expand_v)*tileProperties.scale*tileProperties.height
end
end
end
end