klenwell information services : PlaynListener

PlayN Listener Patters

return to DevPlayN

Pointer General Listener

PlayN.pointer().setListener(new Pointer.Listener() {
    @Override
    public void onPointerStart(Pointer.Event event) {
        PlayN.log().info("Pointer start: " + event);
        PlayN.log().info("is touch? " + event.isTouch());
    }
   
    @Override
    public void onPointerEnd(Pointer.Event event) {
        PlayN.log().info("Pointer end: " + event);
    }

    @Override
    public void onPointerDrag(Pointer.Event event) {
        PlayN.log().info("Pointer drag: " + event);
    }
});



Pointer Layer Listener

ImageLayer myImageLayer = myImage.layer();

myImageLayer.addListener(new Pointer.Listener() {
    @Override
    public void onPointerStart(Pointer.Event event) {
        PlayN.log().info("Pointer start: " + event);
        PlayN.log().info("is touch? " + event.isTouch());
    }
   
    @Override
    public void onPointerEnd(Pointer.Event event) {
        PlayN.log().info("Pointer end: " + event);
    }

    @Override
    public void onPointerDrag(Pointer.Event event) {
        PlayN.log().info("Pointer drag: " + event);
    }
});