ComputerCraft/MusicPlayer/Client/touch_processing.lua
2024-03-10 23:45:44 +03:00

59 lines
No EOL
1.9 KiB
Lua

local touch_processer = {}
touch_processer.init = function ()
local self = {}
function self.process_minimised_controls()
local x, y = e[3], e[4]
local btn_actions = {
pause = {
x = pause_btn_coords.x,
y = pause_btn_coords.y,
func = function()
status_vars.is_paused = not status_vars.is_paused
end
},
forward = {
x = forward_btn_coords.x,
y = forward_btn_coords.y,
func = function()
status_vars.current_second = math.min(status_vars.current_second + cfg_vars.forward_skip, status_vars.max_seconds)
end
},
backward = {
x = backward_btn_coords.x,
y = backward_btn_coords.y,
func = function()
status_vars.current_second = math.max(status_vars.current_second - cfg_vars.backward_skip, 0)
end
},
exit = {
x = exit_btn_coords.x,
y = exit_btn_coords.y,
func = function()
status_vars.is_playing = false
return
end
},
minimise = {
x = minimise_btn_coords.x,
y = minimise_btn_coords.y,
func = function()
status_vars.is_minimised = not status_vars.is_minimised
end
},
}
for k, v in pairs(btn_actions) do
if x == v.x and y == v.y then
v.func()
end
end
end
return self
end
local function key_to_func()
end