[SOLVED] buttonThrowers in c++?

Any hints on how to implement in C++, the python :

#accept all keys
self.accept('button_down', self.buttons,['pressed'])
NodePath btnp = window->get_button_thrower();
ButtonThrower *bt = DCAST(ButtonThrower, btnp.node());
framework.get_event_handler().add_hook("button_down", event_button_down, this);


Thank you David,
Actually I tried something like this, but the issue I meet is how to get the key code that triggered the event?

void event_button_down (const Event* evenmt, void* data) {
 std::cout << "key name: " << evenmt->get_name() << "\n";

since here for instance I’m only getting “button_down” as a descriptor and obviously the key code is the info seeked.
Should evenmt or one of its parameters be DCASTed to some type (?) in order to get the keycode?

Yes, the “key code” is the string name of the key, passed as the first parameter, similar to the Python form.

To get the string from the first parameter, use:



done, thank you again!