Package org.xjge.core
Class Event
java.lang.Object
org.xjge.core.Event
public abstract class Event
extends java.lang.Object
Objects of this type represent a game or engine event (such as a pause,
cutscene, or error) that temporarily disrupts the normal flow of execution.
Events should be used anytime two systems need to be decoupled in time,
otherwise an
Observable should be considered.- Since:
- 2.0.0
-
Field Summary
Fields Modifier and Type Field Description protected booleanresolved -
Constructor Summary
Constructors Constructor Description Event(int priority)Creates a new event that will block execution until resolved. -
Method Summary
Modifier and Type Method Description abstract voidresolve()Called continuously until the event is resolved.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
resolved
protected boolean resolved
-
-
Constructor Details
-
Event
public Event(int priority)Creates a new event that will block execution until resolved. Events use numbers to indicate the precedence in which they are to be resolved, with lower values denoting higher priority.NOTE: Priorities 0-3 are restricted to engine use only so you should start at 4 or greater.
- Parameters:
priority- the priority of the event
-
-
Method Details
-
resolve
public abstract void resolve()Called continuously until the event is resolved. Provided so events can define their own terms for resolution. To resolve an event, set theresolvedfield to true.
-