1
0
forked from Clones/Controlify

small bits

This commit is contained in:
isXander
2023-02-21 22:28:08 +00:00
parent 75fa069a98
commit a40cd9a2e2
5 changed files with 206 additions and 190 deletions

View File

@ -3,8 +3,9 @@ package dev.isxander.controlify.controller.joystick;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import dev.isxander.controlify.controller.AbstractController;
import dev.isxander.controlify.controller.joystick.mapping.DataJoystickMapping;
import dev.isxander.controlify.controller.joystick.mapping.RPJoystickMapping;
import dev.isxander.controlify.controller.joystick.mapping.JoystickMapping;
import dev.isxander.controlify.controller.joystick.mapping.UnmappedJoystickMapping;
import org.hid4java.HidDevice;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
@ -23,7 +24,7 @@ public class JoystickController extends AbstractController<JoystickState, Joysti
this.buttonCount = GLFW.glfwGetJoystickButtons(joystickId).capacity();
this.hatCount = GLFW.glfwGetJoystickHats(joystickId).capacity();
this.mapping = Objects.requireNonNull(DataJoystickMapping.fromType(type()));
this.mapping = Objects.requireNonNull(RPJoystickMapping.fromType(type()));
this.config = new JoystickConfig(this);
this.defaultConfig = new JoystickConfig(this);
@ -49,6 +50,11 @@ public class JoystickController extends AbstractController<JoystickState, Joysti
return mapping;
}
@Override
public boolean canBeUsed() {
return !(mapping() instanceof UnmappedJoystickMapping);
}
public int axisCount() {
return axisCount;
}