Class Window

  • All Implemented Interfaces:
    org.lwjgl.glfw.GLFWWindowSizeCallbackI, org.lwjgl.system.CallbackI, org.lwjgl.system.CallbackI.V, org.lwjgl.system.Pointer

    public class Window
    extends Object
    implements org.lwjgl.glfw.GLFWWindowSizeCallbackI
    Class to cteate and manage a glfw window
    Author:
    Darius Dinger
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Window.Type  
      • Nested classes/interfaces inherited from interface org.lwjgl.system.CallbackI

        org.lwjgl.system.CallbackI.B, org.lwjgl.system.CallbackI.D, org.lwjgl.system.CallbackI.F, org.lwjgl.system.CallbackI.I, org.lwjgl.system.CallbackI.J, org.lwjgl.system.CallbackI.N, org.lwjgl.system.CallbackI.P, org.lwjgl.system.CallbackI.S, org.lwjgl.system.CallbackI.V, org.lwjgl.system.CallbackI.Z
      • Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer

        org.lwjgl.system.Pointer.Default
    • Field Summary

      • Fields inherited from interface org.lwjgl.glfw.GLFWWindowSizeCallbackI

        SIGNATURE
      • Fields inherited from interface org.lwjgl.system.Pointer

        BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE
    • Method Detail

      • create

        public static void create​(int width,
                                  int height,
                                  String title,
                                  Window.Type type,
                                  TextureData icon)
        Create and show a new glfw-window
        Parameters:
        width - Windows width in px
        height - Windows height in px
        title - Window title
        type - Type of the window
        icon - Icon of the window or null for no icon
      • getSupportedVideoModes

        public static org.lwjgl.glfw.GLFWVidMode.Buffer getSupportedVideoModes()
      • destroy

        public static void destroy()
        Destroy glfw window
      • setSize

        public static void setSize​(int width,
                                   int height)
        Sets the size of the window. Only use supported sizes of the monitor for fullscreen windows. Supported sizes can be get with Window.getSupportedVideoModes()
        Parameters:
        width - New window width
        height - New window height
      • setReiszeable

        public static void setReiszeable​(boolean resizeable)
        Only affective on WINDOWED typed windows
        Parameters:
        resizeable - Should the window be resizeable
      • setType

        public static void setType​(Window.Type type)
        Switch between window types
        Parameters:
        type - New window type
      • keepAlive

        public static boolean keepAlive()
        Returns:
        if the window gets a request to close
      • setVsyncInterval

        public static void setVsyncInterval​(int interval)
        Sets the interval, for the window update (Default 1) 0 = vsync Disabled 1 or higher = vsync Enabled 1 Should be enough for vsync, more can async the visual from the logic
        Parameters:
        interval - Interval for the update
      • update

        public static void update()
        Updates glfw window
      • setIcon

        public static void setIcon​(TextureData textureData)
        Set textureData as icon for the glfw window
        Parameters:
        textureData - TextureData to set as icon
      • addWindowListener

        public static void addWindowListener​(WindowChangedListener listner)
        Adding new listener that gets called, when the window changed.
        Parameters:
        listner - Listener to add
      • getAspect

        public static float getAspect()
        Returns:
        The aspect of the current glfw window
      • getWidth

        public static int getWidth()
        Returns:
        The width of the current glfw window
      • getHeight

        public static int getHeight()
        Returns:
        The height of the current glfw window
      • getWindow

        public static long getWindow()
        Returns:
        ID of the glfw window
      • getType

        public static Window.Type getType()
        Returns:
        Current window type
      • getOrthoMatrix

        public static javax.vecmath.Matrix4f getOrthoMatrix()
        Get orthogonal projection matrix of the window
        Returns:
        Window ortho matrix
      • invoke

        public void invoke​(long window,
                           int width,
                           int height)
        Specified by:
        invoke in interface org.lwjgl.glfw.GLFWWindowSizeCallbackI