Various fixes

This commit is contained in:
Anuken
2019-06-30 00:07:04 -04:00
parent 8bc59fb67c
commit 12bff75586
30 changed files with 6260 additions and 4825 deletions

View File

@@ -141,7 +141,7 @@ public class DesktopInput extends InputHandler{
if(state.is(State.menu) || Core.scene.hasDialog()) return;
//zoom and rotate things
//zoom things
if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && (Core.input.keyDown(Binding.zoom_hold))){
renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
}

View File

@@ -265,7 +265,7 @@ public class MobileInput extends InputHandler implements GestureListener{
table.row();
table.left().margin(0f).defaults().size(48f);
table.addImageButton("icon-break", "clear-toggle-partial", iconsize, () -> {
table.addImageButton("icon-break-small", "clear-toggle-partial", iconsizesmall, () -> {
mode = mode == breaking ? block == null ? none : placing : breaking;
lastBlock = block;
if(mode == breaking){
@@ -274,17 +274,17 @@ public class MobileInput extends InputHandler implements GestureListener{
}).update(l -> l.setChecked(mode == breaking));
//diagonal swap button
table.addImageButton("icon-diagonal", "clear-toggle-partial", iconsize, () -> {
table.addImageButton("icon-diagonal-small", "clear-toggle-partial", iconsizesmall, () -> {
Core.settings.put("swapdiagonal", !Core.settings.getBool("swapdiagonal"));
Core.settings.save();
}).update(l -> l.setChecked(Core.settings.getBool("swapdiagonal")));
//rotate button
table.addImageButton("icon-arrow", "clear-partial", iconsize, () -> rotation = Mathf.mod(rotation + 1, 4))
table.addImageButton("icon-arrow-small", "clear-partial", iconsizesmall, () -> rotation = Mathf.mod(rotation + 1, 4))
.update(i -> i.getImage().setRotationOrigin(rotation * 90, Align.center)).visible(() -> block != null && block.rotate);
//confirm button
table.addImageButton("icon-check", "clear-partial", iconsize, () -> {
table.addImageButton("icon-check-small", "clear-partial", iconsizesmall, () -> {
for(PlaceRequest request : selection){
Tile tile = request.tile();
@@ -475,7 +475,10 @@ public class MobileInput extends InputHandler implements GestureListener{
//call tap events
if(pointer == 0 && !selecting && mode == none){
tryTapPlayer(worldx, worldy);
if(!tryTapPlayer(worldx, worldy) && Core.settings.getBool("keyboard")){
//shoot on touch down when in keyboard mode
player.isShooting = true;
}
}
return false;
@@ -598,6 +601,27 @@ public class MobileInput extends InputHandler implements GestureListener{
mode = none;
}
//zoom things
if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && (Core.input.keyDown(Binding.zoom_hold))){
renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
}
if(!Core.settings.getBool("keyboard")){
//move camera around
float camSpeed = 6f;
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta() * camSpeed));
}
if(Core.settings.getBool("keyboard")){
if(Core.input.keyRelease(Binding.select)){
player.isShooting = false;
}
if(player.isShooting && !canShoot()){
player.isShooting = false;
}
}
//reset state when not placing
if(mode == none){
selecting = false;
@@ -678,7 +702,7 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override
public boolean pan(float x, float y, float deltaX, float deltaY){
if(Core.scene.hasDialog()) return false;
if(Core.scene.hasDialog() || Core.settings.getBool("keyboard")) return false;
float scale = Core.camera.width / Core.graphics.getWidth();
deltaX *= scale;
@@ -723,6 +747,7 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override
public boolean zoom(float initialDistance, float distance){
if(Core.settings.getBool("keyboard")) return false;
if(lastDistance == -1) lastDistance = initialDistance;
float amount = (Mathf.sign(distance > lastDistance) * 0.04f) * Time.delta();