-
Notifications
You must be signed in to change notification settings - Fork 0
/
Viewer.gui_script
73 lines (65 loc) · 2.86 KB
/
Viewer.gui_script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
-- Prototypia Viewer GUI Logics
-- Copyright(c) 2024- 1dealGas, under the Apache 2.0 License.
-- Function Caches
--
local hash = hash
local msg_post = msg.post
local gui_set_text = gui.set_text
-- Node & Message Caches
--
local MessageNode, PlayPause, MainScript
local GUI_NEW_MSG, GUI_SHOW_PLAY, GUI_SHOW_PAUSE = hash("GUI_NEW_MSG"), hash("GUI_SHOW_PLAY"), hash("GUI_SHOW_PAUSE")
local GUI_LOAD, GUI_SEEK_BAR, GUI_SEEK_MS = hash("GUI_LOAD"), hash("GUI_SEEK_BAR"), hash("GUI_SEEK_MS")
local GUI_XD, GUI_YD, GUI_XS, GUI_YS = hash("GUI_XD"), hash("GUI_YD"), hash("GUI_XS"), hash("GUI_YS")
local GUI_DEG, GUI_EXPORT = hash("GUI_DEG"), hash("GUI_EXPORT")
local GUI_OWV, GUI_PLAY = hash("GUI_OWV"), hash("GUI_PLAY")
-- Dirty Larry Callbacks
--
local dl = require("AeDirtyLarry.dirtylarry")
local dl_input = dl.input
local dl_button = dl.button
local function SendLoad() msg_post(MainScript, GUI_LOAD) end
local function SendSeekBar() msg_post(MainScript, GUI_SEEK_BAR) end
local function SendSeekMs() msg_post(MainScript, GUI_SEEK_MS) end
local function SendXd() msg_post(MainScript, GUI_XD) end
local function SendYd() msg_post(MainScript, GUI_YD) end
local function SendXs() msg_post(MainScript, GUI_XS) end
local function SendYs() msg_post(MainScript, GUI_YS) end
local function SendDeg() msg_post(MainScript, GUI_DEG) end
local function SendExport() msg_post(MainScript, GUI_EXPORT) end
local function SendOWV() msg_post(MainScript, GUI_OWV) end
local function SendPlayPause() msg_post(MainScript, GUI_PLAY) end
-- Script Callbacks
--
function init(self)
MessageNode = gui.get_node("Message")
PlayPause = gui.get_node("Play/larrylabel")
MainScript = msg.url("Prototypia:/Viewer#Logics")
msg_post(MainScript, "acquire_input_focus")
msg_post("#", "acquire_input_focus") -- GUI component at the top of the stack
end
function on_input(self, action_id, action) -- All Are Dirty Larry Callbacks.
UserInput = dl_input(dl, "Input", action_id, action, 0, "Args Input") -- Global
dl_button(dl, "Load", action_id, action, SendLoad)
dl_button(dl, "Bar", action_id, action, SendSeekBar)
dl_button(dl, "ms", action_id, action, SendSeekMs)
dl_button(dl, "Xd", action_id, action, SendXd)
dl_button(dl, "Yd", action_id, action, SendYd)
dl_button(dl, "Xs", action_id, action, SendXs)
dl_button(dl, "Ys", action_id, action, SendYs)
dl_button(dl, "Deg", action_id, action, SendDeg)
dl_button(dl, "Export", action_id, action, SendExport)
dl_button(dl, "Works", action_id, action, SendOWV)
dl_button(dl, "Play", action_id, action, SendPlayPause)
end
function on_message(self, message_id, message, sender)
-- Change Messages, or Switch Play / Pause
--
if message_id == GUI_NEW_MSG then
gui_set_text(MessageNode, Message) -- Global
elseif message_id == GUI_SHOW_PLAY then
gui_set_text(PlayPause, "Play")
elseif message_id == GUI_SHOW_PAUSE then
gui_set_text(PlayPause, "Pause")
end
end