iup example cleanup

This commit is contained in:
qfox 2008-08-02 22:10:49 +00:00
parent 94e212df3e
commit cb9117cdf6
1 changed files with 209 additions and 174 deletions

View File

@ -1,189 +1,224 @@
require('auxlib');
-- super mario bros 1 hitbox script
-- iup example
-- this shows a test window with all kinds of idle dialogs
-- we need iup, so include it here
local iuplua_open = package.loadlib("iuplua51.dll", "iuplua_open");
iuplua_open();
-- we also need 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(); -- close the iup system
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;
-- Note that in the following example, parentheses are optional if you
-- are specifying tables with curly braces! Might look a little confusing.
function testiup()
local img1 =
iup.image{
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1},
{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2,2,2,2,2,2,3,2,2,2,2,2,2,2,2},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,2,2,2,3,2,2,2,2,2,2,2,2},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,2,2,2,2,2,2,2,2,2},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
{1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; -- note that this ; is NOT the end of the command but a mere seperator, equivalent to a comma (,)
colors =
{
"BGCOLOR", -- 1
"255 0 0", -- 2
"0 0 0" -- 3 (changed because of Lua index starts at 1)
}
};
img1 = iup.image
{
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1},
{1,1,1,1,1,1,1,1,1,1,1,1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2,2,2,2,2,2,2,2,2,2},
{2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
{2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
{2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
{3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};
colors =
{
"0 255 0", -- 1
"BGCOLOR", -- 2
"255 0 0", -- 3
"0 0 0" -- 4
}
}
mnu = iup.menu
{
iup.submenu
{
iup.menu
{
iup.item{title="IupItem 1 Checked",value="ON"},
iup.separator{},
iup.item{title="IupItem 2 Disabled",active="NO"}
}
;title="IupSubMenu 1"
mnu = iup.menu{
iup.submenu{
title="IupSubMenu 1",
iup.menu {
iup.item{title="IupItem 1 Checked",value="ON"},
iup.separator{},
iup.item{title="IupItem 2 Disabled",active="NO"}
}
},
iup.item{title="IupItem 3"},
iup.item{title="IupItem 4"}
}
};
dlg = iup.dialog
{
iup.vbox
{
iup.hbox
{
iup.frame
{
iup.vbox
{
iup.button{title="Button Text"},
iup.button{title="",image=img1},
iup.button{title="",image=img1,impress=img2}
}
;title="IupButton"
},
iup.frame
{
iup.vbox
{
iup.label{title="Label Text"},
iup.label{title="",separator="HORIZONTAL"},
iup.label{title="",image=img1}
}
;title="IupLabel"
},
iup.frame
{
iup.vbox
{
iup.toggle{title="Toggle Text", value="ON"},
iup.toggle{title="",image=img1,impress=img2},
iup.frame
{
iup.radio
{
iup.vbox
{
iup.toggle{title="Toggle Text"},
iup.toggle{title="Toggle Text"}
btn = iup.button{title="Press me!"};
-- set the callback function, action
-- when the user clicks on the button, this function is executed
-- and in this case, it fires a silly popup message
btn.action =
function (self)
iup.Message("Why","Why oh why did you press me?");
end;
dialogs = dialogs + 1; -- there is no ++ in Lua
handles[dialogs] =
iup.dialog{
title="IupDialog Title",
menu=mnu, -- add the menu in the table
iup.vbox{
iup.hbox{
iup.frame{
title="IupButton",
iup.vbox{
btn, -- add the button
iup.button{title="",image=img1},
iup.button{title="",image=img1,impress=img2}
}
},
iup.frame{
title="IupLabel",
iup.vbox{
iup.label{title="Label Text"},
iup.label{title="",separator="HORIZONTAL"},
iup.label{title="",image=img1}
}
},
iup.frame{
title="IupToggle",
iup.vbox{
iup.toggle{title="Toggle Text", value="ON"},
iup.toggle{title="",image=img1,impress=img2},
iup.frame{
title="IupRadio",
iup.radio{
iup.vbox{
iup.toggle{title="Toggle Text"},
iup.toggle{title="Toggle Text"}
}
}
} -- /frame
} -- /vbox
},
iup.frame{
title="IupText/IupMultiline",
iup.vbox{
iup.text{size="80x",value="IupText Text"},
iup.multiline{size="80x60",
expand="YES",
value="IupMultiline Text\nSecond Line\nThird Line"}
}
},
iup.frame{
title="IupList",
iup.vbox{
iup.list{"Item 1 Text","Item 2 Text","Item 3 Text"; expand="YES",value="1"},
iup.list{"Item 1 Text","Item 2 Text","Item 3 Text"; dropdown="YES",expand="YES",value="2"},
iup.list{"Item 1 Text","Item 2 Text","Item 3 Text"; editbox="YES",expand="YES",value="3"}
}
}
}
;title="IupRadio"
}
}
;title="IupToggle"
},
iup.frame
{
iup.vbox
{
iup.text{size="80x",value="IupText Text"},
iup.multiline{size="80x60",expand="YES",value="IupMultiline Text\nSecond Line\nThird Line"}
}
;title="IupText/IupMultiline"
},
iup.frame
{
iup.vbox
{
iup.list{"Item 1 Text","Item 2 Text","Item 3 Text"; expand="YES",value="1"},
iup.list{"Item 1 Text","Item 2 Text","Item 3 Text"; dropdown="YES",expand="YES",value="2"},
iup.list{"Item 1 Text","Item 2 Text","Item 3 Text"; editbox="YES",expand="YES",value="3"}
}
;title="IupList"
}
},
iup.canvas{bgcolor="128 255 0"}
;gap="5",alignment="ARIGHT",margin="5x5"
}
;title="IupDialog Title", menu=mnu
}
}, -- /hbox
iup.canvas{bgcolor="128 255 0"},
gap="5",
alignment="ARIGHT",
margin="5x5"
} -- /vbox
};
dlg:show()
handles[dialogs]:show(); -- this actually shows you the dialog. Note that this is equivalent to calling handles[dialogs].show(handles[dialogs]); just shorter.
end;
end
testiup();
testiup(); -- note that this is NOT called from WITHIN the loop!
-- once the loop quits, the script exits and all dialogs are automatically destroyed by the onclose event
while (true) do
FCEU.frameadvance();
end;