Interface LogicManager

  • 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 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 - The Display 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 after init(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 most FastJEngine#targetUPS times a second. This value can be changed using FastJEngine.setTargetUPS(int).

        Parameters:
        display - The Display 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 after update(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 most FastJEngine#targetFPS times a second. This value can be changed using FastJEngine.setTargetFPS(int).

        Parameters:
        display - The Display 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.