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

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){
this.error = error;
}
@@ -301,9 +306,7 @@ public class Control extends Module{
throw new RuntimeException(error);
}
if(Gdx.input != proxy){
Gdx.input = proxy;
}
Gdx.input = proxy;
if(Inputs.keyTap("console")){
console = !console;
@@ -327,16 +330,21 @@ public class Control extends Module{
controly -= ya*baseControllerSpeed*scl;
controlling = true;
Gdx.input.setCursorCatched(true);
Inputs.getProcessor().touchDragged(Gdx.input.getX(), Gdx.input.getY(), 0);
}
controlx = Mathf.clamp(controlx, 0, Gdx.graphics.getWidth());
controly = Mathf.clamp(controly, 0, Gdx.graphics.getHeight());
if(Gdx.input.getDeltaX() > 1 || Gdx.input.getDeltaY() > 1)
controlling = false;
if(Gdx.input.getDeltaX() > 1 || Gdx.input.getDeltaY() > 1) {
controlling = false;
Gdx.input.setCursorCatched(false);
}
}else{
controlling = false;
Gdx.input.setCursorCatched(false);
}
if(!controlling){

View File

@@ -111,6 +111,8 @@ public class Logic extends Module {
if(!state.is(State.menu)){
if(control != null) control.triggerInputUpdate();
if(!state.is(State.paused) || Net.active()){
Timers.update();
}