• Advertisement
Sign in to follow this  
  • entries
    135
  • comments
    130
  • views
    52549

Event System

Sign in to follow this  

90 views

So, I had previously worked on my event system, and I had tested it, but I ended up putting it in the back burner because I needed to do some graphics work. But, as I do more and more work, the need for an event system is becoming more urgent, or at least more desirable.

I'm not entirely happy with my current implementation because it uses templates, and templates have a way of becoming hard to manage the more you work with them. Another problem I have with them using templates is that it became a bit troublesome when I decided to work on the event manager class (aka, the event scheduler).

But, this is what it looks like right now:



All the main application is doing is randomly issuing "Fire" event on the good or evil ships, when the good ship fires, the evil ship listens for that event and determines that it has been hit. If a ship's health reaches 0, it executes the "Destroyed" event. What I didnt do, but would be trivial is to make the other ship listen for the "Destroyed" event and display a message, such as "I win. bitch", but it wasn't necessary because I had already proved that all listeners listen for the event and react appropiately to it.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement