vooga.engine.event
Class EventPool

java.lang.Object
  extended by vooga.engine.event.EventPool

public class EventPool
extends java.lang.Object

The EventPool collects all the events from the game loop. User has the ability to add event object which implements IEventHandler interface. Also the user has the flexibility to remove the event from the EventPool if a certain event is not wanted anymore. In the game loop, (EventPool)object.checkEvents() needs to be called to check all the events. If an event's condition is satisfied, the event will be triggered or fired automatically. For more details about how to use, please see the Demo2.

See Also:
IEventHandler

Constructor Summary
EventPool()
           
 
Method Summary
 void addEvent(IEventHandler event)
          Add event into the eventPool so that eventPool can check the event for you in the game loop.
 void checkEvents()
          Put this method in the update game loop so that all the events will be checked automatically and fired accordingly.
 java.util.ArrayList<IEventHandler> getEventList()
          Get the a list of events which contains all the events in the EventPool
 void removeEvent(IEventHandler event)
          Remove event from the eventPool so that this event will not trigger anything in the gameloop.
 void setEventList(java.util.ArrayList<IEventHandler> eventList)
          Set the eventList object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventPool

public EventPool()
Method Detail

addEvent

public void addEvent(IEventHandler event)
Add event into the eventPool so that eventPool can check the event for you in the game loop.

Parameters:
event - The object which implements IEventHandler interface.

getEventList

public java.util.ArrayList<IEventHandler> getEventList()
Get the a list of events which contains all the events in the EventPool

Returns:
ArrayList Returns an event list object which is an arrayList of objects which implement IEventHandler interface.

setEventList

public void setEventList(java.util.ArrayList<IEventHandler> eventList)
Set the eventList object.

Parameters:
eventList - An event list object which is an arrayList of objects which implement IEventHandler interface.

removeEvent

public void removeEvent(IEventHandler event)
Remove event from the eventPool so that this event will not trigger anything in the gameloop.

Parameters:
event - The class object which implements IEventHandler interface.

checkEvents

public void checkEvents()
Put this method in the update game loop so that all the events will be checked automatically and fired accordingly.