A level editor for my unnamed-platformer project. https://gitea.planet-casio.com/KikooDX/unnamed-platformer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
up-editor/keyboard.lua

79 lines
2.0 KiB

function update_keyboard()
--get keys inputs
--change screen
local buffer = k_q
k_q = love.keyboard.isScancodeDown("a")
if k_q and not buffer and screen_id%100 > 0 then
save()
screen_id = screen_id - 1
load()
end
local buffer = k_d
k_d = love.keyboard.isScancodeDown("d")
if k_d and not buffer and screen_id%100 < 99 then
save()
screen_id = screen_id + 1
load()
end
local buffer = k_z
k_z = love.keyboard.isScancodeDown("w")
if k_z and not buffer and screen_id > 99 then
save()
screen_id = screen_id - 100
load()
end
local buffer = k_s
k_s = love.keyboard.isScancodeDown("s")
if k_s and not buffer and screen_id < 9900 then
save()
screen_id = screen_id + 100
load()
end
local buffer = k_i
k_i = love.keyboard.isScancodeDown("i")
if k_i and not buffer then
save()
screen_id = 5050
load()
end
--swap selected object
local buffer = k_tab
k_tab = love.keyboard.isScancodeDown("tab")
if k_tab and not buffer then
if love.keyboard.isDown("lshift") then
selected_tile = selected_tile - 1
if selected_tile == 0 then selected_tile = #tiles end
else selected_tile = selected_tile + 1
if selected_tile > #tiles then selected_tile = 1 end
end
end
--exit
if love.keyboard.isScancodeDown("escape") then
save()
love.event.quit()
end
--saving/export
local buffer = k_c
k_c = love.keyboard.isDown("c")
if k_c and not buffer then
save()
end
local buffer = k_o
k_o = love.keyboard.isDown("o")
if k_o and not buffer then
load()
end
--scaling
local buffer = k_k
k_k = love.keyboard.isDown("k")
if k_k and not buffer and scale > 1 then
scale = scale - 1
love.window.setMode(GAME_WIDTH * scale, GAME_HEIGHT * scale, flags)
end
local buffer = k_l
k_l = love.keyboard.isDown("l")
if k_l and not buffer and scale < 8 then
scale = scale + 1
love.window.setMode(GAME_WIDTH * scale, GAME_HEIGHT * scale, flags)
end
end