Page 8 of 14
Re: New GUI scripting concepts and foundation
Posted: Wed Jan 09, 2013 9:10 pm
by JKos
Ok, I included the framework and made gw_loadModule function which can be used to load gw script entities. I moved gw and gw_events to lua files: mod_assets/grimwidgets/gw.lua and mod_assets/grimwidgets/gw_events.lua.
We can always rollback to previous version if this is not what we want.
Re: New GUI scripting concepts and foundation
Posted: Wed Jan 09, 2013 11:01 pm
by thomson
I just wanted to let you know that real life (aka project deadline) will make me likely to disappear till end of January. I may look at grimrock forum briefly, but I won't be able to contribute anything. That doesn't mean that I lost interest or anything, just being busy writing tons of a different kind of code.
Re: New GUI scripting concepts and foundation
Posted: Thu Jan 10, 2013 9:21 pm
by JKos
Real life or real wife?

Yeah, I know what you mean, I have slowed down my modding pace a lot too. I just can't figure out how to extend the real life timer.
Re: New GUI scripting concepts and foundation
Posted: Thu Jan 10, 2013 10:18 pm
by Xanathar
Re: New GUI scripting concepts and foundation
Posted: Fri Jan 11, 2013 6:37 pm
by JKos
I did some code refactoring:
added gw_utils module and moved some methods to it and prefixed private methods with _ on gw script entity.
Should we make another script entity for all those draw-methods? eg. gw_draw?
Re: New GUI scripting concepts and foundation
Posted: Fri Jan 11, 2013 6:44 pm
by Xanathar
Should we make another script entity for all those draw-methods? eg. gw_draw?
I didn't work on it these days, sorry.
Maybe it makes more sense to divide them by control type (like gw_buttons ?) and have the draw methods as private in those entities ? Or you mean just the "helper" draw methods like drawBevel and similar ?
Re: New GUI scripting concepts and foundation
Posted: Fri Jan 11, 2013 10:34 pm
by JKos
Maybe, we should think about the structure a bit more. Anyway I added freeze world functionality to encounters, it's still buggy because only way to unfreeze world is to click leave button, so if you heal the dwarf the game is frozen forever, but the idea should be clear so thomson or anyone can continue from there.
Edit: shit, I accidentally committed on eob-waterdeep instead of grimwidgets, sorry I'm gonna fix it.
Re: New GUI scripting concepts and foundation
Posted: Fri Jan 11, 2013 11:52 pm
by JKos
Ok, now it's pushed to grimwidgets repo and I updated it to eob-waterdeep repo too.
Re: New GUI scripting concepts and foundation
Posted: Sat Jan 12, 2013 1:15 am
by JKos
Added gwElement:setRelativePosition(positions)
Implementation is at gw_util.setRelativePosition
Code: Select all
button1:setRelativePosition{'center'} -- sets element position to the center of the parent element
button1:setRelativePosition{'left','bottom'} -- sets element position to the bottom left of the parent element
.. etc..
possible values: top,middle,bottom,left,center,right
TODO:
- possibility to pass relative position as an argument to addChild method
- support for {'after','element_id'} and {'below','element_id'}
- And I think we need a margin (top and left at least) property too
Re: New GUI scripting concepts and foundation
Posted: Sat Jan 12, 2013 11:25 pm
by JKos
FYI: I'm making a major code structure overhaul, so I hope that you guys don't have any uncommitted features in progress.
I'm changing the api to something like this:
Code: Select all
rect1 = gw_rectangle.create('rect_id',10,10,100,100)
button = gw_button.create('button_1',10,10,'button text')
rect1:addChild(button)
So every widget has a own script entity (like Xanathar suggested ). IMO It's much clearer and flexible that way.
Edit: Pushed my changes to github.
- I also added a text wrapping functionality and added text support for rectangles too. (see examples from dungeon)
- gw script has now general element factory method: gw.create(elementType,id,arg1,arg2,arg3,arg4,arg5,arg6)
which can be used like this:
gw.create('button3D','my_3D_button', 20, 20, "Click me", 150, 20, {200,200,200})
Which is exactly the same as calling:
gw_button3D.create('my_3D_button', 20, 20, "Click me", 150, 20, {200,200,200})