Fixed endless scrolling and removed cursor on rasp

This commit is contained in:
jancoow
2015-07-09 12:30:04 +02:00
parent 61fdeb27c5
commit 713cfaf836
3 changed files with 36 additions and 19 deletions
+24 -7
View File
@@ -17,6 +17,7 @@ public class NetworkHandler implements Runnable{
private String host;
private int port;
private long fistpressed;
private boolean running;
private Thread t;
@@ -111,7 +112,7 @@ public class NetworkHandler implements Runnable{
}
if(control[7] == 0 && control[8] == 0){
if(JoystickHandler.j.getPos() != Position.UP_LEFT)
if(JoystickHandler.j.getPos() != Position.UP_LEFT )
{
JoystickHandler.j.setPosition(Position.UP_LEFT);
jth.onJoystickMoved(JoystickHandler.j);
@@ -140,10 +141,18 @@ public class NetworkHandler implements Runnable{
}
else if(control[7] == 0){
if(JoystickHandler.j.getPos() != Position.UP)
if(JoystickHandler.j.getPos() != Position.UP || JoystickHandler.REPEAT)
{
JoystickHandler.j.setPosition(Position.UP);
jth.onJoystickMoved(JoystickHandler.j);
if(JoystickHandler.j.getPos() != Position.UP)
{
fistpressed = System.currentTimeMillis();
JoystickHandler.j.setPosition(Position.UP);
jth.onJoystickMoved(JoystickHandler.j);
}
if((fistpressed + 500) < System.currentTimeMillis()){
JoystickHandler.j.setPosition(Position.UP);
jth.onJoystickMoved(JoystickHandler.j);
}
}
}
else if(control[8] == 0){
@@ -161,13 +170,21 @@ public class NetworkHandler implements Runnable{
}
}
else if(control[10] == 0){
if(JoystickHandler.j.getPos() != Position.DOWN)
if(JoystickHandler.j.getPos() != Position.DOWN || JoystickHandler.REPEAT)
{
JoystickHandler.j.setPosition(Position.DOWN);
jth.onJoystickMoved(JoystickHandler.j);
if(JoystickHandler.j.getPos() != Position.DOWN){
fistpressed = System.currentTimeMillis();
JoystickHandler.j.setPosition(Position.DOWN);
jth.onJoystickMoved(JoystickHandler.j);
}
if((fistpressed + 500) < System.currentTimeMillis()){
JoystickHandler.j.setPosition(Position.DOWN);
jth.onJoystickMoved(JoystickHandler.j);
}
}
}else {
if(JoystickHandler.j.getPos() != Position.CENTER){
fistpressed = 0;
JoystickHandler.j.setPosition(Position.CENTER);
jth.onJoystickMoved(JoystickHandler.j);
}
+3 -3
View File
@@ -177,8 +177,8 @@ public class ButtonHandler implements KeyListener{
buttons.add(new Button(1, 2, ntw));
buttons.add(new Button(2, 1, ntw));
buttons.add(new Button(3, 0, ntw));
buttons.add(new Button(4, 3, ntw));
buttons.add(new Button(5, 4, ntw));
buttons.add(new Button(6, 5, ntw));
buttons.add(new Button(4, -1, ntw));
buttons.add(new Button(5, 3, ntw));
buttons.add(new Button(6, 4, ntw));
}
}