use of com.badlogic.gdx.scenes.scene2d.InputEvent.Type in project gaiasky by langurmonkey.
the class OwnImageButton method initialize.
private void initialize() {
cursor = SystemCursor.Hand;
this.addListener(event -> {
if (event instanceof InputEvent) {
Type type = ((InputEvent) event).getType();
if (type == Type.enter) {
if (!me.isDisabled())
Gdx.graphics.setSystemCursor(cursor);
return true;
} else if (type == Type.exit) {
Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
return true;
}
}
return false;
});
}
use of com.badlogic.gdx.scenes.scene2d.InputEvent.Type in project gaiasky by langurmonkey.
the class ColorPicker method initialize.
protected void initialize() {
this.addListener(event -> {
if (event instanceof InputEvent) {
InputEvent ie = (InputEvent) event;
Type type = ie.getType();
// Click
if ((type == Type.touchDown) && (ie.getButton() == Buttons.LEFT)) {
// Launch color picker window
ColorPickerDialog cpd = new ColorPickerDialog(name, color, stage, skin);
cpd.setAcceptRunnable(() -> {
// Set color and run runnable, if any
setPickedColor(cpd.color);
if (newColorRunnable != null) {
newColorRunnable.run();
}
});
cpd.show(stage);
} else if (type == Type.enter) {
Gdx.graphics.setSystemCursor(SystemCursor.Hand);
} else if (type == Type.exit) {
Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
}
return true;
}
return false;
});
}
Aggregations