Fixed controllers not aiming properly

This commit is contained in:
Anuken
2018-05-01 17:04:32 -04:00
parent 941ebd39bf
commit 9776884a91
2 changed files with 15 additions and 5 deletions
+13 -5
View File
@@ -197,6 +197,11 @@ public class Control extends Module{
}); });
} }
//FIXME figure out what's causing this problem in the first place
public void triggerInputUpdate(){
Gdx.input = proxy;
}
public void setError(Throwable error){ public void setError(Throwable error){
this.error = error; this.error = error;
} }
@@ -301,9 +306,7 @@ public class Control extends Module{
throw new RuntimeException(error); throw new RuntimeException(error);
} }
if(Gdx.input != proxy){ Gdx.input = proxy;
Gdx.input = proxy;
}
if(Inputs.keyTap("console")){ if(Inputs.keyTap("console")){
console = !console; console = !console;
@@ -327,16 +330,21 @@ public class Control extends Module{
controly -= ya*baseControllerSpeed*scl; controly -= ya*baseControllerSpeed*scl;
controlling = true; controlling = true;
Gdx.input.setCursorCatched(true);
Inputs.getProcessor().touchDragged(Gdx.input.getX(), Gdx.input.getY(), 0); Inputs.getProcessor().touchDragged(Gdx.input.getX(), Gdx.input.getY(), 0);
} }
controlx = Mathf.clamp(controlx, 0, Gdx.graphics.getWidth()); controlx = Mathf.clamp(controlx, 0, Gdx.graphics.getWidth());
controly = Mathf.clamp(controly, 0, Gdx.graphics.getHeight()); controly = Mathf.clamp(controly, 0, Gdx.graphics.getHeight());
if(Gdx.input.getDeltaX() > 1 || Gdx.input.getDeltaY() > 1) if(Gdx.input.getDeltaX() > 1 || Gdx.input.getDeltaY() > 1) {
controlling = false; controlling = false;
Gdx.input.setCursorCatched(false);
}
}else{ }else{
controlling = false; controlling = false;
Gdx.input.setCursorCatched(false);
} }
if(!controlling){ if(!controlling){
@@ -111,6 +111,8 @@ public class Logic extends Module {
if(!state.is(State.menu)){ if(!state.is(State.menu)){
if(control != null) control.triggerInputUpdate();
if(!state.is(State.paused) || Net.active()){ if(!state.is(State.paused) || Net.active()){
Timers.update(); Timers.update();
} }