Package dev.prozilla.pine.core
Class Window
java.lang.Object
dev.prozilla.pine.core.Window
- All Implemented Interfaces:
Destructible
,Initializable
Represents a GLFW window object.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Checks if the window has been initialized.void
destroy()
Destroys the window.int
long
getId()
int
getWidth()
void
init()
Sets the window hints and creates a GLFW window object.void
Sets the size of the rendering viewport to match the window.void
setCenterCursor
(boolean centerCursor) void
setDecorated
(boolean decorated) void
void
setEnableTransparentFramebuffer
(boolean transparentFramebuffer) void
setFloating
(boolean floating) void
setFocused
(boolean focused) void
setHint
(int hint, boolean value) void
setHint
(int hint, int value) void
setHint
(WindowHint hint, boolean value) void
setHint
(WindowHint hint, int value) void
Updates the icons of this window.void
setMaximized
(boolean maximized) void
setOpacity
(float opacity) Sets the opacity of the entire windowvoid
setResizable
(boolean resizable) void
Updates the title of this window.void
setVisible
(boolean visible) boolean
Determines whether the window should be closed.void
update()
Swaps the buffers and polls the events each frame.
-
Field Details
-
width
public int width -
height
public int height
-
-
Constructor Details
-
Window
-
-
Method Details
-
init
Sets the window hints and creates a GLFW window object.- Specified by:
init
in interfaceInitializable
- Throws:
RuntimeException
-
update
public void update()Swaps the buffers and polls the events each frame. -
destroy
public void destroy()Destroys the window.- Specified by:
destroy
in interfaceDestructible
-
shouldClose
public boolean shouldClose()Determines whether the window should be closed.- Returns:
- True if the window should be closed
-
refreshSize
public void refreshSize()Sets the size of the rendering viewport to match the window. -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
getId
public long getId() -
setTitle
Updates the title of this window.- Parameters:
title
- Title
-
setIcons
Updates the icons of this window. Uses the first element of the images array as the default icon.- Parameters:
images
- Array of icon images
-
setOpacity
public void setOpacity(float opacity) Sets the opacity of the entire window- Parameters:
opacity
- The opacity, in the range of0f
and1f
-
setDecorated
public void setDecorated(boolean decorated) -
setVisible
public void setVisible(boolean visible) -
setEnableTransparentFramebuffer
public void setEnableTransparentFramebuffer(boolean transparentFramebuffer) -
setResizable
public void setResizable(boolean resizable) -
setFocused
public void setFocused(boolean focused) -
setFloating
public void setFloating(boolean floating) -
setMaximized
public void setMaximized(boolean maximized) -
setCenterCursor
public void setCenterCursor(boolean centerCursor) -
setHint
-
setHint
-
setHint
public void setHint(int hint, boolean value) -
setHint
public void setHint(int hint, int value) -
setDefaultHints
public void setDefaultHints() -
checkStatus
Checks if the window has been initialized.- Throws:
IllegalStateException
- If the window has not been initialized yet.
-