Input fixes

This commit is contained in:
Anuken
2020-07-19 13:00:55 -04:00
parent c2d6076407
commit 9521af7be5
2 changed files with 15 additions and 2 deletions

View File

@@ -576,6 +576,10 @@ public class DesktopInput extends InputHandler{
boolean boosted = (unit instanceof Mechc && unit.isFlying()); boolean boosted = (unit instanceof Mechc && unit.isFlying());
movement.set(xa, ya).nor().scl(speed); movement.set(xa, ya).nor().scl(speed);
if(Core.input.keyDown(Binding.mouse_move)){
movement.add(input.mouseWorld().sub(player).scl(1f / 25f * speed)).limit(speed);
}
float mouseAngle = Angles.mouseAngle(unit.x, unit.y); float mouseAngle = Angles.mouseAngle(unit.x, unit.y);
boolean aimCursor = omni && player.shooting && unit.type().hasWeapons() && unit.type().faceTarget && !boosted && unit.type().rotateShooting; boolean aimCursor = omni && player.shooting && unit.type().hasWeapons() && unit.type().faceTarget && !boosted && unit.type().rotateShooting;

View File

@@ -422,6 +422,7 @@ public class MobileInput extends InputHandler implements GestureListener{
lastSchematic = schem; lastSchematic = schem;
} }
@Override @Override
public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){ public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){
if(state.isMenu()) return false; if(state.isMenu()) return false;
@@ -568,8 +569,16 @@ public class MobileInput extends InputHandler implements GestureListener{
}else if(mode == breaking && validBreak(linked.x,linked.y) && !hasRequest(linked)){ }else if(mode == breaking && validBreak(linked.x,linked.y) && !hasRequest(linked)){
//add to selection queue if it's a valid BREAK position //add to selection queue if it's a valid BREAK position
selectRequests.add(new BuildPlan(linked.x, linked.y)); selectRequests.add(new BuildPlan(linked.x, linked.y));
}else if(!canTapPlayer(worldx, worldy) && !tileTapped(linked.build)){ }else{
tryBeginMine(cursor); if(!canTapPlayer(worldx, worldy) && !tileTapped(linked.build)){
tryBeginMine(cursor);
}
//apply command on double tap
if(count == 2 && Mathf.within(worldx, worldy, player.unit().x, player.unit().y, player.unit().hitSize * 2f) &&
player.unit() instanceof Commanderc){
Call.unitCommand(player);
}
} }
return false; return false;