Class LwjglWindow

java.lang.Object
com.jme3.system.lwjgl.LwjglContext
com.jme3.system.lwjgl.LwjglWindow
All Implemented Interfaces:
JmeContext, Runnable
Direct Known Subclasses:
LwjglOffscreenBufferVR

public abstract class LwjglWindow extends LwjglContext implements Runnable
A wrapper class over the GLFW framework in LWJGL 3.
  • Field Details Link icon

    • needClose Link icon

      protected final AtomicBoolean needClose
    • needRestart Link icon

      protected final AtomicBoolean needRestart
    • wasActive Link icon

      protected boolean wasActive
    • autoFlush Link icon

      protected boolean autoFlush
    • allowSwapBuffers Link icon

      protected boolean allowSwapBuffers
  • Constructor Details Link icon

  • Method Details Link icon

    • registerWindowSizeListener Link icon

      public void registerWindowSizeListener(WindowSizeListener listener)
      Registers the specified listener to get notified when window size changes.
      Parameters:
      listener - The WindowSizeListener to register.
    • removeWindowSizeListener Link icon

      public void removeWindowSizeListener(WindowSizeListener listener)
      Removes the specified listener from the listeners list.
      Parameters:
      listener - The WindowSizeListener to remove.
    • getType Link icon

      public JmeContext.Type getType()
      Specified by:
      getType in interface JmeContext
      Returns:
      Type.Display or Type.Canvas
    • setTitle Link icon

      public void setTitle(String title)
      Set the title if it's a windowed display
      Specified by:
      setTitle in interface JmeContext
      Parameters:
      title - the title to set
    • restart Link icon

      public void restart()
      Restart if it's a windowed or full-screen display.
      Specified by:
      restart in interface JmeContext
    • createContext Link icon

      protected void createContext(AppSettings settings)
      Apply the settings, changing resolution, etc.
      Parameters:
      settings - the settings to apply when creating the context.
    • showWindow Link icon

      protected void showWindow()
    • setWindowIcon Link icon

      protected void setWindowIcon(AppSettings settings)
      Set custom icons to the window of this application.
      Parameters:
      settings - settings for getting the icons
    • destroyContext Link icon

      protected void destroyContext()
      Destroy the context.
    • create Link icon

      public void create(boolean waitFor)
      Description copied from interface: JmeContext
      Creates the context and makes it active.
      Specified by:
      create in interface JmeContext
      Parameters:
      waitFor - If true, will wait until context has initialized.
    • initInThread Link icon

      protected boolean initInThread()
      Does LWJGL display initialization in the OpenGL thread
      Returns:
      returns true if the context initialization was successful
    • runLoop Link icon

      protected void runLoop()
      execute one iteration of the render loop in the OpenGL thread
    • deinitInThread Link icon

      protected void deinitInThread()
      De-initialize in the OpenGL thread.
    • run Link icon

      public void run()
      Specified by:
      run in interface Runnable
    • getJoyInput Link icon

      public JoyInput getJoyInput()
      Specified by:
      getJoyInput in interface JmeContext
      Returns:
      Joystick input implementation. May be null if not available.
    • getMouseInput Link icon

      public MouseInput getMouseInput()
      Specified by:
      getMouseInput in interface JmeContext
      Returns:
      Mouse input implementation. May be null if not available.
    • getKeyInput Link icon

      public KeyInput getKeyInput()
      Specified by:
      getKeyInput in interface JmeContext
      Returns:
      Keyboard input implementation. May be null if not available.
    • getTouchInput Link icon

      public TouchInput getTouchInput()
      Specified by:
      getTouchInput in interface JmeContext
      Returns:
      Touch device input implementation. May be null if not available.
    • setAutoFlushFrames Link icon

      public void setAutoFlushFrames(boolean enabled)
      Specified by:
      setAutoFlushFrames in interface JmeContext
      Parameters:
      enabled - If enabled, the context will automatically flush frames to the video card (swap buffers) after an update cycle.
    • destroy Link icon

      public void destroy(boolean waitFor)
      Description copied from interface: JmeContext
      Destroys the context completely, making it inactive.
      Specified by:
      destroy in interface JmeContext
      Parameters:
      waitFor - If true, will wait until the context is destroyed fully.
    • getWindowHandle Link icon

      public long getWindowHandle()
    • getWindowContentScale Link icon

      public Vector2f getWindowContentScale(Vector2f store)
      Get the window content scale, for HiDPI support. The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.
      Parameters:
      store - A vector2f to store the result
      Returns:
      The window content scale
      See Also:
    • getFramebufferHeight Link icon

      public int getFramebufferHeight()
      Returns the height of the framebuffer.
      Specified by:
      getFramebufferHeight in interface JmeContext
      Overrides:
      getFramebufferHeight in class LwjglContext
      Returns:
      the height (in pixels)
    • getFramebufferWidth Link icon

      public int getFramebufferWidth()
      Returns the width of the framebuffer.
      Specified by:
      getFramebufferWidth in interface JmeContext
      Overrides:
      getFramebufferWidth in class LwjglContext
      Returns:
      the width (in pixels)
    • getWindowXPosition Link icon

      public int getWindowXPosition()
      Returns the screen X coordinate of the left edge of the content area.
      Specified by:
      getWindowXPosition in interface JmeContext
      Overrides:
      getWindowXPosition in class LwjglContext
      Returns:
      the screen X coordinate
    • getWindowYPosition Link icon

      public int getWindowYPosition()
      Returns the screen Y coordinate of the top edge of the content area.
      Specified by:
      getWindowYPosition in interface JmeContext
      Overrides:
      getWindowYPosition in class LwjglContext
      Returns:
      the screen Y coordinate