db65f3c8e3
Creates an API object for the PlayArea, and moves most references to the PlayArea to use the API instead. Image swapper is excluded on this, as I'm not completely sure how TTS will handle having an object rebuild itself.
45 lines
1.4 KiB
Plaintext
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
|