Add isClosureRequested() method
This commit is contained in:
parent
f3acca7456
commit
4dbbee4efa
3 changed files with 28 additions and 11 deletions
|
@ -28,6 +28,8 @@ package de.staropensource.sosengine.base.classes;
|
|||
public interface Event {
|
||||
/**
|
||||
* Calls the event and notifies all annotated methods.
|
||||
*
|
||||
* @since v1-alpha0
|
||||
*/
|
||||
void callEvent();
|
||||
}
|
||||
|
|
|
@ -131,6 +131,12 @@ public class Window extends de.staropensource.sosengine.graphics.classes.Window
|
|||
return getPosition();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isClosureRequested() {
|
||||
return glfwWindowShouldClose(getIdentifierAsLong());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the window identifier as a long.
|
||||
*
|
||||
|
|
|
@ -329,6 +329,17 @@ public abstract class Window {
|
|||
@Setter
|
||||
private boolean rendering;
|
||||
|
||||
/**
|
||||
* Returns a set of active windows.
|
||||
*
|
||||
* @return active windows
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
@NotNull
|
||||
public static ImmutableHashSet<@NotNull Window> getWindows() {
|
||||
return new ImmutableHashSet<>(windows);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new window.
|
||||
*
|
||||
|
@ -377,17 +388,6 @@ public abstract class Window {
|
|||
windows.add(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a set of active windows.
|
||||
*
|
||||
* @return active windows
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
@NotNull
|
||||
public static ImmutableHashSet<@NotNull Window> getWindows() {
|
||||
return new ImmutableHashSet<>(windows);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the Graphics API to initialize the window.
|
||||
* <p>
|
||||
|
@ -433,6 +433,15 @@ public abstract class Window {
|
|||
@NotNull
|
||||
public abstract Vec2i getPositionWithDecorations();
|
||||
|
||||
/**
|
||||
* Returns if the user, window manager or
|
||||
* compositor send a request for the window to close.
|
||||
*
|
||||
* @return {@code true} if a window closure has been requested
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
public abstract boolean isClosureRequested();
|
||||
|
||||
/**
|
||||
* Provides an API for building {@link Window} classes more easily.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue