You can avoid the long switch-case stuff by handling function pointers automatic on application side. Personally I used functors for that which are called in the eventreceiver.
That seems the best solution avalaible. I tried something like that, which seems to be ok for what I tried.
class ...
Search found 4 matches
- Sun Jun 21, 2009 6:34 pm
- Forum: Beginners Help
- Topic: adding function pointer to IGUIButton
- Replies: 7
- Views: 1982
- Sun Jun 21, 2009 3:46 am
- Forum: Beginners Help
- Topic: adding function pointer to IGUIButton
- Replies: 7
- Views: 1982
Got something new, the reason why it is difficult. The IGUIButton class is abstract, the class used in addbutton is CGUIButton, but this one is only in the source code. CGUIButton.h is not in the includes, I added it but the virtual functions are not found by the linker, which means it is not in the ...
- Sun Jun 21, 2009 3:23 am
- Forum: Beginners Help
- Topic: adding function pointer to IGUIButton
- Replies: 7
- Views: 1982
That is exactly what I am trying to do. The problem is actually making the derived button is a real pain. The engine wont allow me to do it.Seven wrote:you could catch any button press in your main event receiver and then get the gui element, cast it to your derived button, and call the run function
- Sun Jun 21, 2009 2:36 am
- Forum: Beginners Help
- Topic: adding function pointer to IGUIButton
- Replies: 7
- Views: 1982
adding function pointer to IGUIButton
I am putting a lot of buttons / checkbox / scrollbar / ... and keeping track of them in an event manager is a pain because I must add a long switch/case for each id. The idea I got is to modify the class through inheritance with the following simplified scheme :
class Button : public irr::gui ...
class Button : public irr::gui ...