Package org.xjge.core
Class Window
java.lang.Object
org.xjge.core.Window
public final class Window
extends java.lang.Object
Provides a point of access which can be used to alter the properties of the
game window at runtime.
- Since:
- 2.0.0
-
Constructor Summary
Constructors Constructor Description Window()
-
Method Summary
Modifier and Type Method Description static void
close()
Gracefully ceases execution and closes the window.static boolean
getFullscreen()
Obtains the value indicating whether or not the window is currently in fullscreen mode.static int
getHeight()
Obtains the current height of the windows content area.int
getInputMode(int mode)
Obtains the current value of the specified input option used by the game window.static Monitor
getMonitor()
Obtains theMonitor
which the window is currently using.static int
getPositionX()
Obtains the position of the window, in screen coordinates, of the upper-left corner of the content area of the window.static int
getPositionY()
Obtains the position of the window, in screen coordinates, of the upper-left corner of the content area of the window.static java.lang.String
getTitle()
Obtains the title used to identify the window.static int
getWidth()
Obtains the current width of the windows content area.static void
setDimensions(int width, int height)
Sets the size of the windows content area in pixels.static void
setFullscreen(boolean fullscreen)
Changes the game window between fullscreen and windowed modes.static void
setIcon(java.lang.String filename)
Sets the icon image of the window.static void
setInputMode(int mode, int value)
Sets the value of an input option used by the game window.static void
setMonitor(java.lang.String operation)
Changes the current monitor the window will use.static void
setMonitor(Monitor monitor)
Changes the current monitor the window will use.static void
setPosition(int xPos, int yPos)
Sets the position, in screen coordinates, of the upper-left corner of the content area of the window.static void
setPositionCentered()
Attempts to place the window in the center of the monitor.static void
setTitle(java.lang.String title)
Changes the title used to identify the window.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Window
public Window()
-
-
Method Details
-
getPositionX
public static int getPositionX()Obtains the position of the window, in screen coordinates, of the upper-left corner of the content area of the window.- Returns:
- the position of the windows content area along the x-axis
-
getPositionY
public static int getPositionY()Obtains the position of the window, in screen coordinates, of the upper-left corner of the content area of the window.- Returns:
- the position of the windows content area along the y-axis
-
getWidth
public static int getWidth()Obtains the current width of the windows content area.- Returns:
- the width of the window in pixels
-
getHeight
public static int getHeight()Obtains the current height of the windows content area.- Returns:
- the height of the window in pixels
-
getFullscreen
public static boolean getFullscreen()Obtains the value indicating whether or not the window is currently in fullscreen mode.- Returns:
- if true, the window will cover the entire screen including taskbars
-
getTitle
public static java.lang.String getTitle()Obtains the title used to identify the window. This is the same title that will be displayed to the user from the windows frame.- Returns:
- the title of the window as a string
-
getMonitor
Obtains theMonitor
which the window is currently using.- Returns:
- the current monitor object of the window
-
getInputMode
public int getInputMode(int mode)Obtains the current value of the specified input option used by the game window.- Parameters:
mode
- the input option to manipulate. One ofGLFW_CURSOR
,GLFW_STICKY_KEYS
,GLFW_STICKY_MOUSE_BUTTONS
,GLFW_LOCK_KEY_MODS
, orGLFW_RAW_MOUSE_MOTION
.- Returns:
- the current state of the queried mode
-
setPosition
public static void setPosition(int xPos, int yPos)Sets the position, in screen coordinates, of the upper-left corner of the content area of the window.- Parameters:
xPos
- the x-coordinate of the upper-left corner of the content areayPos
- the y-coordinate of the upper-left corner of the content area
-
setPositionCentered
public static void setPositionCentered()Attempts to place the window in the center of the monitor. -
setDimensions
public static void setDimensions(int width, int height)Sets the size of the windows content area in pixels.- Parameters:
width
- the desired width of the windowheight
- the desired height of the window
-
setFullscreen
public static void setFullscreen(boolean fullscreen)Changes the game window between fullscreen and windowed modes.- Parameters:
fullscreen
- if true, the window will cover the entire screen including taskbars
-
setTitle
public static void setTitle(java.lang.String title)Changes the title used to identify the window. This is the same title that will be displayed to the user from the windows frame.- Parameters:
title
- the new title the window will use
-
setMonitor
Changes the current monitor the window will use. Alternate version ofsetMonitor(java.lang.String)
.- Parameters:
monitor
- the monitor that the window will be switched to
-
setMonitor
public static void setMonitor(java.lang.String operation)Changes the current monitor the window will use. Often this will cause the window to relocate.- Parameters:
operation
- the method of traversal to use. Either explicitly as the ID number of the device or "prev/next" to move between the previous and next devices in the collection respectively.
-
setIcon
public static void setIcon(java.lang.String filename)Sets the icon image of the window. Images should be at least 32x32 pixels large, but no larger than 64x64.- Parameters:
filename
- the name of the file to load. Expects the file extension to be included.
-
setInputMode
public static void setInputMode(int mode, int value)Sets the value of an input option used by the game window.- Parameters:
mode
- the input option to manipulate. One ofGLFW_CURSOR
,GLFW_STICKY_KEYS
,GLFW_STICKY_MOUSE_BUTTONS
,GLFW_LOCK_KEY_MODS
, orGLFW_RAW_MOUSE_MOTION
.value
- the new value to set the specified input option to
-
close
public static void close()Gracefully ceases execution and closes the window.
-