auxlib.lua
This commit is contained in:
parent
e6c864f993
commit
ca019d734f
|
@ -0,0 +1,37 @@
|
||||||
|
-- this includes the iup system
|
||||||
|
local iuplua_open = package.loadlib("iuplua51.dll", "iuplua_open");
|
||||||
|
iuplua_open();
|
||||||
|
|
||||||
|
-- this includes the "special controls" of iup (dont change the order though)
|
||||||
|
local iupcontrolslua_open = package.loadlib("iupluacontrols51.dll", "iupcontrolslua_open");
|
||||||
|
iupcontrolslua_open();
|
||||||
|
|
||||||
|
-- callback function to clean up our mess
|
||||||
|
-- this is called when the script exits (forced or natural)
|
||||||
|
-- you need to close all the open dialogs here or FCEUX crashes
|
||||||
|
function emu.OnClose.iuplua()
|
||||||
|
-- gui.popup("OnClose!");
|
||||||
|
if(emu and emu.OnCloseIup ~= nil) then
|
||||||
|
emu.OnCloseIup();
|
||||||
|
end
|
||||||
|
iup.Close();
|
||||||
|
end
|
||||||
|
|
||||||
|
-- this system allows you to open a number of dialogs without
|
||||||
|
-- having to bother about cleanup when the script exits
|
||||||
|
local handles = {}; -- this table should hold the handle to all dialogs created in lua
|
||||||
|
local dialogs = 0; -- should be incremented PRIOR to creating a new dialog
|
||||||
|
|
||||||
|
-- called by the onclose event (above)
|
||||||
|
function emu.OnCloseIup()
|
||||||
|
if (handles) then -- just in case the user was "smart" enough to clear this
|
||||||
|
local i = 1;
|
||||||
|
while (handles[i] ~= nil) do -- cycle through all handles, false handles are skipped, nil denotes the end
|
||||||
|
if (handles[i] and handles[i].destroy) then -- check for the existence of what we need
|
||||||
|
handles[i]:destroy(); -- close this dialog (:close() just hides it)
|
||||||
|
handles[i] = nil;
|
||||||
|
end;
|
||||||
|
i = i + 1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
Loading…
Reference in New Issue