Page 1 of 1

Demo8 integration into CEGUI Samples framework

Posted: Wed Sep 17, 2014 10:42
by cbuchner1
I've made an attempt at integrating the Demo8 LUA scripting demo into the CEGUI samples framework again.
Currently it compiles, but crashes.

Currently I am stuck at the problem of passing the GUI context from Demo8Sample::initialise()
into the LUA script.

It seems the default GUI context that is used in the demo8.lua script is the one used for the sample selection
screen of the samples framework, but the individual samples all run in their individual contexts. The sample
browser then crashes because Demo8 doesn't set a root window in the sample's GUI context (the pointer
remains ULL).

Is there an easy method to pass arguments or user data into LUA scripts?

Christian

Re: Demo8 integration into CEGUI Samples framework

Posted: Wed Sep 17, 2014 13:39
by Ident
If you got that running that would be really great.
I dont use Lua so I cant help you much in detail.

What do you mean by "Is there an easy method to pass arguments or user data into LUA scripts?" though? Cant you call a getter function?

Re: Demo8 integration into CEGUI Samples framework

Posted: Wed Sep 17, 2014 15:17
by cbuchner1
I am not aware of an existing getter function for named GUI contexts.

Currently the LUA script uses CEGUI.System:getSingleton():getDefaultGUIContext() which doesn't return the context I want.

I would like to avoid creating my own interface bindings just for this demo (and I have never before done
an interface between LUA and C++)

Christian

Re: Demo8 integration into CEGUI Samples framework

Posted: Wed Sep 17, 2014 15:44
by Ident
Ok now I understand what you mean. Let me look into it...

Re: Demo8 integration into CEGUI Samples framework

Posted: Wed Sep 17, 2014 16:03
by Ident
No, there is in fact no way you can retrieve a created GUIContext directly via CEGUI. It is the user 's duty to handle the reference of the GUIContexts they created. As far as I know we dont plan to change this.

Therefore, I am afraid you will have to create a Lua function similar to the initialise function in C++, which has the GUIContext as parameter. It is just one function that is required for this. Maybe Martin (Kulik) is able to help you out with this when he has time. In case there will ever be multiple Lua samples, it might be great to have this binding create by a subclass of Sample, for example LuaSample, that inherits sample and does all the generic stuff already and calls some Lua function for you to put the initialisation code in. But I don't know if this is feasible.