Use GLFW gamepad instead of joystick.

This commit is contained in:
LambdAurora
2019-12-03 13:31:12 +01:00
parent 4fe7f70ffa
commit 597f581f0a
12 changed files with 607 additions and 175 deletions

View File

@@ -32,6 +32,7 @@ public class LambdaControlsSettingsScreen extends Screen
private final GameOptions options;
private final Option dead_zone_option;
private final Option rotation_speed_option;
private final Option mouse_speed_option;
public LambdaControlsSettingsScreen(Screen parent, @NotNull GameOptions options)
{
@@ -39,18 +40,34 @@ public class LambdaControlsSettingsScreen extends Screen
this.mod = LambdaControls.get();
this.parent = parent;
this.options = options;
this.dead_zone_option = new DoubleOption("lambdacontrols.menu.dead_zone", 0.05D, 1.0D, 0.05F, game_options -> this.mod.config.get_dead_zone(),
this.dead_zone_option = new DoubleOption("lambdacontrols.menu.dead_zone", 0.05, 1.0, 0.05F, game_options -> this.mod.config.get_dead_zone(),
(game_options, new_value) -> {
synchronized (this.mod.config) {
this.mod.config.set_dead_zone(new_value);
}
}, (game_options, option) -> option.getDisplayPrefix() + option.get(options));
this.rotation_speed_option = new DoubleOption("lambdacontrols.menu.rotation_speed", 0.0D, 50.0D, 0.5F, game_options -> this.mod.config.get_rotation_speed(),
}, (game_options, option) -> {
String value = String.valueOf(option.get(options));
return option.getDisplayPrefix() + value.substring(0, value.length() > 5 ? 5 : value.length());
});
this.rotation_speed_option = new DoubleOption("lambdacontrols.menu.rotation_speed", 0.0, 50.0, 0.5F, game_options -> this.mod.config.get_rotation_speed(),
(game_options, new_value) -> {
synchronized (this.mod.config) {
this.mod.config.set_rotation_speed(new_value);
}
}, (game_options, option) -> option.getDisplayPrefix() + option.get(options));
this.mouse_speed_option = new DoubleOption("lambdacontrols.menu.mouse_speed", 0.0, 50.0, 0.5F, game_options -> this.mod.config.get_mouse_speed(),
(game_options, new_value) -> {
synchronized (this.mod.config) {
this.mod.config.set_mouse_speed(new_value);
}
}, (game_options, option) -> option.getDisplayPrefix() + option.get(options));
}
@Override
public void removed()
{
this.mod.config.save();
super.removed();
}
@Override
@@ -86,6 +103,7 @@ public class LambdaControlsSettingsScreen extends Screen
btn -> this.minecraft.openScreen(new ControlsOptionsScreen(this, this.options))));
this.addButton(this.dead_zone_option.createButton(this.options, this.width / 2 - 155, (y += spacing + button_height), 150));
this.addButton(this.rotation_speed_option.createButton(this.options, this.width / 2 - 155 + 160, y, 150));
this.addButton(this.mouse_speed_option.createButton(this.options, this.width / 2 - 155, (y += spacing + button_height), 150));
this.addButton(new ButtonWidget(this.width / 2 - 155 + 160, this.height - 29, 150, button_height, I18n.translate("gui.done"), (buttonWidget) -> {
this.minecraft.openScreen(this.parent);
}));