|
@@ -147,11 +147,11 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
|
|
protected boolean wasActive = false;
|
|
|
protected boolean autoFlush = true;
|
|
|
protected boolean allowSwapBuffers = false;
|
|
|
- /**
|
|
|
- * Set true if Retina/HiDPI frame buffer was enabled via AppSettings.
|
|
|
- */
|
|
|
- private boolean isScaledContent = false;
|
|
|
|
|
|
+ // temp variables used for glfw calls
|
|
|
+ private int width[] = new int[1];
|
|
|
+ private int height[] = new int[1];
|
|
|
+
|
|
|
public LwjglWindow(final JmeContext.Type type) {
|
|
|
|
|
|
if (!SUPPORTED_TYPES.contains(type)) {
|
|
@@ -258,9 +258,7 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
|
|
glfwWindowHint(GLFW_SAMPLES, settings.getSamples());
|
|
|
glfwWindowHint(GLFW_STEREO, settings.useStereo3D() ? GLFW_TRUE : GLFW_FALSE);
|
|
|
glfwWindowHint(GLFW_REFRESH_RATE, settings.getFrequency()<=0?GLFW_DONT_CARE:settings.getFrequency());
|
|
|
-
|
|
|
- isScaledContent = settings.isUseRetinaFrameBuffer();
|
|
|
- glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, isScaledContent ? GLFW_TRUE : GLFW_FALSE);
|
|
|
+ glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, settings.isUseRetinaFrameBuffer() ? GLFW_TRUE : GLFW_FALSE);
|
|
|
|
|
|
if (settings.getBitsPerPixel() == 24) {
|
|
|
glfwWindowHint(GLFW_RED_BITS, 8);
|
|
@@ -593,8 +591,6 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
|
|
if (framesAfterContextStarted < 2) {
|
|
|
framesAfterContextStarted++;
|
|
|
if (framesAfterContextStarted == 2) {
|
|
|
- int[] width = new int[1];
|
|
|
- int[] height = new int[1];
|
|
|
glfwGetFramebufferSize(window, width, height);
|
|
|
|
|
|
if (settings.getWidth() != width[0] || settings.getHeight() != height[0]) {
|
|
@@ -735,15 +731,6 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Test whether Retina/HiDPI frame buffer was enabled via AppSettings.
|
|
|
- *
|
|
|
- * @return true if enabled, otherwise false
|
|
|
- */
|
|
|
- public boolean isScaledContent() {
|
|
|
- return isScaledContent;
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public void setAutoFlushFrames(boolean enabled) {
|
|
|
this.autoFlush = enabled;
|
|
@@ -781,13 +768,15 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
|
|
* @see <a href="https://www.glfw.org/docs/latest/window_guide.html#window_scale">Window content scale</a>
|
|
|
*/
|
|
|
public Vector2f getWindowContentScale(Vector2f store) {
|
|
|
- float[] xScale = new float[1];
|
|
|
- float[] yScale = new float[1];
|
|
|
- glfwGetWindowContentScale(window, xScale, yScale);
|
|
|
+ if (store == null) store = new Vector2f();
|
|
|
|
|
|
- if (store != null) {
|
|
|
- return store.set(xScale[0], yScale[0]);
|
|
|
- }
|
|
|
- return new Vector2f(xScale[0], yScale[0]);
|
|
|
+ glfwGetFramebufferSize(window, width, height);
|
|
|
+ store.set(width[0], height[0]);
|
|
|
+
|
|
|
+ glfwGetWindowSize(window, width, height);
|
|
|
+ store.x /= width[0];
|
|
|
+ store.y /= height[0];
|
|
|
+
|
|
|
+ return store;
|
|
|
}
|
|
|
}
|