Package de.coreengine.framework
Class Window
- java.lang.Object
-
- de.coreengine.framework.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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addWindowListener(WindowChangedListener listner)
Adding new listener that gets called, when the window changed.static void
create(int width, int height, String title, Window.Type type, TextureData icon)
Create and show a new glfw-windowstatic void
destroy()
Destroy glfw windowstatic float
getAspect()
static int
getHeight()
static javax.vecmath.Matrix4f
getOrthoMatrix()
Get orthogonal projection matrix of the windowstatic org.lwjgl.glfw.GLFWVidMode.Buffer
getSupportedVideoModes()
static Window.Type
getType()
static int
getWidth()
static long
getWindow()
void
invoke(long window, int width, int height)
static boolean
keepAlive()
static void
setIcon(TextureData textureData)
Set textureData as icon for the glfw windowstatic void
setReiszeable(boolean resizeable)
Only affective on WINDOWED typed windowsstatic void
setSize(int width, int height)
Sets the size of the window.static void
setType(Window.Type type)
Switch between window typesstatic 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 logicstatic void
update()
Updates glfw window
-
-
-
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 pxheight
- Windows height in pxtitle
- Window titletype
- Type of the windowicon
- 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 widthheight
- 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 interfaceorg.lwjgl.glfw.GLFWWindowSizeCallbackI
-
-