use of com.bladecoder.engineeditor.undo.UndoDeleteActor in project bladecoder-adventure-engine by bladecoder.
the class ScnWidgetInputListener method keyDown.
@Override
public boolean keyDown(InputEvent event, int keycode) {
super.keyDown(event, keycode);
Polygon p = null;
if (scnWidget.getStage() == null || scnWidget.getStage().getKeyboardFocus() != scnWidget)
return false;
switch(keycode) {
case Keys.ENTER:
break;
case Keys.BACKSPACE:
break;
case Keys.Z:
if (UIUtils.ctrl()) {
Ctx.project.getUndoStack().undo();
}
break;
case Keys.FORWARD_DEL:
BaseActor a = Ctx.project.getSelectedActor();
if (a == null)
return false;
Ctx.project.getUndoStack().add(new UndoDeleteActor(Ctx.project.getSelectedScene(), a));
Ctx.project.getSelectedScene().removeActor(a);
Ctx.project.setModified(this, Project.NOTIFY_ELEMENT_DELETED, null, a);
break;
case Keys.S:
if (UIUtils.ctrl()) {
try {
Ctx.project.saveProject();
} catch (IOException e1) {
String msg = "Something went wrong while saving the actor.\n\n" + e1.getClass().getSimpleName() + " - " + e1.getMessage();
Message.showMsgDialog(scnWidget.getStage(), "Error", msg);
EditorLogger.printStackTrace(e1);
}
}
break;
case Keys.UP:
case Keys.DOWN:
case Keys.LEFT:
case Keys.RIGHT:
selActor = scnWidget.getSelectedActor();
p = selActor.getBBox();
undoOrg.set(p.getX(), p.getY());
Ctx.project.setModified(this, Project.POSITION_PROPERTY, null, selActor);
break;
case Keys.PLUS:
case 70:
scnWidget.zoom(-1);
break;
case Keys.MINUS:
scnWidget.zoom(1);
break;
}
return false;
}
use of com.bladecoder.engineeditor.undo.UndoDeleteActor in project bladecoder-adventure-engine by bladecoder.
the class ActorList method delete.
@Override
protected void delete() {
BaseActor a = removeSelected();
parent.removeActor(a);
// delete player attr if the actor to delete is the player
if (parent.getPlayer() == a) {
parent.setPlayer(null);
}
// TRANSLATIONS
Ctx.project.getI18N().putTranslationsInElement(a);
// UNDO
Ctx.project.getUndoStack().add(new UndoDeleteActor(parent, a));
Ctx.project.setModified();
}
Aggregations