EventHandler is a thread running all the time to handle events(move up, move down, move left,
move right, crash) occurs at the client.
All the events occurs at the client are stored in the eventQueue. The EventHandler retrives one
event at a time, judges what kind of event it is, and the take the corresponding action to that
event.
Variables
eventQueue: This is a SharedQueue used to store the events to be manipulated.
collisionDetector: This is a CollisionDetector used to detect if
a collision will occur.
reqSender: This is a ReqSender responsible of sending requests to the
server.
Method
addKeyEvent(Integer): This method put the event which is indicated by an integer into the eventQueue.
[Go to Class Index Table]
[Go back to Program Architecture Diagram]
[Source Code of EventHandler.java]