Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor to avoid invoking AppSettings.getBoolean() directly #1796

Merged
merged 5 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jme3-core/src/main/java/com/jme3/app/LegacyApplication.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2022 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -343,7 +343,7 @@ private void initInput() {
if (touchInput != null)
touchInput.initialize();

if (!settings.getBoolean("DisableJoysticks")) {
if (settings.useJoysticks()) {
joyInput = context.getJoyInput();
if (joyInput != null)
joyInput.initialize();
Expand Down
14 changes: 7 additions & 7 deletions jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2022 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -159,15 +159,15 @@ protected int[] getGLVersion(String renderer) {

protected ContextAttribs createContextAttribs() {
int vers[] = getGLVersion(settings.getRenderer());
if (settings.getBoolean("GraphicsDebug") || (vers != null && vers[0] != 2)) {
if (settings.isGraphicsDebug() || (vers != null && vers[0] != 2)) {
ContextAttribs attr;
if (vers != null && vers[0] != 2) {
attr = new ContextAttribs(vers[0], vers[1]);
attr = attr.withProfileCore(true).withForwardCompatible(true).withProfileCompatibility(false);
} else {
attr = new ContextAttribs();
}
if (settings.getBoolean("GraphicsDebug")) {
if (settings.isGraphicsDebug()) {
attr = attr.withDebug(true);
}
return attr;
Expand Down Expand Up @@ -290,18 +290,18 @@ private void initContext(boolean first) {
glfbo = new LwjglGLFboEXT();
}

if (settings.getBoolean("GraphicsDebug")) {
if (settings.isGraphicsDebug()) {
gl = (GL) GLDebug.createProxy(gl, gl, GL.class, GL2.class, GL3.class, GL4.class);
glext = (GLExt) GLDebug.createProxy(gl, glext, GLExt.class);
glfbo = (GLFbo) GLDebug.createProxy(gl, glfbo, GLFbo.class);
}
if (settings.getBoolean("GraphicsTiming")) {
if (settings.isGraphicsTiming()) {
GLTimingState timingState = new GLTimingState();
gl = (GL) GLTiming.createGLTiming(gl, timingState, GL.class, GL2.class, GL3.class, GL4.class);
glext = (GLExt) GLTiming.createGLTiming(glext, timingState, GLExt.class);
glfbo = (GLFbo) GLTiming.createGLTiming(glfbo, timingState, GLFbo.class);
}
if (settings.getBoolean("GraphicsTrace")) {
if (settings.isGraphicsTrace()) {
gl = (GL) GLTracer.createDesktopGlTracer(gl, GL.class, GL2.class, GL3.class, GL4.class);
glext = (GLExt) GLTracer.createDesktopGlTracer(glext, GLExt.class);
glfbo = (GLFbo) GLTracer.createDesktopGlTracer(glfbo, GLFbo.class);
Expand All @@ -312,7 +312,7 @@ private void initContext(boolean first) {
} else {
throw new UnsupportedOperationException("Unsupported renderer: " + settings.getRenderer());
}
if (GLContext.getCapabilities().GL_ARB_debug_output && settings.getBoolean("GraphicsDebug")) {
if (GLContext.getCapabilities().GL_ARB_debug_output && settings.isGraphicsDebug()) {
ARBDebugOutput.glDebugMessageCallbackARB(new ARBDebugOutputCallback(new LwjglGLDebugOutputHandler()));
}
renderer.setMainFrameBufferSrgb(settings.isGammaCorrection());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* Copyright (c) 2009-2022 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -217,20 +217,20 @@ private void initContext(boolean first) {
glfbo = new LwjglGLFboEXT();
}

if (settings.getBoolean("GraphicsDebug")) {
if (settings.isGraphicsDebug()) {
gl = (GL) GLDebug.createProxy(gl, gl, GL.class, GL2.class, GL3.class, GL4.class);
glext = (GLExt) GLDebug.createProxy(gl, glext, GLExt.class);
glfbo = (GLFbo) GLDebug.createProxy(gl, glfbo, GLFbo.class);
}

if (settings.getBoolean("GraphicsTiming")) {
if (settings.isGraphicsTiming()) {
GLTimingState timingState = new GLTimingState();
gl = (GL) GLTiming.createGLTiming(gl, timingState, GL.class, GL2.class, GL3.class, GL4.class);
glext = (GLExt) GLTiming.createGLTiming(glext, timingState, GLExt.class);
glfbo = (GLFbo) GLTiming.createGLTiming(glfbo, timingState, GLFbo.class);
}

if (settings.getBoolean("GraphicsTrace")) {
if (settings.isGraphicsTrace()) {
gl = (GL) GLTracer.createDesktopGlTracer(gl, GL.class, GL2.class, GL3.class, GL4.class);
glext = (GLExt) GLTracer.createDesktopGlTracer(glext, GLExt.class);
glfbo = (GLFbo) GLTracer.createDesktopGlTracer(glfbo, GLFbo.class);
Expand All @@ -240,7 +240,7 @@ private void initContext(boolean first) {
}
this.renderer.initialize();

if (capabilities.GL_ARB_debug_output && settings.getBoolean("GraphicsDebug")) {
if (capabilities.GL_ARB_debug_output && settings.isGraphicsDebug()) {
ARBDebugOutput.glDebugMessageCallbackARB(new LwjglGLDebugOutputHandler(), 0);
}

Expand Down
2 changes: 1 addition & 1 deletion jme3-vr/src/main/java/com/jme3/app/VRApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ private void initInput(){
if (touchInput != null)
touchInput.initialize();

if (!settings.getBoolean("DisableJoysticks")){
if (settings.useJoysticks()){
joyInput = context.getJoyInput();
if (joyInput != null)
joyInput.initialize();
Expand Down
10 changes: 5 additions & 5 deletions jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.jme3.system.lwjgl;

/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2022 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -166,20 +166,20 @@ protected void initContextFirstTime() {
glfbo = new LwjglGLFboEXT();
}

if (settings.getBoolean("GraphicsDebug")) {
if (settings.isGraphicsDebug()) {
gl = (GL) GLDebug.createProxy(gl, gl, GL.class, GL2.class, GL3.class, GL4.class);
glext = (GLExt) GLDebug.createProxy(gl, glext, GLExt.class);
glfbo = (GLFbo) GLDebug.createProxy(gl, glfbo, GLFbo.class);
}

if (settings.getBoolean("GraphicsTiming")) {
if (settings.isGraphicsTiming()) {
GLTimingState timingState = new GLTimingState();
gl = (GL) GLTiming.createGLTiming(gl, timingState, GL.class, GL2.class, GL3.class, GL4.class);
glext = (GLExt) GLTiming.createGLTiming(glext, timingState, GLExt.class);
glfbo = (GLFbo) GLTiming.createGLTiming(glfbo, timingState, GLFbo.class);
}

if (settings.getBoolean("GraphicsTrace")) {
if (settings.isGraphicsTrace()) {
gl = (GL) GLTracer.createDesktopGlTracer(gl, GL.class, GL2.class, GL3.class, GL4.class);
glext = (GLExt) GLTracer.createDesktopGlTracer(glext, GLExt.class);
glfbo = (GLFbo) GLTracer.createDesktopGlTracer(glfbo, GLFbo.class);
Expand All @@ -191,7 +191,7 @@ protected void initContextFirstTime() {
throw new UnsupportedOperationException("Unsupported renderer: " + settings.getRenderer());
}

if (capabilities.GL_ARB_debug_output && settings.getBoolean("GraphicsDebug")) {
if (capabilities.GL_ARB_debug_output && settings.isGraphicsDebug()) {
ARBDebugOutput.glDebugMessageCallbackARB(new LwjglGLDebugOutputHandler(), 0);
}

Expand Down