1
Coding / Re: lua design thoughts
« on: September 19, 2015, 04:28:16 pm »
Rebased the PR. Hope it is alright now.
xray
xray
New board
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
... Would merge the pull request - but there is a merge commit in it. ...
node = {
_type = "panel",
_name = "pnlTest",
pos = { 10, 250 },
size = { 200, 200 },
layout = ufo.LAYOUT_TOP_DOWN_FLOW,
layoutmargin = 15,
backgroundcolor = { 0.50, 0.00, 0.00, 1.00 },
{
_type = "MainMenuBtn",
_name = "btnTest1",
text = "_Test 1"
},
{
_type = "MainMenuBtn",
_name = "btnTest2",
text = "_Test 2"
},
{
_type = "MainMenuBtn",
_name = "btnTest3",
text = "_Test 3"
}
}
...
do
wndMain = ufo.create_window ("main", nil)
wndMain:set_background ("ui/main_bg")
local pnlTest = build(node, wndMain)
...
Thanks!
What about using our bug/feature tracker as a todo-list?
-geever
2. Scrollbars
Assigning scrollbars is annoying in the ufoscript too.
...
What if instead we could write:Code: [Select]local building_head = ufo.create_string(box, "building_head", {
["super"] = nil,
["box"] = { 0, 20, 150, 20 },
["font"] = "f_very_small_bold",
["contentalign"] = ufo.ALIGN_CC,
["longlines"] = ufo.LONGLINES_PRETTYCHOP,
["text"] = "_Building"
})
local fooNode = ufo.create_button(...)
fooNode.set_properties({
box = {0, 0, 100, 100}
text = "_Foo button"
...
})
I just found out that this is in master already... Hmm, I like it and don't, at the same time. It has great potential for moving out a lot of UI related code from C, but it also moves away from regular people: more programming and what is the worst: lots of of extra (useless) typing.[/quoute]
I had it moved in the main branch so it gets more feedback. Located in an isolated branch the development was more or less stalling. As for the design: it's lua, yes you need to program. But that's precisely why it was implemented firsthand since ufo script is not a good programming language with major drawback in writing the functions. As for the extra typing: one solution is to write boilerplate lua code that accepts some hierarchic structure defining the look of the gui and then translates it into appropriate api calls.
As it is, current implementation works side-by-side with the ufo script implementation, so at the moment anyone can pick the language he/she is most comfortable with.I'm still looking for the change, hoping that the current state is just the beginning of something really good.
[/qoute]
I'm sure in the end it will become just that :-)@xray: Would you be interested in my thoughts and improving the LUA UI engine?
-geever
@geever: Of course I'm open for thoughts on improving the LUA UI engine. You can PM me or post in this thread. Looking forward to your ideas!
xray
Merged your pull request. The segfaults are gone. At least as far as I can see. Anyway, the intro seems to be running on my system without troubles. At least.. I guess with "intro" you mean the sequence played when you start a new campaign.
- nor intro window
Few more problems I've experienced.I created a pull request and commented on each issue I stated above.
- requested set_cvar segfaults
- cvar-associated checkbox can't be checked back if unchecked
- nor intro window nor model_test windows work (in case of intro you have to find intro.ogm, because it was removed a while ago)
- and some others