本文整理汇总了Java中com.badlogic.gdx.graphics.Cursor类的典型用法代码示例。如果您正苦于以下问题:Java Cursor类的具体用法?Java Cursor怎么用?Java Cursor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Cursor类属于com.badlogic.gdx.graphics包,在下文中一共展示了Cursor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@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;
}
示例2: systemCursor
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
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;
}
}
示例3: dispose
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
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();
}
}
示例4: setCursorImage
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
/**
* 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));
}
}
示例5: setSystemCursor
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public void setSystemCursor(Cursor.SystemCursor cursor) {
this.newCursorImage = null;
if (this.cursor != cursor) {
this.cursor = cursor;
changed = true;
}
}
示例6: resetCursor
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public void resetCursor() {
this.newCursorImage = null;
this.cursor = null;
changed = false;
Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
}
示例7: getCursorForPath
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
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);
}
示例8: setCursor
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public void setCursor (Cursor cursor) {
if (cursor == null) {
glfwSetCursor(window, 0);
} else {
cursor.setSystemCursor();
}
}
示例9: setCustomCursor
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
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;
}
}
示例10: loadGameStageAssets
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
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);
}
示例11: getRequestedCursor
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public Optional<Cursor> getRequestedCursor() {
return Optional.empty();
}
示例12: newCursor
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public Cursor newCursor(Pixmap pixmap, int xHotspot, int yHotspot) {
return null;
}
示例13: newCursor
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public Cursor newCursor(Pixmap pixmap, int xHotspot, int yHotspot) {
// TODO Auto-generated method stub
return null;
}
示例14: setCursor
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public void setCursor(Cursor cursor) {
// TODO Auto-generated method stub
}
示例15: exit
import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
if (pointer == -1) {
Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
}
}