Better Android keyboard support

This commit is contained in:
Anuken
2019-09-21 15:35:59 -04:00
parent 1957b6aa12
commit 0d25d83651
10 changed files with 78 additions and 59 deletions

View File

@@ -13,13 +13,7 @@ public class ControlsDialog extends KeybindDialog{
setFillParent(true);
title.setAlignment(Align.center);
titleTable.row();
titleTable.add(new Image())
.growX().height(3f).pad(4f).get().setColor(Pal.accent);
if(Vars.mobile){
cont.row();
cont.add("$keybinds.mobile")
.center().growX().wrap().get().setAlignment(Align.center);
}
titleTable.add(new Image()).growX().height(3f).pad(4f).get().setColor(Pal.accent);
}
@Override

View File

@@ -17,6 +17,7 @@ import io.anuke.mindustry.core.GameState.*;
import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.input.*;
import io.anuke.mindustry.ui.*;
import static io.anuke.arc.Core.bundle;
@@ -202,8 +203,20 @@ public class SettingsMenuDialog extends SettingsDialog{
game.screenshakePref();
if(mobile){
game.checkPref("autotarget", true);
game.checkPref("keyboard", false);
game.checkPref("keyboard", false, val -> control.setInput(val ? new DesktopInput() : new MobileInput()));
if(Core.settings.getBool("keyboard")){
control.setInput(new DesktopInput());
}
}
//the issue with touchscreen support on desktop is that:
//1) I can't test it
//2) the SDL backend doesn't support multitouch
/*else{
game.checkPref("touchscreen", false, val -> control.setInput(!val ? new DesktopInput() : new MobileInput()));
if(Core.settings.getBool("touchscreen")){
control.setInput(new MobileInput());
}
}*/
game.sliderPref("saveinterval", 60, 10, 5 * 120, i -> Core.bundle.format("setting.seconds", i));
if(!mobile){