fix: isClosedRequested now sets flag to false after call

added support for isFocused
This commit is contained in:
Brian Matzon 2003-07-16 21:02:48 +00:00
parent bd9b01eaf8
commit 1080e1344b

View file

@ -37,6 +37,9 @@ public abstract class Window {
/** Whether the window is currently minimized */
private boolean minimized;
/** Whether the window has focus */
private boolean focused = true;
/** Whether the window has been asked to close by the user or underlying OS */
private boolean closeRequested;
@ -131,13 +134,16 @@ public abstract class Window {
*/
private native void nSetTitle(String title);
/**
* @return true if the user or operating system has asked the window to close
*/
public final boolean isCloseRequested() {
assert isCreated();
return closeRequested;
}
/**
* @return true if the user or operating system has asked the window to close
*/
public final boolean isCloseRequested() {
assert isCreated();
boolean currentValue = closeRequested;
closeRequested = false;
return currentValue;
}
/**
* @return true if the window is minimized or otherwise not visible
@ -146,6 +152,14 @@ public abstract class Window {
assert isCreated();
return minimized;
}
/**
* @return true if window is focused
*/
public final boolean isFocused() {
assert isCreated();
return focused;
}
/**
* Minimize the game and allow the operating system's default display to become