private void addimagebg(){
MapPixmap imageBG = MapPixmap.getInstance();
decalBackground = Decal.newDecal(new TextureRegion(new Texture(imageBG.getImage(1,1))));
decalBackground.setPosition(0, 0, 0);
decalBackground.setDimensions(Gdx.graphics.getHeight() * 0.3125f, Gdx.graphics.getHeight() * 0.3125f);
decalBackground.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
}
java类com.badlogic.gdx.graphics.g2d.TextureRegion的实例源码
ScreenRooms.java 文件源码
项目:enklave
阅读 18
收藏 0
点赞 0
评论 0
Boom.java 文件源码
项目:Parasites-of-HellSpace
阅读 32
收藏 0
点赞 0
评论 0
public Boom(float x, float y)
{
texture = AssetLoader.assetManager.get("explosion.pack", TextureAtlas.class);
animation = new Animation<TextureRegion>(1/15f, texture.getRegions());
sprite = new Sprite(animation.getKeyFrame(0));
elapsedTime = 0;
sprite.setPosition(x, y);
rotationAngle = MathUtils.random(359);
sprite.setRotation(rotationAngle);
}
GameService.java 文件源码
项目:GDX-Engine
阅读 23
收藏 0
点赞 0
评论 0
@Override
public void draw(TextureRegion region, Vector2 position, Vector2 origin,
Vector2 size, float scale, float rotation) {
batch.draw(region, position.x, position.y, origin.x, origin.y, size.x,
size.y, scale, scale, rotation);
}
GameAsset.java 文件源码
项目:GDX-Engine
阅读 16
收藏 0
点赞 0
评论 0
@Override
public void load(){
AssetLoader.setAssetClass(Texture.class);
for(int i = 0; i < 15; i++){
monsterTexture[i] = AssetLoader.load("towerdefense/monster/monster ("+i+").png");
}
AssetLoader.setAssetClass(TextureRegion.class);
canon = AssetLoader.load("towerdefense/tower/canon.png", new Rectangle(190, 0, 63, 63));
towerTexture = AssetLoader.load("towerdefense/tower/tower.png");
gun = AssetLoader.load("towerdefense/tower/gun.png", new Rectangle(190, 0, 63, 63));
slower = AssetLoader.load("towerdefense/tower/slower.png", new Rectangle(190, 0, 63, 63));
}
Bird.java 文件源码
项目:Flappy-Baranus
阅读 24
收藏 0
点赞 0
评论 0
public Bird(int x, int y){
position = new Vector3(x, y, 0);
velosity = new Vector3(0, 0, 0);
texture = new Texture("Sheep-Animated-Gif4.png");
birdAnimation = new Animation(new TextureRegion(texture), FRAME_COUNT, 0.9f);
bounds = new Rectangle(x, y, texture.getWidth() / FRAME_COUNT, texture.getHeight());
flap = Gdx.audio.newSound(Gdx.files.internal("sfx_wing.ogg"));
}
Animation.java 文件源码
项目:Flappy-Baranus
阅读 28
收藏 0
点赞 0
评论 0
public Animation(TextureRegion region, int frameCount, float cycleTime){
frames = new Array<TextureRegion>();
int frameWidth = region.getRegionWidth() / frameCount;
for (int i = 0; i < frameCount; i++){
frames.add(new TextureRegion(region, i * frameWidth, 0, frameWidth, region.getRegionHeight()));
}
this.frameCount = frameCount;
maxFrameTime = cycleTime / frameCount;
frame = 0;
}
Cherry.java 文件源码
项目:summer17-android
阅读 16
收藏 0
点赞 0
评论 0
public Cherry(int x, int y){
cherry = new Texture("Cherry2_0.35.png");
cherryAnimation = new Animation(new TextureRegion(cherry),2,0.5f);
rand = new Random();
posCherry = new Vector2(rand.nextInt(FLUCTUATION)+CHERRY_MIN_X, y);
cherryBounds = new Rectangle(posCherry.x,posCherry.y,cherry.getWidth(),cherry.getHeight());
collided = false;
}
SlotActor.java 文件源码
项目:Cubes_2
阅读 18
收藏 0
点赞 0
评论 0
public void draw(Batch batch, float x, float y, float width, float height) {
batch.draw(blank, x, y, width, height);
if (inventory.itemStacks[num] != null) {
TextureRegion region = inventory.itemStacks[num].getTextureRegion();
batch.draw(region, x + 2f, y + 2f, width - 4f, height - 4f);
drawText(batch, x + 2f, y + 2f, inventory.itemStacks[num]);
}
}
DefaultGameAsset.java 文件源码
项目:GDX-Engine
阅读 20
收藏 0
点赞 0
评论 0
@Override
public TextureRegion loadTextureRegion(Texture texture, Rectangle rec)
{
TextureRegion tr = new TextureRegion(texture, (int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height);
//flip for system of y-axis down
if(Game.isYdown())
tr.flip(false, true);
return tr;
}
ImageHelper.java 文件源码
项目:gdx-fireapp
阅读 29
收藏 0
点赞 0
评论 0
/**
* Transforms byte[] to Texture Region.
* <p>
* If you are going to call this method inside firebase callback remember to wrap it<p>
* into {@code Gdx.app.postRunnable(Runnable)}.
* The texture will be changed so that it has sides with length of power of 2.
*
* @param bytes Byte array with image description
* @return Texture region representation of given byte array
*/
public static TextureRegion createTextureFromBytes(byte[] bytes)
{
Pixmap pixmap = new Pixmap(bytes, 0, bytes.length);
final int orgWidth = pixmap.getWidth();
final int orgHeight = pixmap.getHeight();
int width = MathUtils.nextPowerOfTwo(orgWidth);
int height = MathUtils.nextPowerOfTwo(orgHeight);
final Pixmap potPixmap = new Pixmap(width, height, pixmap.getFormat());
potPixmap.drawPixmap(pixmap, 0, 0, 0, 0, pixmap.getWidth(), pixmap.getHeight());
pixmap.dispose();
TextureRegion region = new TextureRegion(new Texture(potPixmap), 0, 0, orgWidth, orgHeight);
potPixmap.dispose();
return region;
}