Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 371 characters in body
Source Link
InsertNickHere
  • 3.7k
  • 3
  • 29
  • 23

Due to the fact I don't like defines I would make a "wrapper" function like this:

public void call(EventType type, String whatToCall) { EventManager::get_mutable_instance().get<type>(whatToCall).Call(EventManager::KeyEvent::ArgsType(localEvent.Key)); } 

Edit: An untested define could look like:

#define call(Type,Name) \ EventManager::get_mutable_instance().get<Type>(Name).Call(EventManager::KeyEvent::ArgsType(localEvent.Key)); 

Edit2: Im not really used to your code, but what would it more readable and debugable would be sth like this. (Be aware, the class names are not yours but I hope you can see what I mean)

Event event = EventManager::get_mutable_instance().get<type>(whatToCall); ArgType argType = EventManager::KeyEvent::ArgsType(localEvent.Key); event.call(argType); 

Due to the fact I don't like defines I would make a "wrapper" function like this:

public void call(EventType type, String whatToCall) { EventManager::get_mutable_instance().get<type>(whatToCall).Call(EventManager::KeyEvent::ArgsType(localEvent.Key)); } 

Edit: An untested define could look like:

#define call(Type,Name) \ EventManager::get_mutable_instance().get<Type>(Name).Call(EventManager::KeyEvent::ArgsType(localEvent.Key)); 

Due to the fact I don't like defines I would make a "wrapper" function like this:

public void call(EventType type, String whatToCall) { EventManager::get_mutable_instance().get<type>(whatToCall).Call(EventManager::KeyEvent::ArgsType(localEvent.Key)); } 

Edit: An untested define could look like:

#define call(Type,Name) \ EventManager::get_mutable_instance().get<Type>(Name).Call(EventManager::KeyEvent::ArgsType(localEvent.Key)); 

Edit2: Im not really used to your code, but what would it more readable and debugable would be sth like this. (Be aware, the class names are not yours but I hope you can see what I mean)

Event event = EventManager::get_mutable_instance().get<type>(whatToCall); ArgType argType = EventManager::KeyEvent::ArgsType(localEvent.Key); event.call(argType); 
Source Link
InsertNickHere
  • 3.7k
  • 3
  • 29
  • 23

Due to the fact I don't like defines I would make a "wrapper" function like this:

public void call(EventType type, String whatToCall) { EventManager::get_mutable_instance().get<type>(whatToCall).Call(EventManager::KeyEvent::ArgsType(localEvent.Key)); } 

Edit: An untested define could look like:

#define call(Type,Name) \ EventManager::get_mutable_instance().get<Type>(Name).Call(EventManager::KeyEvent::ArgsType(localEvent.Key));