-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMain.lua
More file actions
79 lines (61 loc) · 2.45 KB
/
Main.lua
File metadata and controls
79 lines (61 loc) · 2.45 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
74
75
76
77
78
79
-- GUI Framework for mupen lua
-- by Aurumaker72
---------------------------------------------------------------------------------------------------------------------------------------
function AbsolutePathToCurrentFile()
local str = debug.getinfo(2, "S").source:sub(2)
return str:match("^.*/(.*).lua$") or str
end
function AbsolutePathToCurrentFolder()
return AbsolutePathToCurrentFile():sub(1, -("Main.lua"):len() - 1)
end
FOLDER_USER_CODE = AbsolutePathToCurrentFolder() .. "User" .. "\\"
FOLDER_LIBRARY = AbsolutePathToCurrentFolder() .. "Library" .. "\\"
FOLDER_EMULATOR = AbsolutePathToCurrentFolder() .. "Emulator" .. "\\"
FOLDER_HELPER = AbsolutePathToCurrentFolder() .. "Helper" .. "\\"
FOLDER_GUI = AbsolutePathToCurrentFolder() .. "GUI" .. "\\"
FOLDER_GUI_CONTROLS = AbsolutePathToCurrentFolder() .. "GUI" .. "\\" .. "Controls" .. "\\"
FOLDER_PROVIDER = AbsolutePathToCurrentFolder() .. "Provider" .. "\\"
dofile(FOLDER_USER_CODE .. "YourCode.lua")
dofile(FOLDER_LIBRARY .. "middleclass.lua")
dofile(FOLDER_EMULATOR .. "Screen.lua")
dofile(FOLDER_HELPER .. "Numeric.lua")
dofile(FOLDER_HELPER .. "WGUI.lua")
dofile(FOLDER_HELPER .. "Table.lua")
dofile(FOLDER_GUI .. "Scene.lua")
dofile(FOLDER_GUI .. "SceneManager.lua")
dofile(FOLDER_GUI_CONTROLS .. "Control.lua")
dofile(FOLDER_GUI_CONTROLS .. "Button.lua")
dofile(FOLDER_GUI_CONTROLS .. "ToggleButton.lua")
dofile(FOLDER_GUI_CONTROLS .. "TextBox.lua")
dofile(FOLDER_GUI_CONTROLS .. "Slider.lua")
dofile(FOLDER_GUI_CONTROLS .. "Label.lua")
dofile(FOLDER_GUI_CONTROLS .. "Joystick.lua")
dofile(FOLDER_PROVIDER .. "Mouse.lua")
dofile(FOLDER_PROVIDER .. "Keyboard.lua")
dofile(FOLDER_PROVIDER .. "Appearance.lua")
---------------------------------------------------------------------------------------------------------------------------------------
-- Expand window for our drawing area
Screen.Expand()
-- Current theme
Appearance.Initialize()
UserCodeOnInitialize()
---------------------------------------------------------------------------------------------------------------------------------------
function AtStop()
UserCodeAtStop()
-- Restore pre-resize window dimensions
Screen.Contract()
end
function AtVisualInterrupt()
UserCodeAtVisualInterrupt()
Mouse.Update()
Keyboard.Update()
SceneManager.Update()
SceneManager.Draw()
end
function AtInputPoll()
UserCodeAtInputPoll()
end
-- Register callbacks
emu.atstop(AtStop)
emu.atinput(AtInputPoll)
emu.atvi(AtVisualInterrupt)