Package icyllis.modernui.core
Class Window
java.lang.Object
icyllis.modernui.core.Window
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
ActivityWindow
Represents a GLFW platform window, with 3D API surface attached to it.
There's must be a main window in Modern UI, any other windows share the same 3D context of the main one. Each window have its Activity Context and its own presentation screen. Any sub-window (e.g. tooltips, toasts) will not exceed its platform window area.
Most window methods must be only called on main thread.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
End of types of system windows.protected final long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Destroys the window and remove all callbacks.static Window
get
(long handle) final long
Get the pointer of this window in the GLFW.int
Returns the framebuffer height for this window in pixels.int
Returns the window height in virtual screen coordinates.int
Returns the window width in virtual screen coordinates.int
Returns the y-coordinate of the top-left corner of this window in virtual screen coordinate system.int
Returns the x-coordinate of the top-left corner of this window in virtual screen coordinate system.int
getWidth()
Returns the framebuffer width for this window in pixels.void
hide()
void
Makes the OpenGL context of this window on the current calling thread.void
maximize()
void
minimize()
void
restore()
void
Sets window icon.void
setShouldClose
(boolean value) Sets the value of the close flag of the specified window.void
Sets window title.boolean
Gets whether this window is marked should be closed.void
show()
void
Swaps the front and back buffers of the specified window when rendering with OpenGL.void
swapInterval
(int interval) Sets the swap interval for the current OpenGL context.
-
Field Details
-
LAST_SYSTEM_WINDOW
public static final int LAST_SYSTEM_WINDOWEnd of types of system windows.- See Also:
-
mHandle
protected final long mHandle
-
-
Constructor Details
-
Window
public Window(long handle)
-
-
Method Details
-
get
-
getHandle
public final long getHandle()Get the pointer of this window in the GLFW.- Returns:
- the handle of the window
-
shouldClose
public boolean shouldClose()Gets whether this window is marked should be closed. For example, by clicking the close button in the title bar.- Returns:
true
if this window should be closed
-
setShouldClose
public void setShouldClose(boolean value) Sets the value of the close flag of the specified window. This can be used to override the user's attempt to close the window, or to signal that it should be closed.- Parameters:
value
- should close
-
setTitle
Sets window title. -
setIcon
Sets window icon. -
makeCurrent
public void makeCurrent()Makes the OpenGL context of this window on the current calling thread. It can only be on one thread at the same time. -
swapBuffers
public void swapBuffers()Swaps the front and back buffers of the specified window when rendering with OpenGL. -
swapInterval
public void swapInterval(int interval) Sets the swap interval for the current OpenGL context.- Parameters:
interval
- the interval
-
getWidth
public int getWidth()Returns the framebuffer width for this window in pixels.- Returns:
- the framebuffer width
-
getHeight
public int getHeight()Returns the framebuffer height for this window in pixels.- Returns:
- the framebuffer height
-
getScreenY
public int getScreenY()Returns the x-coordinate of the top-left corner of this window in virtual screen coordinate system.- Returns:
- the x-coordinate of this window
-
getScreenX
public int getScreenX()Returns the y-coordinate of the top-left corner of this window in virtual screen coordinate system.- Returns:
- the y-coordinate of this window
-
getScreenWidth
public int getScreenWidth()Returns the window width in virtual screen coordinates.- Returns:
- window width
-
getScreenHeight
public int getScreenHeight()Returns the window height in virtual screen coordinates.- Returns:
- window height
-
minimize
public void minimize() -
restore
public void restore() -
maximize
public void maximize() -
show
public void show() -
hide
public void hide() -
close
public void close()Destroys the window and remove all callbacks.- Specified by:
close
in interfaceAutoCloseable
-