public void render () { // set the clear color and clear the screen. Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (Gdx.input.isTouched()) { Gdx.graphics.setCursor(cursor1); } else { cursorActive = !cursorActive; if (cursorActive) { Gdx.graphics.setCursor(cursor2); } else { Gdx.graphics.setCursor(cursor3); } } } }
/** Restores currently used cursor to default one. */ public static void restoreDefaultCursor () { if (systemCursorAsDefault) { Gdx.graphics.setSystemCursor(defaultSystemCursor); } else { Gdx.graphics.setCursor(defaultCursor); } } }
/** * Disables (hides) the mouse cursor image specified in {@link #GdxMouseCursor(GdxImage, int, int)}. Restores (shows) * the system mouse cursor image. */ @Override public void disable() { Gdx.graphics.setCursor(Gdx.graphics.newCursor(null, hotspotX, hotspotY)); }
/** * Disables (hides) the mouse cursor image specified in {@link #GdxMouseCursor(GdxImage, int, int)}. Restores (shows) * the system mouse cursor image. */ @Override public void disable() { Gdx.graphics.setCursor(Gdx.graphics.newCursor(null, hotspotX, hotspotY)); }
/** * Enables (shows) the mouse cursor image specified in {@link #GdxMouseCursor(GdxImage, int, int)}. Replaces (hides) * the system mouse cursor image. */ @Override public void enable() { try { if (cursorImage.hasPixmap()) { Gdx.graphics.setCursor(Gdx.graphics.newCursor(cursorImage.getPixmap(), hotspotX, hotspotY)); } } catch (GdxRuntimeException e) { log.log(Level.SEVERE, "Applying the mouse cursor failed!", e); } }
/** * Enables (shows) the mouse cursor image specified in {@link #GdxMouseCursor(GdxImage, int, int)}. Replaces (hides) * the system mouse cursor image. */ @Override public void enable() { try { if (cursorImage.hasPixmap()) { Gdx.graphics.setCursor(Gdx.graphics.newCursor(cursorImage.getPixmap(), hotspotX, hotspotY)); } } catch (GdxRuntimeException e) { log.log(Level.SEVERE, "Applying the mouse cursor failed!", e); } }
@Override public boolean handle(Event event) { if (event instanceof InputEvent) { Type type = ((InputEvent) event).getType(); // Click if (type == Type.enter) { Gdx.graphics.setCursor(Gdx.graphics.newCursor(GlobalResources.linkCursor, 4, 0)); } else if (type == Type.exit) { Gdx.graphics.setSystemCursor(SystemCursor.Arrow); } return true; } return false; } });
@Override public boolean handle(Event event) { if (event instanceof InputEvent) { Type type = ((InputEvent) event).getType(); if (type == Type.enter) { if (!me.isDisabled()) Gdx.graphics.setCursor(Gdx.graphics.newCursor(cursor != null ? cursor : GlobalResources.linkCursor, 4, 0)); return true; } else if (type == Type.exit) { Gdx.graphics.setSystemCursor(SystemCursor.Arrow); return true; } } return false; } });
@Override public boolean handle(Event event) { if (event instanceof InputEvent) { Type type = ((InputEvent) event).getType(); if (type == Type.enter) { if (!me.isDisabled()) Gdx.graphics.setCursor(Gdx.graphics.newCursor(cursor, 4, 0)); return true; } else if (type == Type.exit) { Gdx.graphics.setSystemCursor(SystemCursor.Arrow); return true; } } return false; } });
@Override public boolean handle(Event event) { if (event instanceof InputEvent) { Type type = ((InputEvent) event).getType(); // Click if (type == Type.touchUp && ((InputEvent) event).getButton() == Buttons.LEFT) { Gdx.net.openURI(linkURL); } else if (type == Type.enter) { Gdx.graphics.setCursor(Gdx.graphics.newCursor(GlobalResources.linkCursor, 4, 0)); } else if (type == Type.exit) { Gdx.graphics.setSystemCursor(SystemCursor.Arrow); } return true; } return false; } });
private void initialize(Skin skin) { this.addListener(event -> { if (event instanceof InputEvent) { InputEvent.Type type = ((InputEvent) event).getType(); // Click if (type == InputEvent.Type.touchUp && ((InputEvent) event).getButton() == Input.Buttons.LEFT) { Gdx.net.openURI(linkURL); } else if (type == InputEvent.Type.enter) { Gdx.graphics.setCursor(Gdx.graphics.newCursor(GlobalResources.linkCursor, 4, 0)); } else if (type == InputEvent.Type.exit) { Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow); } return true; } return false; }); this.addListener(new OwnTextTooltip(linkURL, skin, 10)); } }