Remove unused methods, finalize class
This commit is contained in:
parent
5e829771a7
commit
3bd6a26e59
1 changed files with 24 additions and 54 deletions
|
@ -50,7 +50,7 @@ import static org.lwjgl.glfw.GLFW.*;
|
|||
* @since v1-alpha2
|
||||
*/
|
||||
@SuppressWarnings({ "JavadocDeclaration" })
|
||||
public class GlfwWindow extends Window {
|
||||
public final class GlfwWindow extends Window {
|
||||
/**
|
||||
* Contains the {@link #identifier} used by GLFW.
|
||||
*
|
||||
|
@ -105,26 +105,16 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected final void initializeWindow() throws Exception {
|
||||
protected void initializeWindow() {
|
||||
createGlfwWindow(); // Create the GLFW window
|
||||
initializeGlfwWindow(); // Call GLFW window initialization method
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the windowing API to initialize the window.
|
||||
*
|
||||
* @throws Throwable throwable
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
@SuppressWarnings("RedundantThrows") // done on purpose
|
||||
protected void initializeGlfwWindow() throws Exception {}
|
||||
|
||||
/**
|
||||
* (Re-)Creates the associated GLFW window.
|
||||
*
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
public final void createGlfwWindow() throws WindowCreationFailureException {
|
||||
public void createGlfwWindow() throws WindowCreationFailureException {
|
||||
// Ensure running on the main thread
|
||||
if (!Miscellaneous.onMainThread())
|
||||
throw new NotOnMainThreadException();
|
||||
|
@ -137,7 +127,6 @@ public class GlfwWindow extends Window {
|
|||
}
|
||||
|
||||
// Set window hints
|
||||
setWindowHints();
|
||||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // The window's visibility is later changed in setWindowState, this is just for setting up the window
|
||||
glfwWindowHint(GLFW_POSITION_X, getPosition().getX());
|
||||
glfwWindowHint(GLFW_POSITION_Y, getPosition().getY());
|
||||
|
@ -180,20 +169,12 @@ public class GlfwWindow extends Window {
|
|||
setWindowMode(getWindowMode());
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the windowing API to set custom
|
||||
* window hints during window creation.
|
||||
*
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
protected void setWindowHints() {}
|
||||
|
||||
/**
|
||||
* Closes the associated GLFW window.
|
||||
*
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
public final void closeGlfwWindow() throws WindowCreationFailureException {
|
||||
public void closeGlfwWindow() throws WindowCreationFailureException {
|
||||
// Ensure running on the main thread
|
||||
if (!Miscellaneous.onMainThread())
|
||||
throw new NotOnMainThreadException();
|
||||
|
@ -207,7 +188,7 @@ public class GlfwWindow extends Window {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public final void terminate() {
|
||||
public void terminate() {
|
||||
setTerminated(true);
|
||||
closeGlfwWindow();
|
||||
}
|
||||
|
@ -219,7 +200,7 @@ public class GlfwWindow extends Window {
|
|||
* @since v1-alpha2
|
||||
*/
|
||||
@Override
|
||||
public final void updateState() {
|
||||
public void updateState() {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -268,23 +249,12 @@ public class GlfwWindow extends Window {
|
|||
super.setResizable(Miscellaneous.getBooleanizedInteger(glfwGetWindowAttrib(identifierLong, GLFW_RESIZABLE)));
|
||||
super.setOnTop(Miscellaneous.getBooleanizedInteger(glfwGetWindowAttrib(identifierLong, GLFW_FLOATING)));
|
||||
super.setTransparent(Miscellaneous.getBooleanizedInteger(glfwGetWindowAttrib(identifierLong, GLFW_TRANSPARENT_FRAMEBUFFER)));
|
||||
|
||||
// Make windowing API update it's state
|
||||
updateGlfwState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the windowing API to update it's state.
|
||||
*
|
||||
* @throws Throwable throwable
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
protected void updateGlfwState() {}
|
||||
|
||||
// ------------------------------------------------ [ Rendering ] ------------------------------------------------ //
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void render() throws NotOnMainThreadException {
|
||||
public void render() throws NotOnMainThreadException {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -305,14 +275,14 @@ public class GlfwWindow extends Window {
|
|||
*
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
public final void ownContext() {
|
||||
public void ownContext() {
|
||||
glfwMakeContextCurrent(identifierLong);
|
||||
}
|
||||
|
||||
// ------------------------------------------------ [ Information/Action methods ] ------------------------------------------------ //
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final boolean isClosureRequested() {
|
||||
public boolean isClosureRequested() {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return false;
|
||||
|
@ -322,7 +292,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final boolean isFocused() {
|
||||
public boolean isFocused() {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return false;
|
||||
|
@ -331,7 +301,7 @@ public class GlfwWindow extends Window {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public final void focus() {
|
||||
public void focus() {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -340,7 +310,7 @@ public class GlfwWindow extends Window {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public final void requestAttention() {
|
||||
public void requestAttention() {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -352,7 +322,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setName(@NotNull String name) {
|
||||
public void setName(@NotNull String name) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -363,7 +333,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTitle(@NotNull String title) {
|
||||
public void setTitle(@NotNull String title) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -374,7 +344,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setSize(@NotNull Vec2i size) {
|
||||
public void setSize(@NotNull Vec2i size) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -385,7 +355,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setMinimumSize(@NotNull Vec2i minimumSize) {
|
||||
public void setMinimumSize(@NotNull Vec2i minimumSize) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -396,7 +366,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setMaximumSize(@NotNull Vec2i maximumSize) {
|
||||
public void setMaximumSize(@NotNull Vec2i maximumSize) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -407,7 +377,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setPosition(@NotNull Vec2i position) {
|
||||
public void setPosition(@NotNull Vec2i position) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -418,7 +388,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setWindowMode(@NotNull WindowMode windowMode) {
|
||||
public void setWindowMode(@NotNull WindowMode windowMode) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -454,7 +424,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setResizable(boolean resizable) {
|
||||
public void setResizable(boolean resizable) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -464,7 +434,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setBorderless(boolean borderless) {
|
||||
public void setBorderless(boolean borderless) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -474,7 +444,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setFocusable(boolean focusable) {
|
||||
public void setFocusable(boolean focusable) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -484,7 +454,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setOnTop(boolean onTop) {
|
||||
public void setOnTop(boolean onTop) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
@ -494,7 +464,7 @@ public class GlfwWindow extends Window {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTransparent(boolean transparent) {
|
||||
public void setTransparent(boolean transparent) {
|
||||
// Ensure the window is not terminated
|
||||
if (isTerminated())
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue