minor tweaks
This commit is contained in:
@@ -17,15 +17,15 @@ public class MIPKeyWalk implements MapInteractionPlugin {
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(MapView wv, PlayerControl player, Vect mouse)
|
||||
public void onClick(MapView wv, PlayerControl player, Vect mouse, boolean down)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onKey(MapView wv, PlayerControl player, int key)
|
||||
public void onKey(MapView wv, PlayerControl player, int key, boolean down)
|
||||
{
|
||||
walkByKey(player);
|
||||
if(down) walkByKey(player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,14 +16,16 @@ public class MIPMouseWalk implements MapInteractionPlugin {
|
||||
{
|
||||
if (InputSystem.isMouseButtonDown(0)) {
|
||||
// walk by holding btn
|
||||
onClick(wv, player, InputSystem.getMousePos());
|
||||
onClick(wv, player, InputSystem.getMousePos(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(MapView wv, PlayerControl player, Vect mouse)
|
||||
public void onClick(MapView wv, PlayerControl player, Vect mouse, boolean down)
|
||||
{
|
||||
if(!down) return;
|
||||
|
||||
final WorldPos plpos = player.getPos();
|
||||
final WorldPos clicked = wv.toWorldPos(mouse);
|
||||
|
||||
@@ -52,7 +54,7 @@ public class MIPMouseWalk implements MapInteractionPlugin {
|
||||
|
||||
|
||||
@Override
|
||||
public void onKey(MapView wv, PlayerControl player, int key)
|
||||
public void onKey(MapView wv, PlayerControl player, int key, boolean down)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ public interface MapInteractionPlugin {
|
||||
void onStepEnd(MapView wv, PlayerControl player);
|
||||
|
||||
|
||||
void onClick(MapView wv, PlayerControl player, Vect mouse);
|
||||
void onClick(MapView wv, PlayerControl player, Vect mouse, boolean down);
|
||||
|
||||
|
||||
void onKey(MapView wv, PlayerControl player, int key);
|
||||
void onKey(MapView wv, PlayerControl player, int key, boolean down);
|
||||
|
||||
}
|
||||
|
||||
@@ -95,10 +95,8 @@ public class MapView extends InputComponent implements KeyListener, MouseButtonL
|
||||
{
|
||||
if (!event.isOver(this)) return;
|
||||
|
||||
if (!event.isUp()) return; // only btn-release evt
|
||||
|
||||
for (final MapInteractionPlugin p : plugins) {
|
||||
p.onClick(this, pc, event.getPos());
|
||||
p.onClick(this, pc, event.getPos(), event.isDown());
|
||||
}
|
||||
|
||||
event.consume(); // only our clicks.
|
||||
@@ -108,10 +106,8 @@ public class MapView extends InputComponent implements KeyListener, MouseButtonL
|
||||
@Override
|
||||
public void receive(KeyEvent event)
|
||||
{
|
||||
if (!event.isDown()) return;
|
||||
|
||||
for (final MapInteractionPlugin p : plugins) {
|
||||
p.onKey(this, pc, event.getKey());
|
||||
p.onKey(this, pc, event.getKey(), event.isDown());
|
||||
}
|
||||
|
||||
// don't consume key events, can be useful for others.
|
||||
|
||||
Reference in New Issue
Block a user