com.badlogic.gdx.graphics.Cursor Java Examples

The following examples show how to use com.badlogic.gdx.graphics.Cursor. 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: DialogSceneComposer.java    From skin-composer with MIT License 5 votes vote down vote up
public void updateMenuUndoRedo() {
    if (model.undoables.size > 0) {
        undoButton.setDisabled(false);
        undoTooltip.getActor().setText(model.undoables.peek().getUndoString());
        undoTooltip.getContainer().pack();
        undoButton.addListener(undoTooltip);
        undoButton.addListener(main.getHandListener());
    } else {
        undoButton.setDisabled(true);
        undoTooltip.hide();
        undoButton.removeListener(undoTooltip);
        undoButton.removeListener(main.getHandListener());
        Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
    }

    if (model.redoables.size > 0) {
        redoButton.setDisabled(false);
        redoTooltip.getActor().setText(model.redoables.peek().getRedoString());
        redoTooltip.getContainer().pack();
        redoButton.addListener(redoTooltip);
        redoButton.addListener(main.getHandListener());
    } else {
        redoButton.setDisabled(true);
        redoTooltip.hide();
        redoButton.removeListener(redoTooltip);
        redoButton.removeListener(main.getHandListener());
        Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
    }
}
 
Example #2
Source File: ResizeArrowListener.java    From skin-composer with MIT License 5 votes vote down vote up
@Override
public void exit(InputEvent event, float x, float y, int pointer,
        Actor toActor) {
    if (!draggingCursor && event.getListenerActor().equals(event.getTarget())) {
        Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
    }
}
 
Example #3
Source File: ResizeArrowListener.java    From skin-composer with MIT License 5 votes vote down vote up
@Override
public void enter(InputEvent event, float x, float y, int pointer,
        Actor fromActor) {
    if (!draggingCursor && event.getListenerActor().equals(event.getTarget())) {
        if (vertical) {
            Gdx.graphics.setSystemCursor(Cursor.SystemCursor.VerticalResize);
        } else {
            Gdx.graphics.setSystemCursor(Cursor.SystemCursor.HorizontalResize);
        }
    }
}
 
Example #4
Source File: TalosMain.java    From talos with Apache License 2.0 5 votes vote down vote up
public void setCursor(Cursor cursor) {
	if(currentCursor != cursor) {
		if(cursor != null) {
			Gdx.graphics.setCursor(cursor);
		} else {
			Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
		}
		currentCursor = cursor;
	}
}
 
Example #5
Source File: ResizeArrowListener.java    From skin-composer with MIT License 5 votes vote down vote up
@Override
public void dragStart(InputEvent event, float x, float y,
        int pointer) {
    if (!draggingCursor && event.getListenerActor().equals(event.getTarget())) {
        if (vertical) {
            Gdx.graphics.setSystemCursor(Cursor.SystemCursor.VerticalResize);
        } else {
            Gdx.graphics.setSystemCursor(Cursor.SystemCursor.HorizontalResize);
        }
        draggingCursor = true;
    }
}
 
Example #6
Source File: ResizeFourArrowListener.java    From skin-composer with MIT License 5 votes vote down vote up
@Override
public void exit(InputEvent event, float x, float y, int pointer,
        Actor toActor) {
    if (event.getListenerActor().equals(event.getTarget()) && !Gdx.input.isButtonPressed(Buttons.LEFT)) {
        Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
    }
}
 
Example #7
Source File: SplitPaneCursorManager.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
private void setCustomCursor () {
	Cursor.SystemCursor targetCursor;
	if (vertical) {
		targetCursor = Cursor.SystemCursor.VerticalResize;
	} else {
		targetCursor = Cursor.SystemCursor.HorizontalResize;
	}

	if (currentCursor != targetCursor) {
		Gdx.graphics.setSystemCursor(targetCursor);
		currentCursor = targetCursor;
	}
}
 
Example #8
Source File: Lwjgl3Mini2DxGraphics.java    From mini2Dx with Apache License 2.0 4 votes vote down vote up
@Override
public void setCursor(Cursor cursor) {
	GLFW.glfwSetCursor(getWindow().getWindowHandle(), ((Lwjgl3Mini2DxCursor) cursor).glfwCursor);
}
 
Example #9
Source File: Lwjgl3Mini2DxGraphics.java    From mini2Dx with Apache License 2.0 4 votes vote down vote up
@Override
public Cursor newCursor(Pixmap pixmap, int xHotspot, int yHotspot) {
	return new Lwjgl3Mini2DxCursor(getWindow(), pixmap, xHotspot, yHotspot);
}
 
Example #10
Source File: IOSMini2DxGraphics.java    From mini2Dx with Apache License 2.0 4 votes vote down vote up
@Override
public void setCursor (Cursor cursor) {
}
 
Example #11
Source File: IOSMini2DxGraphics.java    From mini2Dx with Apache License 2.0 4 votes vote down vote up
@Override
public Cursor newCursor (Pixmap pixmap, int xHotspot, int yHotspot) {
	return null;
}
 
Example #12
Source File: CursorManager.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
/**
 * Sets cursor that will be used as default when {@link #restoreDefaultCursor()} is called, for example by Vis widget.
 * @param defaultCursor default cursor from {@link Cursor.SystemCursor}, can't be null
 */
public static void setDefaultCursor (Cursor.SystemCursor defaultCursor) {
	if (defaultCursor == null) throw new IllegalArgumentException("defaultCursor can't be null");
	CursorManager.defaultSystemCursor = defaultCursor;
	CursorManager.systemCursorAsDefault = true;
}
 
Example #13
Source File: CursorManager.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
/**
 * Sets cursor that will be used as default when {@link #restoreDefaultCursor()} is called, for example by VisUI widget.
 * @param defaultCursor default cursor, can't be null
 */
public static void setDefaultCursor (Cursor defaultCursor) {
	if (defaultCursor == null) throw new IllegalArgumentException("defaultCursor can't be null");
	CursorManager.defaultCursor = defaultCursor;
	CursorManager.systemCursorAsDefault = false;
}
 
Example #14
Source File: HandListener.java    From skin-composer with MIT License 4 votes vote down vote up
@Override
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
    if (!(event.getListenerActor() instanceof Disableable) || !((Disableable) event.getListenerActor()).isDisabled())
        Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Hand);
}
 
Example #15
Source File: HandListener.java    From skin-composer with MIT License 4 votes vote down vote up
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
    if (pointer == -1) {
        Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
    }
}
 
Example #16
Source File: ResizeFourArrowListener.java    From skin-composer with MIT License 4 votes vote down vote up
public ResizeFourArrowListener(Cursor cursor) {
    this.cursor = cursor;
}
 
Example #17
Source File: Utils.java    From skin-composer with MIT License 4 votes vote down vote up
public static Cursor textureRegionToCursor(TextureRegion textureRegion, int xHotspot, int yHotspot) {
    return Gdx.graphics.newCursor(textureRegionToPixmap(textureRegion), xHotspot, yHotspot);
}
 
Example #18
Source File: ResizeArrowListener.java    From skin-composer with MIT License 4 votes vote down vote up
@Override
public void dragStop(InputEvent event, float x, float y, int pointer) {
    Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
    draggingCursor = false;
}