I wonder why Lua highlighting works but isn't selectable from the combo box when writing.. https://github.com/FRex/Lua-SFGUI-LoaderSo, I made a LuaTable class and an InterfaceLoader class that change this:
-- this file has been proudly written in gvim ;)
win1 = {type="Window",
x=200,
y=100,
colspacing=8.0,
rowspacing=8.0,
shadow=true,
background=true,
titlebar=true,
caption="The Fu*k Java SFGUI Example",
resize=true,
widgets={
{
type="Label",
text="Is c++ better?",
spanx=3
},
{
type="Button",
text="Naturally",
y=1
},
{
type="Button",
text="Of Course",
x=1,y=1
},
{
type="Button",
text="Yes!",
x=2,y=1,
OnLeftClick="correct"
}
}
}
Into this:
All you can do is get is a window with a table in it and you can place widgets in it, that's it.. no limit on number of widgets or windows, though.
Only supported so far to place in that table:
-entry
-spinner
-spinbutton
-image
-label
-progressbar
-scale
-scrollbar
-button
-togglebutton
-checkbutton
-combobox
Notice there is no radio button(edit: now there is), I'm still thinking how to handle the fact they are grouped.
It requires the change of delegates to std function that I posted few weeks back in SFGUI thread.It may be buggy, Tank will probably release his yaml gui loader tomorrow anyway and it'll be 10x better(because f. my life
). Also it depends on std::bind from c++11,Lua, SFGUI,SFML(duh..) and there are two line that use PhysicsFS but it can be easily replaced to use whatever you want. There are two std::function callbacks: creation and message, OnXXX props in widgets send the widget and the string to message callback, creation callbacks gets sent entire luatable of the widget and the widget pointer.
Also LuaTable class is pretty neat I'd say. If anyone is still interested after seeing all the disadvantages, I can share the code but neither loader nor lua table are fully ready imo.
Here's exe demo, you can play around with it, it got both callbacks set to std::cout the type of widget in creation or the message string in message callbacks.
https://docs.google.com/file/d/0B8dEkQw1a4Wvb1QzR0wyaEt2aWs/edit?usp=sharingtype can be "sfg_label" "sfg_entry" etc. for labels, entries and buttons there's text property that is string to show, for button, toggle button and image there is image which is path to image to load etc. figure it out or ask what exactly you're looking for. Things that don't matter for that widget get ignored, and almost always some sane defaults are set. Syntax is : window is global variable of type sfg_window, and it contains table of tables called wigets, in which each table has type and some other vars. I'd say it's pretty intuitive and works ok for quick menus/guis that don't require critical speed.