-
- All Known Implementing Classes:
SceneManager
,SimpleManager
public interface LogicManager
The basis of game management in any game made with FastJ.This class defines the basic events and actions that all logic managers need to address:
- Game Initialization
- Input Processing
- Game Updating
- Game Rendering
- Game Resetting
- Since:
- 1.5.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
init(Display display)
Initializes the logic manager.void
initBehaviors()
Initializes the logic manager's behaviors (called afterinit(Display)
).void
processInputEvents()
Allows the logic manager to process all pending input events.void
processKeysDown()
Allows the logic manager to process keys that are currently pressed.void
receivedInputEvent(InputEvent inputEvent)
Allows the logic manager to take in an input event.void
render(Display display)
Allows the logic manager to render irs game's current state to the screen.void
reset()
Resets the logic manager entirely.void
update(Display display)
Allows the logic manager to update its game state once.void
updateBehaviors()
Updates the logic manager's behaviors (called afterupdate(Display)
).
-
-
-
Method Detail
-
init
void init(Display display)
Initializes the logic manager.This method is called after the engine has been set up, and the display has been created. As it is only called once, it is the best place to set some initial settings that apply to the entire game.
- Parameters:
display
- TheDisplay
that the game renders to. Useful for applying display-related settings before the game starts.
-
initBehaviors
void initBehaviors()
Initializes the logic manager's behaviors (called afterinit(Display)
).
-
processInputEvents
void processInputEvents()
Allows the logic manager to process all pending input events.- See Also:
Keyboard
,Mouse
,InputManager
-
processKeysDown
void processKeysDown()
Allows the logic manager to process keys that are currently pressed.
-
receivedInputEvent
void receivedInputEvent(InputEvent inputEvent)
Allows the logic manager to take in an input event.FOR IMPLEMENTORS: Input events taken in should be stored for later. When
processInputEvents()
is called, it should process all the events stored.- Parameters:
inputEvent
- The event taken in.
-
update
void update(Display display)
Allows the logic manager to update its game state once.The
FastJEngine
attempts to call this method at mostFastJEngine#targetUPS
times a second. This value can be changed usingFastJEngine.setTargetUPS(int)
.- Parameters:
display
- TheDisplay
that the game renders to. Useful for checking certain attributes of the display while updating the game state.
-
updateBehaviors
void updateBehaviors()
Updates the logic manager's behaviors (called afterupdate(Display)
).
-
render
void render(Display display)
Allows the logic manager to render irs game's current state to the screen.The
FastJEngine
attempts to call this method at mostFastJEngine#targetFPS
times a second. This value can be changed usingFastJEngine.setTargetFPS(int)
.- Parameters:
display
- TheDisplay
that the game renders to.
-
reset
void reset()
Resets the logic manager entirely.This method is called when the engine exits. Due to the game engine's mutability, it is preferred that all resources of the game engine are removed gracefully.
FOR IMPLEMENTORS: By the end of this method call, the logic manager should have released all its resources.
-
-