aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2015-02-09 20:54:22 +0100
committerJulien Gouesse <[email protected]>2015-02-09 20:54:22 +0100
commitaa70e567f30721a05c8b9c94156ad921cfb3ac75 (patch)
tree71e2a0a64b8b55573d12750578f1e16fb01f7435
parentaf94ef70aa1c5238db332c655b047cf6f597a5e8 (diff)
Adds some methods to get and set the size of the window into JoglNewtWindow, clarifies the documentation (window units/pixel units)
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java16
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java4
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java69
3 files changed, 77 insertions, 12 deletions
diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java b/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java
index 1e912f6..35e6933 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -21,7 +21,7 @@ public interface NativeCanvas extends Canvas {
/**
* <code>isActive</code> returns true if the display is active.
- *
+ *
* @return whether the display system is active.
*/
boolean isActive();
@@ -29,7 +29,7 @@ public interface NativeCanvas extends Canvas {
/**
* <code>isClosing</code> notifies if the window is currently closing. This could be caused via the application
* itself or external interrupts such as alt-f4 etc.
- *
+ *
* @return true if the window is closing, false otherwise.
*/
boolean isClosing();
@@ -38,7 +38,7 @@ public interface NativeCanvas extends Canvas {
* <code>setVSyncEnabled</code> attempts to enable or disable monitor vertical synchronization. The method is a
* "best attempt" to change the monitor vertical refresh synchronization, and is <b>not </b> guaranteed to be
* successful. This is dependent on OS.
- *
+ *
* @param enabled
* <code>true</code> to synchronize, <code>false</code> to ignore synchronization
*/
@@ -46,7 +46,7 @@ public interface NativeCanvas extends Canvas {
/**
* Sets the title of the display system. This is usually reflected by the renderer as text in the menu bar.
- *
+ *
* @param title
* The new display title.
*/
@@ -66,15 +66,15 @@ public interface NativeCanvas extends Canvas {
* Images should be in format RGBA8888. If they are not ardor3d will try to convert them using ImageUtils. If that
* fails a <code>Ardor3dException</code> could be thrown.
* </p>
- *
+ *
* @param iconImages
* Array of Images to be used as icons.
*/
void setIcon(Image[] iconImages);
/**
- * If running in windowed mode, move the window's position to the given display coordinates.
- *
+ * If running in windowed mode, move the window's position to the given display coordinates in window units.
+ *
* @param locX
* @param locY
*/
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java
index 83ff0ef..e4d4d09 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java
@@ -71,7 +71,7 @@ public class JoglCanvasRenderer implements CanvasRenderer {
/**
* Default constructor, with debug disabled, using the default utility for the capabilities and with context drop
* and reclaim on draw disabled
- *
+ *
* @param scene
* data related to the scene (cannot be null)
*/
@@ -81,7 +81,7 @@ public class JoglCanvasRenderer implements CanvasRenderer {
/**
* Main constructor
- *
+ *
* @param scene
* data related to the scene
* @param useDebug
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java
index f6b25d4..6edec0b 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java
@@ -114,14 +114,79 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer {
return _newtWindow.getContext();
}
+ /**
+ * Returns the width of the client area including insets (window decorations) in window units.
+ *
+ * @return width of the client area including insets (window decorations) in window units
+ */
public int getWidth() {
+ return _newtWindow.getWidth() + (_newtWindow.getInsets() == null ? 0 : _newtWindow.getInsets().getTotalWidth());
+ }
+
+ /**
+ * Returns the width of the client area including insets (window decorations) in pixel units.
+ *
+ * @return width of the client area including insets (window decorations) in pixel units
+ */
+ public int getWidthInPixelUnits() {
+ return _newtWindow.convertToPixelUnits(new int[] { getWidth(), 0 })[0];
+ }
+
+ /**
+ * Returns the width of the client area excluding insets (window decorations) in window units.
+ *
+ * @return width of the client area excluding insets (window decorations) in window units
+ */
+ public int getSurfaceWidthInWindowUnits() {
return _newtWindow.getWidth();
}
+ /**
+ * Returns the width of the client area excluding insets (window decorations) in pixel units.
+ *
+ * @return width of the client area excluding insets (window decorations) in pixel units
+ */
+ public int getSurfaceWidth() {
+ return _newtWindow.getSurfaceWidth();
+ }
+
+ /**
+ * Returns the height of the client area including insets (window decorations) in window units.
+ *
+ * @return height of the client area including insets (window decorations) in window units
+ */
public int getHeight() {
+ return _newtWindow.getHeight()
+ + (_newtWindow.getInsets() == null ? 0 : _newtWindow.getInsets().getTotalHeight());
+ }
+
+ /**
+ * Returns the height of the client area including insets (window decorations) in pixel units.
+ *
+ * @return height of the client area including insets (window decorations) in pixel units
+ */
+ public int getHeightInPixelUnits() {
+ return _newtWindow.convertToPixelUnits(new int[] { 0, getHeight() })[1];
+ }
+
+ /**
+ * Returns the height of the client area excluding insets (window decorations) in window units.
+ *
+ * @return height of the client area excluding insets (window decorations) in window units
+ */
+ public int getSurfaceHeightInWindowUnits() {
return _newtWindow.getHeight();
}
+ /**
+ * Returns the height of the client area excluding insets (window decorations) in pixel units.
+ *
+ * @return height of the client area excluding insets (window decorations) in pixel units
+ */
+ public int getSurfaceHeight() {
+ return _newtWindow.getSurfaceHeight();
+ }
+
public int getX() {
return _newtWindow.getX();
}
@@ -144,7 +209,7 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer {
/**
* Enables or disables automatic buffer swapping for this JoglNewtWindow. By default this property is set to false
- *
+ *
* @param autoSwapBufferModeEnabled
*/
public void setAutoSwapBufferMode(final boolean autoSwapBufferModeEnabled) {
@@ -260,7 +325,7 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer {
@Override
public void moveWindowTo(final int locX, final int locY) {
- _newtWindow.setPosition(locX, locY);
+ _newtWindow.setTopLevelPosition(locX, locY);
}
@Override