Cleans up JoystickPreviewScreen a bit.

This commit is contained in:
Markil3
2020-12-15 22:44:41 -07:00
parent aeef7b2e3f
commit c860efcfed

View File

@@ -564,7 +564,7 @@ public class JoystickPreviewScreen extends BaseAppState
new ColorRGBA(0F, 0.75F, 0.25F, 1F); new ColorRGBA(0F, 0.75F, 0.25F, 1F);
protected Node gui; protected Node gui;
private BitmapFont guiFont; protected BitmapFont guiFont;
private Node[] gamepadCont; private Node[] gamepadCont;
@@ -588,15 +588,8 @@ public class JoystickPreviewScreen extends BaseAppState
this.updateGamepad(); this.updateGamepad();
this.setEnabled(true);
((SimpleApplication) this.getApplication()).getGuiNode() ((SimpleApplication) this.getApplication()).getGuiNode()
.attachChild(this.gui); .attachChild(this.gui);
this.resize(((SimpleApplication) this.getApplication()).getCamera()
.getWidth(),
((SimpleApplication) this.getApplication()).getCamera()
.getHeight());
this.setEnabled(true);
} }
/** /**
@@ -750,6 +743,10 @@ public class JoystickPreviewScreen extends BaseAppState
this.getApplication().getInputManager().addRawInputListener(this); this.getApplication().getInputManager().addRawInputListener(this);
this.getApplication().getInputManager() this.getApplication().getInputManager()
.addJoystickConnectionListener(this); .addJoystickConnectionListener(this);
this.resize(((SimpleApplication) this.getApplication()).getCamera()
.getWidth(),
((SimpleApplication) this.getApplication()).getCamera()
.getHeight());
} }
@Override @Override
@@ -998,7 +995,7 @@ public class JoystickPreviewScreen extends BaseAppState
* @param y - The current Y coordinate of the mouse. * @param y - The current Y coordinate of the mouse.
* @return Collision results on the GUI. * @return Collision results on the GUI.
*/ */
private CollisionResults checkMouse(int x, int y) protected CollisionResults checkMouse(int x, int y)
{ {
CollisionResults results = new CollisionResults(); CollisionResults results = new CollisionResults();
Ray ray = new Ray(new Vector3f(x, y, 0), new Vector3f(x, y, 1)); Ray ray = new Ray(new Vector3f(x, y, 0), new Vector3f(x, y, 1));
@@ -1072,6 +1069,7 @@ public class JoystickPreviewScreen extends BaseAppState
((Geometry) this.gamepadHeaders[i].getChild(0)) ((Geometry) this.gamepadHeaders[i].getChild(0))
.getMaterial().setColor("Color", .getMaterial().setColor("Color",
HIGHLIGHTED_BUTTON_COLOR); HIGHLIGHTED_BUTTON_COLOR);
evt.setConsumed();
} }
else else
{ {
@@ -1079,6 +1077,7 @@ public class JoystickPreviewScreen extends BaseAppState
((Geometry) this.gamepadHeaders[i].getChild(0)) ((Geometry) this.gamepadHeaders[i].getChild(0))
.getMaterial() .getMaterial()
.setColor("Color", BUTTON_COLOR); .setColor("Color", BUTTON_COLOR);
evt.setConsumed();
} }
} }
break; break;