Difference between revisions of "Talk:Writing CEGUI scripts"
From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
(2 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
eg. | eg. | ||
− | |||
− | |||
− | |||
− | -- do stuff with a real slider | + | function slider_ValueChanged(event) |
− | + | local we = CEGUI.toWindowEventArgs(event); | |
+ | local slider = tolua.cast(we.window, "CEGUI::Slider"); | ||
+ | -- do stuff with a real slider | ||
+ | local value = slider:getCurrentValue(); | ||
+ | -- ... | ||
+ | end | ||
− | |||
− | + | ||
+ | |||
+ | ---- | ||
+ | There is a problem in the examples: | ||
+ | |||
+ | This does not work: | ||
+ | bar:setSize( CEGUI.Size(1,0.1) ); | ||
+ | |||
+ | But this does: | ||
+ | bar:setSize( CEGUI.Size:new(1,0.1) ); | ||
+ | --[[User:Hkroger|Hkroger]] 11:52, 1 March 2006 (PST) |
Latest revision as of 19:52, 1 March 2006
Great article! I'd also like to share that you can use tolua.cast() to cast a window to a more specific class so you can access those specific functions.
eg.
function slider_ValueChanged(event) local we = CEGUI.toWindowEventArgs(event); local slider = tolua.cast(we.window, "CEGUI::Slider"); -- do stuff with a real slider local value = slider:getCurrentValue(); -- ... end
There is a problem in the examples:
This does not work: bar:setSize( CEGUI.Size(1,0.1) );
But this does: bar:setSize( CEGUI.Size:new(1,0.1) ); --Hkroger 11:52, 1 March 2006 (PST)