SCED/src/accessories/DisplacementTool.ttslua
2023-01-05 01:06:04 +01:00

45 lines
1.4 KiB
Plaintext

local playAreaApi = require("core/PlayAreaApi")
local UI_offset = 1.15
local buttonParamaters = {}
buttonParamaters.function_owner = self
buttonParamaters.label = ""
buttonParamaters.height = 500
buttonParamaters.width = 500
buttonParamaters.color = { 0, 0, 0, 0 }
function onLoad()
-- index 0: left
buttonParamaters.click_function = "shift_left"
buttonParamaters.tooltip = "Move left"
buttonParamaters.position = { -UI_offset, 0, 0 }
self.createButton(buttonParamaters)
-- index 1: right
buttonParamaters.click_function = "shift_right"
buttonParamaters.tooltip = "Move right"
buttonParamaters.position = { UI_offset, 0, 0 }
self.createButton(buttonParamaters)
-- index 2: up
buttonParamaters.click_function = "shift_up"
buttonParamaters.tooltip = "Move up"
buttonParamaters.position = { 0, 0, -UI_offset }
self.createButton(buttonParamaters)
-- index 3: down
buttonParamaters.click_function = "shift_down"
buttonParamaters.tooltip = "Move down"
buttonParamaters.position = { 0, 0, UI_offset }
self.createButton(buttonParamaters)
end
function shift_left(color) playAreaApi.shiftContentsLeft(color) end
function shift_right(color) playAreaApi.shiftContentsRight(color) end
function shift_up(color) playAreaApi.shiftContentsUp(color) end
function shift_down(color) playAreaApi.shiftContentsDown(color) end