Class GameWindow
java.lang.Object
de.gurkenlabs.litiengine.GameWindow
The
It provides the possibility to set a title, provide an icon, configure the cursor or get information about the resolution.
GameWindow class is a wrapper for the game's visual window in which the RenderComponent
lives.It provides the possibility to set a title, provide an icon, configure the cursor or get information about the resolution.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThis listener interface receives resolution changed events of the game window. -
Method Summary
Modifier and TypeMethodDescriptioncursor()Gets the visual representation of the mouse cursor on theGameWindow.Gets the current resolution scale.intGets the window height.Gets theGameWindow's JFrame, abstracted as a Container.Gets the screen location of the window's top left corner.Gets the AWT canvas that is used to render the game's content on.Gets the window resolution wrapped in aDimensionobject.floatGets the current resolution scale.getSize()Gets the window width and height wrapped in aDimensionobject.intgetWidth()Gets the window width.booleanReturns true if the GameWindow is the focus owner.voidAdds the specified resolution changed listener to receive events when the dimensions of this game window are changed.voidRemoves the specified resolution changed listener.voidSets the icon image for the window's hostingJFrame.voidSets the icons for the window's hostingJFrame.voidsetResolution(Resolution res) Sets the resolution for the GameWindow.voidSets the title for this window to the specified string.
-
Method Details
-
isFocusOwner
public boolean isFocusOwner()Returns true if the GameWindow is the focus owner.- Returns:
- true if the GameWindow is the focus owner; false otherwise
-
onResolutionChanged
Adds the specified resolution changed listener to receive events when the dimensions of this game window are changed.- Parameters:
listener- The listener to add.
-
removeResolutionChangedListener
Removes the specified resolution changed listener.- Parameters:
listener- The listener to remove.
-
setResolution
Sets the resolution for the GameWindow.- Parameters:
res- The desired Resolution to set for the GameWindow.- See Also:
-
getResolutionScale
public float getResolutionScale()Gets the current resolution scale. The resolution scale is a float value dictating how much larger or smaller each pixel is rendered on screen.- Returns:
- The GameWindow's current resolution scale.
-
getCenter
Gets the current resolution scale. The resolution scale is a float value dictating how much larger or smaller each pixel is rendered on screen.- Returns:
- The
GameWindow's current resolution scale.
-
getHostControl
Gets theGameWindow's JFrame, abstracted as a Container.- Returns:
- The
GameWindow'sJFrameas an abstract AWTContainer.
-
getSize
-
getWidth
public int getWidth()Gets the window width.- Returns:
- The window width.
-
getHeight
public int getHeight()Gets the window height.- Returns:
- The window height.
-
getRenderComponent
Gets the AWT canvas that is used to render the game's content on.- Returns:
- The AWT render component onto which the game contents are rendered.
-
cursor
Gets the visual representation of the mouse cursor on theGameWindow.This can be used to provide a custom cursor image, define its visibility or specify a rendering offset from the actual position.
- Returns:
- The mouse cursor of the game.
-
getResolution
-
getLocationOnScreen
Gets the screen location of the window's top left corner.- Returns:
- The
Pointof the window's top left corner. - See Also:
-
setIcon
Sets the icon image for the window's hostingJFrame.- Parameters:
image- TheImageto be used as the window icon.- See Also:
-
setIcons
Sets the icons for the window's hostingJFrame. Depending on the platform specifications, one or severalIcons with the correct Dimension will be chosen automatically from the list.- Parameters:
images- A list ofImagesto be used as the window icons.- See Also:
-
setTitle
Sets the title for this window to the specified string.- Parameters:
title- the window title to be displayed in the frame's border. Anullvalue is treated as an empty string, "".- See Also:
-