Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement simple Event System #97

Closed
bitbrain opened this issue Mar 19, 2018 · 0 comments
Closed

Implement simple Event System #97

bitbrain opened this issue Mar 19, 2018 · 0 comments

Comments

@bitbrain
Copy link
Owner

Instead of defining indivual listeners per game component, have a so called EventManager:

EventManager eventManager = context.getEventManager();

It is the possible to implement custom events:

class MyTestEvent implements GameEvent { }

In order to produce:

eventManager.publish(new MyTestEvent());

In order to consume:

eventManager.register(new GameEventListener<MyTestEvent>() {
   @Override
   public void onEvent(MyTestEvent event) {
      // do something with the event
   }
});
@bitbrain bitbrain added this to the Version 1.0.0 (Initial Release) milestone Mar 19, 2018
@bitbrain bitbrain added this to Deployed in Core May 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Core
  
Deployed
Development

No branches or pull requests

1 participant