You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
788 B
54 lines
788 B
package mightypork.rogue.bus.events;
|
|
|
|
|
|
import mightypork.utils.math.coord.Coord;
|
|
import mightypork.utils.patterns.subscription.Handleable;
|
|
|
|
|
|
public class MouseMotionEvent implements Handleable<MouseMotionEvent.Listener> {
|
|
|
|
private Coord move;
|
|
private Coord pos;
|
|
|
|
|
|
public MouseMotionEvent(Coord pos, Coord move) {
|
|
this.move = move;
|
|
this.pos = pos;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return movement since last {@link MouseMotionEvent}
|
|
*/
|
|
public Coord getPosDelta()
|
|
{
|
|
return move;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return current mouse position
|
|
*/
|
|
public Coord getPos()
|
|
{
|
|
return pos;
|
|
}
|
|
|
|
|
|
@Override
|
|
public void handleBy(Listener keh)
|
|
{
|
|
keh.receive(this);
|
|
}
|
|
|
|
public interface Listener {
|
|
|
|
/**
|
|
* Handle an event
|
|
*
|
|
* @param event event
|
|
*/
|
|
public void receive(MouseMotionEvent event);
|
|
}
|
|
|
|
}
|
|
|