本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.TextureAtlas.createSprite方法的典型用法代碼示例。如果您正苦於以下問題:Java TextureAtlas.createSprite方法的具體用法?Java TextureAtlas.createSprite怎麽用?Java TextureAtlas.createSprite使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g2d.TextureAtlas
的用法示例。
在下文中一共展示了TextureAtlas.createSprite方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: HelpButton
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //導入方法依賴的package包/類
public HelpButton(final Application app, final MenuHud menuHud, final TextureAtlas atlas)
{
drawableUp = new SpriteDrawable(atlas.createSprite("help-up"));
drawableDown = new SpriteDrawable(atlas.createSprite("help-down"));
applyFilter();
button = new ImageButton(drawableUp, drawableDown);
button.addListener(new ClickListener()
{
@Override
public void clicked (InputEvent event, float x, float y)
{
menuHud.removeAllActorsFromStage();
ColorOverlay.enabled = false;
app.setScreen(new HelpScreen(app, atlas));
}
});
}
示例2: PlayButton
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //導入方法依賴的package包/類
public PlayButton(final Application app, final TextureAtlas atlas)
{
drawableUp = new SpriteDrawable(atlas.createSprite("pb-up"));
drawableDown = new SpriteDrawable(atlas.createSprite("pb-down"));
applyFilter();
button = new ImageButton(drawableUp, drawableDown);
button.addListener(new ClickListener()
{
@Override
public void clicked (InputEvent event, float x, float y)
{
app.setScreen(new GameScreen(app, atlas));
}
});
}
示例3: HomeButton
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //導入方法依賴的package包/類
public HomeButton(final Application app, final TextureAtlas atlas)
{
drawableUp = new SpriteDrawable(atlas.createSprite("home-up"));
drawableDown = new SpriteDrawable(atlas.createSprite("home-down"));
applyFilter();
button = new ImageButton(drawableUp, drawableDown);
button.addListener(new ClickListener()
{
@Override
public void clicked(InputEvent event, float x, float y)
{
Ball.died = false;
GameScreen.adAlreadyShowed++;
app.setScreen(new MenuScreen(app));
}
});
}
示例4: RestartButton
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //導入方法依賴的package包/類
public RestartButton(final Player player, final Ball ball, final TextureAtlas atlas)
{
drawableUp = new SpriteDrawable(atlas.createSprite("rb-normal"));
drawableDown = new SpriteDrawable(atlas.createSprite("rb-down"));
applyFilter();
button = new ImageButton(drawableUp, drawableDown);
button.addListener(new ClickListener()
{
@Override
public void clicked(InputEvent event, float x, float y)
{
Ball.died = false;
GameScreen.adAlreadyShowed++;
ball.reset();
player.reset();
}
});
}
示例5: create
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //導入方法依賴的package包/類
@Override
public void create() {
instance = this;
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/amiga4ever pro2.ttf"));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.size = 8;
parameter.mono = true;
font = generator.generateFont(parameter);
generator.dispose();
batch = new SpriteBatch();
shapeRenderer = new ShapeRenderer();
camera = new OrthographicCamera();
viewport = new FitViewport(WINDOW_WIDTH, WINDOW_HEIGHT, camera);
camera.position.set(WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2, 0);
camera.update();
textureAtlas = new TextureAtlas("textures.pack");
assetManager = new AssetManager();
fade = textureAtlas.createSprite("fade");
fade.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
fade.setPosition(0, 0);
particles = new Particles(textureAtlas);
loadInitialPreferences();
loadAssets();
tryToSubmitLatestHighscores();
// load and show logo screen
theRefactoryLogoScreen = new LogoScreen(batch, shapeRenderer, viewport, camera);
setScreen(theRefactoryLogoScreen);
}
示例6: GameScreen
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //導入方法依賴的package包/類
public GameScreen(final Application app, final TextureAtlas atlas)
{
this.app = app;
this.atlas = atlas;
paddleSprite = atlas.createSprite("paddle");
ballSprite = atlas.createSprite("ball");
}
示例7: tryToLoadFromCreatedAtlas
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //導入方法依賴的package包/類
private Sprite tryToLoadFromCreatedAtlas(String ImagePath) {
if (Atlanten == null)
Atlanten = new HashMap<String, TextureAtlas>();
String inputFolder = Utils.GetDirectoryName(ImagePath);
String ImageName = Utils.GetFileNameWithoutExtension(ImagePath);
String Name = getCachedAtlasName(inputFolder);
final String AtlasPath = Settings.ImageCacheFolder.getValue() + "/" + Name;
if (!Utils.FileExistsNotEmpty(AtlasPath))
return null;
TextureAtlas atlas = null;
if (Atlanten.containsKey(AtlasPath)) {
atlas = Atlanten.get(AtlasPath);
} else {
this.AtlasPath = AtlasPath;
this.ImgName = ImageName;
State = 6;
}
Sprite tmp = null;
if (atlas != null) {
tmp = atlas.createSprite(ImageName);
}
return tmp;
}
示例8: setAtlas
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //導入方法依賴的package包/類
void setAtlas(String atlasPath, String imgName, boolean reziseHeight) {
State = 7;
TextureAtlas atlas = new TextureAtlas(Gdx.files.absolute(atlasPath));
Atlanten.put(atlasPath, atlas);
Sprite tmp = null;
if (atlas != null) {
tmp = atlas.createSprite(imgName);
}
if (tmp != null)
setSprite(tmp, reziseHeight);
}
示例9: loadImages
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //導入方法依賴的package包/類
private void loadImages(TextureAtlas textureAtlas) {
for (TextureAtlas.AtlasRegion textureRegion : textureAtlas.getRegions()) {
Sprite sprite = textureAtlas.createSprite(textureRegion.name);
sprites.put(textureRegion.name, sprite);
}
}
示例10: ColorOverlay
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //導入方法依賴的package包/類
public ColorOverlay(Sprite bg, Sprite redBG, Sprite orangeBG, Sprite blueBG, Sprite greenBg, final Application app, final TextureAtlas atlas)
{
Sprite sprite = new Sprite(app.assets.get("images/colors/overlay.png", Texture.class));
sprite.getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
image = new Image(sprite);
colorButtons = new Array<ColorButton>();
redButton = new ColorButton(atlas.createSprite("red-up"), atlas.createSprite("red-down"));
orangeButton = new ColorButton(atlas.createSprite("orange-up"), atlas.createSprite("orange-down"));
blueButton = new ColorButton(atlas.createSprite("blue-up"), atlas.createSprite("blue-down"));
greenButton = new ColorButton(atlas.createSprite("green-up"), atlas.createSprite("green-down"));
redButton.whenClicked(bg, redBG, "images/paddlandball/bg-red.png", app);
orangeButton.whenClicked(bg, orangeBG, "images/paddlandball/bg-orange.png", app);
blueButton.whenClicked(bg, blueBG, "images/paddlandball/bg-blue.png", app);
greenButton.whenClicked(bg, greenBg, "images/paddlandball/bg-green.png", app);
colorButtons.add(redButton);
colorButtons.add(orangeButton);
colorButtons.add(blueButton);
colorButtons.add(greenButton);
final Runnable notBusyAnmore = new Runnable()
{
@Override
public void run()
{
busy = false;
}
};
image.addListener(new ClickListener()
{
@Override
public void clicked(InputEvent event, float x, float y)
{
if (enabled == false && busy == false)
{
busy = true;
image.addAction(sequence(parallel(moveBy(0, 150, 0.4f)), run(notBusyAnmore)));
enabled = true;
}
else if (enabled && busy == false)
{
busy = true;
image.addAction(sequence(moveBy(0, -150, 0.4f), run(notBusyAnmore)));
enabled = false;
}
}
});
}