Class WindowManager

java.lang.Object
io.github.ocelot.window.WindowManager
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource

public class WindowManager extends Object implements org.lwjgl.system.NativeResource
Manages monitors and all windows created.
  • Constructor Details

    • WindowManager

      public WindowManager()
  • Method Details

    • getGLFWError

      @Nullable public static @Nullable String getGLFWError()
      Returns:
      The current GLFW error or null if there currently isn't one
    • update

      public void update()
      Polls window events and updates all windows.
    • create

      public Window create(int width, int height, boolean fullscreen)
      Creates a new window without initializing it. Window.create(CharSequence) must be called for it to be valid.
      Parameters:
      width - The width of the window
      height - The height of the window
      fullscreen - Whether to initialize in full screen or not
      Returns:
      The window created
    • create

      public Window create(CharSequence title, int width, int height, boolean fullscreen)
      Creates a new window and initializes it.
      Parameters:
      title - The title of the window
      width - The width of the window
      height - The height of the window
      fullscreen - Whether to initialize in fullscreen or not
      Returns:
      The window created
    • create

      public Window create(CharSequence title, int width, int height, boolean fullscreen, long share)
      Creates a new window and initializes it.
      Parameters:
      title - The title of the window
      width - The width of the window
      height - The height of the window
      fullscreen - Whether to initialize in fullscreen or not
      share - The id of the window to share context with
      Returns:
      The window created
      See Also:
    • getMonitor

      @Nullable public @Nullable Monitor getMonitor(long handle)
      Retrieves the monitor with the specified id.
      Parameters:
      handle - The handle of the monitor
      Returns:
      The monitor with that id or null if no monitor could be found
    • findBestMonitor

      @Nullable public @Nullable Monitor findBestMonitor(Window window)
      Finds the best monitor to use for fullscreen based on how much each monitor covers the window.
      Parameters:
      window - The window to test
      Returns:
      The monitor the window best fits on or null if no monitor could be found
    • free

      public void free()
      Specified by:
      free in interface org.lwjgl.system.NativeResource