Class EJGEngine

java.lang.Object
org.collebol.engine.EJGEngine

public abstract class EJGEngine extends Object
This abstract class representing the core engine for EJGEngine. This class is responsible for setting up and running the main window, handling events, and managing renderers.

To use this engine, extend this class and implement the abstract methods: setup(), register(), enable(), and disable().

For more information, please refer to the EJGEngine Wiki.

Since:
1.0-dev
Author:
ColleBol - contact@collebol.org
  • Constructor Details

    • EJGEngine

      public EJGEngine()
  • Method Details

    • start

      public void start()
      Starts the engine by performing the following steps:
      1. Calls the setup() method to perform any necessary initialization.
      2. Initializes the main window by creating an instance of MainWindow.
      3. Creates an instance of RenderHandler to manage renderers.
      4. Registers the initial panel by calling MainWindow.registerPanel(Panel).
      5. Sets the initial panel to be displayed using MainWindow.setPanel(int).
      6. Calls the enable() method to enable any necessary features or components.
      7. Runs the main loop of the window by calling MainWindow.run().
      8. Calls the disable() method to disable any necessary features or components after the main loop ends.
    • setup

      public abstract void setup()
      Performs any necessary initialization for the engine before the MainWindow is created. This method should be implemented to set up resources, configurations, or other initial settings.
    • register

      public abstract void register()
      Registers components or panels required by the engine. This method should be implemented to add any necessary components or panels to the engine.
    • enable

      public abstract void enable()
      This method is called right before the MainWindow is started. This method should be implemented to activate any necessary features or components.
    • disable

      public abstract void disable()
      This method is called when the game is shutting down. This method should be implemented to deactivate any necessary features or components.
    • getWindow

      public MainWindow getWindow()
      Returns:
      the main window of the engine
    • getEventHandler

      public EventHandler getEventHandler()
      Returns:
      the event handler associated with the engine
    • setEventHandler

      public void setEventHandler(EventHandler eventHandler)
      Parameters:
      eventHandler - the event handler to be set
    • getRenderers

      public RenderHandler getRenderers()
      Returns:
      the render register handler responsible for managing renderers
    • getSoundHandler

      public SoundHandler getSoundHandler()
      Returns:
      the sound handler responsible for managing sound players and camera sound players
    • getComponentHandler

      public ComponentHandler getComponentHandler()
      Returns:
      the component handler responsible for managing components.