当前位置: 首页>>代码示例>>Java>>正文


Java Cursor类代码示例

本文整理汇总了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;
}
 
开发者ID:opensourcegamedev,项目名称:SpaceChaos,代码行数:24,代码来源:DefaultCursorManager.java

示例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;
    }
}
 
开发者ID:alexpana,项目名称:kreativity-ui,代码行数:19,代码来源:KrLwjgl3Backend.java

示例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();
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:23,代码来源:UIManager.java

示例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));
	}
}
 
开发者ID:eskalon,项目名称:ProjektGG,代码行数:21,代码来源:CursorManager.java

示例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;
    }
}
 
开发者ID:opensourcegamedev,项目名称:SpaceChaos,代码行数:10,代码来源:DefaultCursorManager.java

示例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);
}
 
开发者ID:opensourcegamedev,项目名称:SpaceChaos,代码行数:9,代码来源:DefaultCursorManager.java

示例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);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:13,代码来源:UIManager.java

示例8: setCursor

import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public void setCursor (Cursor cursor) {
	if (cursor == null) {
		glfwSetCursor(window, 0);
	} else {
		cursor.setSystemCursor();
	}
}
 
开发者ID:Arcnor,项目名称:gdx-backend-jglfw,代码行数:9,代码来源:JglfwGraphics.java

示例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;
	}
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:14,代码来源:SplitPaneCursorManager.java

示例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);
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:45,代码来源:Assets.java

示例11: getRequestedCursor

import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public Optional<Cursor> getRequestedCursor() {
    return Optional.empty();
}
 
开发者ID:SergeySave,项目名称:SpaceGame,代码行数:5,代码来源:BuildingConstructionCursorOverride.java

示例12: newCursor

import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public Cursor newCursor(Pixmap pixmap, int xHotspot, int yHotspot) {
    return null;
}
 
开发者ID:raphaelbruno,项目名称:ZombieInvadersVR,代码行数:5,代码来源:CardBoardGraphics.java

示例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;
}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:6,代码来源:LwjglGraphics.java

示例14: setCursor

import com.badlogic.gdx.graphics.Cursor; //导入依赖的package包/类
@Override
public void setCursor(Cursor cursor) {
	// TODO Auto-generated method stub
	
}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:6,代码来源:LwjglGraphics.java

示例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);
    }
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:7,代码来源:HandListener.java


注:本文中的com.badlogic.gdx.graphics.Cursor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。