Recover general events in C/C++

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Brouilles
Just popping in
Just popping in
Posts: 3
Joined: Mon Oct 31, 2016 15:13

Recover general events in C/C++

Postby Brouilles » Fri Nov 11, 2016 14:57

Hello,
I would like to know if by default CEGUI allows to set up an event system between the C ++ / C code and a .layout ? I have seen in the documentation that it is possible in lua with :

Code: Select all

<Event Name="Clicked" Function="luabtn_clicked" />

Is it possible to retrieve it in C++, whether I can link an event name to an internal function ? Otherwise I thought of setting up an xml mapping with the id of the button and an event next to the layout. But if CEGUI allows it.

In any case, I congratulate the team behind CEGUI for your work !

I apologize for my bad English.
Thank you for your answers,
Best regards.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Recover general events in C/C++

Postby Ident » Fri Nov 11, 2016 16:43

As far as I know there is no way to setup callbacks for events for C/C++. I agree though that this is a great feature to have available in our layouts.

Can you elaborate on how you would implement making the link between the callback (that XML knows nothing about) and the event of a widget?
CrazyEddie: "I don't like GUIs"

Brouilles
Just popping in
Just popping in
Posts: 3
Joined: Mon Oct 31, 2016 15:13

Re: Recover general events in C/C++

Postby Brouilles » Fri Nov 11, 2016 19:01

Thank you for your reply.
This is to add an extra xml file next to the layout. This file will store the event linked to a button, via its ID, the event type and an identifier (for a C ++ method) and parameters. I will then set up a class named HandlersCEGUIEvent for example, Interpret the XML document, and create dynamically with CEGUI a subscribe event. On the main lines.

This will make it possible to add events without recompilation on button for example, and will allow modding for my game. I would come back to the subject once I had implemented the system. This is not super clean but will do the trick in my case.

If you have ideas I am also taker of course,
Best regards.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Recover general events in C/C++

Postby Ident » Fri Nov 11, 2016 21:37

I dont understand why you dont just add this as an XML child element to the widget in the layout file. Why a new XML file? Referencing widgets via IDs opens up issues becuase you will have to handle the cases where the window isnt there, whereas if you do this in the layout it is inherently guaranteed that the widget exists.

Also I still dont get how you want to get from the "identifier" for a c++ method to its c++ symbol. Mind to show an example XML line for such an event subscription?
CrazyEddie: "I don't like GUIs"


Return to “Help”

Who is online

Users browsing this forum: No registered users and 13 guests