Java Code Examples for com.badlogic.gdx.scenes.scene2d.utils.UIUtils#ctrl()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.utils.UIUtils#ctrl() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SceneGestureDetector.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
@Override
public boolean keyUp(int keycode) {
	switch (keycode) {
	case Input.Keys.ESCAPE:
	case Input.Keys.BACK:
	case Input.Keys.MENU:
		dsc.showMenu();
		break;
	case Input.Keys.D:
		if (UIUtils.ctrl())
			EngineLogger.toggle();
		break;
	case Input.Keys.SPACE:
		if (dsc.getDrawHotspots())
			dsc.setDrawHotspots(false);
		break;
	}

	return true;
}
 
Example 2
Source File: ScnWidgetInputListener.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void clicked(InputEvent event, float x, float y) {
	Scene scn = scnWidget.getScene();
	if (scn == null)
		return;

	Vector2 p = new Vector2(Gdx.input.getX(), Gdx.input.getY());
	scnWidget.screenToWorldCoords(p);

	// DOUBLE CLICK TO CREATE OR DELETE POINTS
	if (getTapCount() == 2 && scnWidget.getSelectedActor() != null) {

		Polygon poly = scnWidget.getSelectedActor().getBBox();

		if ((!(scnWidget.getSelectedActor() instanceof SpriteActor)
				|| !((SpriteActor) scnWidget.getSelectedActor()).isBboxFromRenderer())
				&& !(scnWidget.getSelectedActor() instanceof AnchorActor)) {
			if (UIUtils.ctrl()) {

				// Delete the point if selected
				boolean deleted = PolygonUtils.deletePoint(poly, p.x, p.y, CanvasDrawer.CORNER_DIST);

				if (deleted) {
					Ctx.project.setModified();
					return;
				}
			} else {
				boolean created = PolygonUtils.addClampPointIfTolerance(poly, p.x, p.y, CanvasDrawer.CORNER_DIST);

				if (created) {
					Ctx.project.setModified();
					return;
				}
			}
		}
	}
}
 
Example 3
Source File: AbstractListAdapter.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
private boolean isMultiSelectKeyPressed () {
	if (multiSelectKey == DEFAULT_KEY)
		return UIUtils.ctrl();
	else
		return Gdx.input.isKeyPressed(multiSelectKey);
}
 
Example 4
Source File: ScnWidgetInputListener.java    From bladecoder-adventure-engine with Apache License 2.0 4 votes vote down vote up
@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;
}