-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprime_window.lua
More file actions
executable file
·73 lines (56 loc) · 1.84 KB
/
prime_window.lua
File metadata and controls
executable file
·73 lines (56 loc) · 1.84 KB
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
package.loaded.utils = nil
package.loaded.dolphin = nil
package.loaded.version = nil
package.loaded.prime = nil
package.loaded.echoes = nil
package.loaded.corruption = nil
local utils = require "utils"
local dolphin = require "dolphin"
local layout = {
init = function(window)
window:setSize(265, 275)
window:setPosition(157, 195) -- Set window position
window:setCaption("Prime Watch") -- Set the window title.
local font = window:getFont()
font:setName("Lucida Console") -- Customize the font.
font:setSize(9)
label = createLabel(window)
end,
update = function()
text = ""
if dolphin.get_GameID() == "prime" then
_G.core = require "prime"
text = core.layout()
elseif dolphin.get_GameID() == "menumod" then
text = "Menu Mod is not supported"
elseif dolphin.get_GameID() == "echoes" then
_G.core = require "echoes"
text = core.layout()
elseif dolphin.get_GameID() == "corruption" then
_G.core = require "corruption"
text = core.layout()
else
text = text .. "Not a supported game "
.. "\nGame ID "
.. dolphin.get_GameID()
.. "\n"
end
label:setCaption(text)
end,
}
-- Initializing the GUI window.
local window = createForm(true)
layout.init(window)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Create update timer
update_timer = createTimer(nil,true)
timer_setInterval(update_timer,16) -- 16 ms approx. 1 frame RTA (1/60)
function update_watch()
if pcall(layout.update) then --calls layout to update
-- Nothing
else
update_timer = nil -- Stop the timer
end
end
timer_onTimer(update_timer,update_watch) -- On tick, update the timer and update the function