Java 类com.badlogic.gdx.graphics.Cursor 实例源码

项目:SpaceChaos    文件:DefaultCursorManager.java   
@Override
public void update(BaseGame game, GameTime time) {
    if (this.changed) {
        if (this.newCursorImage != null) {
            Cursor currentCursor = this.cursorCacheMap.get(this.newCursorImage);

            if (currentCursor == null) {
                currentCursor = Gdx.graphics.newCursor(this.newCursorImage, 0, 0);
                this.cursorCacheMap.put(this.newCursorImage, currentCursor);
            }

            Gdx.graphics.setCursor(currentCursor);
        } else if (this.cursor != null) {
            Gdx.graphics.setSystemCursor(this.cursor);
        }
    } else {
        Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
    }

    this.newCursorImage = null;
    this.cursor = null;
    this.changed = false;
}
项目:kreativity-ui    文件:KrLwjgl3Backend.java   
private static Cursor.SystemCursor systemCursor(KrCursor cursor) {
    switch (cursor) {
        case ARROW:
            return Cursor.SystemCursor.Arrow;
        case IBEAM:
            return Cursor.SystemCursor.Ibeam;
        case CROSSHAIR:
            return Cursor.SystemCursor.Crosshair;
        case HAND:
            return Cursor.SystemCursor.Hand;
        case HORIZONTAL_RESIZE:
            return Cursor.SystemCursor.HorizontalResize;
        case VERTICAL_RESIZE:
            return Cursor.SystemCursor.VerticalResize;
        default:
            return Cursor.SystemCursor.Arrow;
    }
}
项目:fabulae    文件:UIManager.java   
public static void dispose() {
    if (stage != null) {
        stage.dispose();
    }
    if (stackFont != null) {
        stackFont.dispose();
    }
    if (batch != null) {
        batch.dispose();
    }
    if (defaultCursor != null) {
        defaultCursor.dispose();
        defaultCursor = null;
    }

    if (toolCursors != null) {
        for (Cursor cursor : toolCursors.values()) {
            cursor.dispose();
        }
        toolCursors.clear();
    }
}
项目:ProjektGG    文件:CursorManager.java   
/**
 * Sets the cursor image.
 * 
 * @param image
 *            The image.
 */
public void setCursorImage(Pixmap image) {
    if (image == null) {
        throw new IllegalArgumentException("Cursor image cannot be null.");
    }

    if (!cursorCacheMap.containsKey(image)) {
        Cursor newCursor = Gdx.graphics.newCursor(image, 0, 0);
        this.cursorCacheMap.put(image, newCursor);

        Gdx.graphics.setCursor(newCursor);
    } else {
        Gdx.graphics.setCursor(cursorCacheMap.get(image));
    }
}
项目:SpaceChaos    文件:DefaultCursorManager.java   
@Override
public void setSystemCursor(Cursor.SystemCursor cursor) {
    this.newCursorImage = null;

    if (this.cursor != cursor) {
        this.cursor = cursor;
        changed = true;
    }
}
项目:SpaceChaos    文件:DefaultCursorManager.java   
@Override
public void resetCursor() {
    this.newCursorImage = null;
    this.cursor = null;
    changed = false;

    Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
}
项目:fabulae    文件:UIManager.java   
private static Cursor getCursorForPath(AssetManager am, String texturePath) {
    Pixmap pixmap = null;
    if (texturePath != null) {
        Texture cursorTexture = am.get(texturePath);
        TextureData data = cursorTexture.getTextureData();
        if (!data.isPrepared()) {
            data.prepare();
        }
        pixmap = data.consumePixmap();
    }
    return Gdx.graphics.newCursor(pixmap, 0, 0);
}
项目:gdx-backend-jglfw    文件:JglfwGraphics.java   
@Override
public void setCursor (Cursor cursor) {
    if (cursor == null) {
        glfwSetCursor(window, 0);
    } else {
        cursor.setSystemCursor();
    }
}
项目:vis-editor    文件:SplitPaneCursorManager.java   
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;
    }
}
项目:ExamensArbeteTD    文件:Assets.java   
public static void loadGameStageAssets() {
    // colors
    greenColor = new Color(0.1f , 0.8f , 0.1f,1f);
    // music
    laserMillenium = Gdx.audio.newMusic(Gdx.files.internal("music/Laser_Millenium.ogg"));
    laserMillenium.setVolume(Game.VOLUME_MUSIC);
    laserMillenium.setLooping(true);
    laserMillenium.play();
    // sounds
    laserTurretFire = Gdx.audio.newSound(Gdx.files.internal("towers/lasertower/fx/bubaproducer__laser-shot-silenced.wav"));
    //laserTurretFire.play(0.5f);

    // laser texture
    laserSmall = new Texture(Gdx.files.internal("projectiles/lasers/laser-small.png"));
    plastmaProj = new Texture(Gdx.files.internal("projectiles/lasers/plastma-projectile.png"));
    missile = new Texture(Gdx.files.internal("projectiles/missile/missile.png"));
    // bloodworm
    bloodWormSkeleton = loadSkeleton("enemies/bloodworm/skeleton.atlas","enemies/bloodworm/skeleton.json");
    bloodWormAnimationState = new AnimationState(new AnimationStateData(bloodWormSkeleton.getData()));
   // bird
    birdSkeleton = loadSkeleton("enemies/bird/skeleton.atlas","enemies/bird/skeleton.json");
    birdAnimationState = new AnimationState(new AnimationStateData(birdSkeleton.getData()));
    // healtbar
    enemyGreenHealthbarBG = new Sprite(loadTexture("enemies/healthbar-green.png"));
    enemyRedHealthbarBG = new Sprite(loadTexture("enemies/healthbar-red.png"));
    // Tower
    laserTowerSkeleton = loadSkeleton("towers/lasertower/skeleton.atlas","towers/lasertower/skeleton.json");
    laserTowerAnimationState = new AnimationState(new AnimationStateData(laserTowerSkeleton.getData()));

    plastmaTowerSkeleton = loadSkeleton("towers/plastma-tower/skeleton.atlas", "towers/plastma-tower/skeleton.json");
    plastmaTowerAnimationState = new AnimationState(new AnimationStateData(plastmaTowerSkeleton.getData()));

    missleTowerSkeleton = loadSkeleton("towers/missle-tower/skeleton.atlas", "towers/missle-tower/skeleton.json");
    missleTowerAnimationState = new AnimationState(new AnimationStateData(missleTowerSkeleton.getData()));
    // Coin
    coinSkeleton = loadSkeleton("misc/coin/skeleton.atlas", "misc/coin/skeleton.json");
    coinSkeleton.getRootBone().setScale(0.16f);
    coinAnimationState = new AnimationState(new AnimationStateData(coinSkeleton.getData()));
    // fonts
    // skin 

    Cursor slickArrow = Gdx.graphics.newCursor(new Pixmap(Gdx.files.getFileHandle("slick_arrow-arrow.png", Files.FileType.Internal)), 0, 0);
    Gdx.graphics.setCursor(slickArrow);
}
项目:SpaceGame    文件:BuildingConstructionCursorOverride.java   
@Override
public Optional<Cursor> getRequestedCursor() {
    return Optional.empty();
}
项目:ZombieInvadersVR    文件:CardBoardGraphics.java   
@Override
public Cursor newCursor(Pixmap pixmap, int xHotspot, int yHotspot) {
    return null;
}
项目:exterminate    文件:LwjglGraphics.java   
@Override
public Cursor newCursor(Pixmap pixmap, int xHotspot, int yHotspot) {
    // TODO Auto-generated method stub
    return null;
}
项目:exterminate    文件:LwjglGraphics.java   
@Override
public void setCursor(Cursor cursor) {
    // TODO Auto-generated method stub

}
项目:skin-composer    文件:HandListener.java   
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
    if (pointer == -1) {
        Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
    }
}
项目:skin-composer    文件:HandListener.java   
@Override
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
    Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Hand);
}
项目:fabulae    文件:UIManager.java   
public static void setCursorForTool(Tool tool) {
    Cursor cursor = tool != null ? toolCursors.get(tool) : null;
    Gdx.graphics.setCursor(cursor != null ? cursor : defaultCursor);
}
项目:gdx-backend-jglfw    文件:JglfwGraphics.java   
@Override
public Cursor newCursor (Pixmap pixmap, int xHotspot, int yHotspot) {
    return new JglfwCursor(this, pixmap, xHotspot, yHotspot);
}
项目:Virtual-Evil    文件:Game.java   
private void changeCursor() {
    // last 2 params are the cursor hotspot
    Cursor customCursor = Gdx.graphics.newCursor(
            new Pixmap(Gdx.files.internal("images/crosshair1.png")), 32, 32);
    Gdx.graphics.setCursor(customCursor);
}
项目:vis-editor    文件:CursorManager.java   
/**
 * 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;
}
项目:vis-editor    文件:CursorManager.java   
/**
 * 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;
}
项目:mini2Dx    文件:IOSMini2DxGraphics.java   
@Override
public Cursor newCursor (Pixmap pixmap, int xHotspot, int yHotspot) {
    return null;
}
项目:mini2Dx    文件:IOSMini2DxGraphics.java   
@Override
public void setCursor (Cursor cursor) {
}
项目:mini2Dx    文件:Mini2DxMockGraphics.java   
@Override
public Cursor newCursor (Pixmap pixmap, int xHotspot, int yHotspot) {
    return null;
}
项目:mini2Dx    文件:Mini2DxMockGraphics.java   
@Override
public void setCursor (Cursor cursor) {
}
项目:ProjektGG    文件:CursorManager.java   
/**
 * Resets the cursor image to the default one.
 * 
 * @see SystemCursor#Arrow
 */
public void resetCursorImage() {
    Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
}
项目:SpaceGame    文件:CursorOverride.java   
/**
 * The cursor returned by this method should always be the same instance
 * It should be disposed in the dispose method implementation
 *
 * @return an optional cursor object if a cursor is requested
 */
Optional<Cursor> getRequestedCursor();
项目:ZombieInvadersVR    文件:CardBoardGraphics.java   
@Override
public void setCursor(Cursor cursor) {

}
项目:SpaceChaos    文件:CursorManager.java   
public void setSystemCursor(Cursor.SystemCursor cursor);