Add isClosureRequested() method

This commit is contained in:
JeremyStar™ 2024-07-21 22:41:41 +02:00
parent f3acca7456
commit 4dbbee4efa
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
3 changed files with 28 additions and 11 deletions

View file

@ -28,6 +28,8 @@ package de.staropensource.sosengine.base.classes;
public interface Event { public interface Event {
/** /**
* Calls the event and notifies all annotated methods. * Calls the event and notifies all annotated methods.
*
* @since v1-alpha0
*/ */
void callEvent(); void callEvent();
} }

View file

@ -131,6 +131,12 @@ public class Window extends de.staropensource.sosengine.graphics.classes.Window
return getPosition(); return getPosition();
} }
/** {@inheritDoc} */
@Override
public boolean isClosureRequested() {
return glfwWindowShouldClose(getIdentifierAsLong());
}
/** /**
* Returns the window identifier as a long. * Returns the window identifier as a long.
* *

View file

@ -329,6 +329,17 @@ public abstract class Window {
@Setter @Setter
private boolean rendering; 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. * Creates a new window.
* *
@ -377,17 +388,6 @@ public abstract class Window {
windows.add(this); 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. * Allows the Graphics API to initialize the window.
* <p> * <p>
@ -433,6 +433,15 @@ public abstract class Window {
@NotNull @NotNull
public abstract Vec2i getPositionWithDecorations(); 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. * Provides an API for building {@link Window} classes more easily.
* *