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


Java Texture.getHeight方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.Texture.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Texture.getHeight方法的具体用法?Java Texture.getHeight怎么用?Java Texture.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.Texture的用法示例。


在下文中一共展示了Texture.getHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MapManager

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public MapManager(Texture map){
    bkgnd = SpriteSheet.background;
    width = map.getWidth();
    height = map.getHeight();
    tiles = new short[width * height];
    if(!map.getTextureData().isPrepared())
        map.getTextureData().prepare();
    Pixmap p = map.getTextureData().consumePixmap();
    for(int y = 0; y < height; y++) {
        for(int x = 0; x < width; x++) {
            if(p.getPixel(x,y) == Tile.GRASS_COL) tiles[x + ((height - y - 1) * width)] = Tile.GRASS_ID;
            if(p.getPixel(x,y) == Tile.DIRT_COL) tiles[x + ((height - y - 1) * width)] = Tile.DIRT_ID;
            if(p.getPixel(x,y) == Tile.SAND_COL) tiles[x + ((height - y - 1) * width)] = Tile.SAND_ID;
            if(p.getPixel(x,y) == Tile.WATER_COL) tiles[x + ((height - y - 1) * width)] = Tile.WATER_ID;

        }
    }
}
 
开发者ID:elitej13,项目名称:project-divine-intervention,代码行数:19,代码来源:MapManager.java

示例2: init

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
private void init() {

		// Start Shooting
		bulletCooldown = TimeUtils.millis();
		enemyBulletSpeed = 5;
		randomAttackCooldown = MathUtils.random(200, 1000);
		
		// Drop Chance | 10% chance
		dropChance = MathUtils.random(0, 9);

		// Start Sprites
		allTexture = new Texture(Gdx.files.internal(pathName));
		TextureRegion[][] tmp = TextureRegion.split(allTexture, allTexture.getWidth() / 3, allTexture.getHeight() / 1);
		rolls = new TextureRegion[3];
		for (int i = 0; i < rolls.length; i++) {
			rolls[i] = tmp[0][i];
		}

		// Start rectangle
		collisionBounds = new Rectangle(x, y, allTexture.getWidth() / 3, allTexture.getHeight());
	}
 
开发者ID:ja-brouil,项目名称:StarshipFighters,代码行数:22,代码来源:BasicAlien.java

示例3: stencil

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
private void stencil(Planet planet, Texture texture, PlanetCell.CellType[] replaceTypes, int degrees, int x1, int y1) {
    final TextureData textureData = texture.getTextureData();
    textureData.prepare();

    final Pixmap pixmap = textureData.consumePixmap();
    for (int y = 0; y < texture.getHeight(); y++) {
        for (int x = 0; x < texture.getWidth(); x++) {

            tv.set(x, y).rotate(degrees).add(x1, y1);

            int color = pixmap.getPixel(x, texture.getHeight() - y);
            final PlanetCell.CellType type = getSourceCellType(planet, color);
            if (type != null) {
                replaceCell(planet, Math.round(tv.x), Math.round(tv.y), replaceTypes, type, color);
            }

        }
    }
    pixmap.dispose();
}
 
开发者ID:DaanVanYperen,项目名称:odb-little-fortune-planet,代码行数:21,代码来源:PlanetStencilSystem.java

示例4: Tube

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public Tube(float x) {
    topTube = new Texture("toptube1.png");
    bottomTube = new Texture("bottomtube1.png");
    random = new Random();

    posTopTube = new Vector2(x, random.nextInt(FLUCTUATION) + TUBE_GAP + LOWEST_OPENING);
    posBotTube = new Vector2(x, posTopTube.y - TUBE_GAP - bottomTube.getHeight());

    boundsTop = new Rectangle(posTopTube.x, posTopTube.y, topTube.getWidth(), topTube.getHeight());
    boundsBot = new Rectangle(posBotTube.x, posBotTube.y, bottomTube.getWidth(), bottomTube.getHeight());
}
 
开发者ID:RubenMateus,项目名称:FlappyChapa,代码行数:12,代码来源:Tube.java

示例5: Chapa

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public Chapa(int x, int y) {
    position = new Vector3(x, y, 0);
    velocity = new Vector3(0, 0, 0);

    texture = new Texture("chapaanimation.png");
    birdAnimation = new Animation(new TextureRegion(texture), 3, 0.5f);
    bounds = new Rectangle(x, y, texture.getWidth() / 3, texture.getHeight());
    initSounds();
}
 
开发者ID:RubenMateus,项目名称:FlappyChapa,代码行数:10,代码来源:Chapa.java

示例6: Bird

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
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"));
}
 
开发者ID:kirdmiv,项目名称:Flappy-Baranus,代码行数:9,代码来源:Bird.java

示例7: Tube

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public Tube(float x){
    topTube = new Texture("toptube.png");
    bottomTube = new Texture("bottomtube.png");
    rand = new Random();

    posTopTube = new Vector2(x, rand.nextInt(FLUCTUATION) + TUBE_GAP + LOWEST_OPENING);
    posBotTube = new Vector2(x, posTopTube.y - TUBE_GAP - bottomTube.getHeight());

    boundsTop = new Rectangle(posTopTube.x, posTopTube.y, topTube.getWidth(), topTube.getHeight());
    boundsBot = new Rectangle(posBotTube.x, posBotTube.y, bottomTube.getWidth(), bottomTube.getHeight());

}
 
开发者ID:kirdmiv,项目名称:Flappy-Baranus,代码行数:13,代码来源:Tube.java

示例8: isEqual

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
private boolean isEqual(Texture a, Texture b) {
    if (a.getDepth() != b.getDepth()) return false;
    if (a.getHeight() != b.getHeight()) return false;
    if (a.getWidth() != b.getWidth()) return false;

    if (!a.getTextureData().getFormat().equals(b.getTextureData().getFormat())) return false;
    if (a.getTextureData().getHeight() != b.getTextureData().getHeight()) return false;
    if (a.getTextureData().getWidth() != b.getTextureData().getWidth()) return false;
    if (!a.getTextureData().getType().equals(b.getTextureData().getType())) return false;

    return true;
}
 
开发者ID:akivamu,项目名称:libgdx-crypt-texture,代码行数:13,代码来源:SimpleGame.java

示例9: Barrel

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public Barrel(int x, int y) {
    barrel = new Texture("Barrel.png");
    rand = new Random();
    posBarrel = new Vector2(rand.nextInt(FLUCTUATION) + BARREL_MIN_X, y);
    //pos2Barrel = new Vector2(rand.nextInt(FLUCTUATION)+BARREL_MIN_X+posBarrel.x,60);
    barrelBounds = new Rectangle(posBarrel.x, posBarrel.y, barrel.getWidth(), barrel.getHeight());
    //barrel2Bounds = new Rectangle(pos2Barrel.x,pos2Barrel.y,barrel.getWidth(),barrel.getHeight());
    collided = false;
}
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:10,代码来源:Barrel.java

示例10: Obstacle

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public Obstacle(Texture obstacle, float x, float y, int frames, float time) {
    this.obstacle = obstacle;
    obstacleAnimation = new Animation(new TextureRegion(obstacle), frames, time);
    posObs = new Vector2(x, y);
    boundsObs = new Rectangle(posObs.x, posObs.y, obstacle.getWidth(), obstacle.getHeight());
    hasCollided = false;
}
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:8,代码来源:Obstacle.java

示例11: Cherry

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
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;

}
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:10,代码来源:Cherry.java

示例12: draw

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
@Override
public void draw (Texture texture, float x, float y, float originX, float originY, float width, float height, float scaleX,
	float scaleY, float rotation, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY) {
	float invTexWidth = 1.0f / texture.getWidth();
	float invTexHeight = 1.0f / texture.getHeight();
	float u = srcX * invTexWidth;
	float v = (srcY + srcHeight) * invTexHeight;
	float u2 = (srcX + srcWidth) * invTexWidth;
	float v2 = srcY * invTexHeight;
	draw().color(color).texture(texture).position(x, y).origin(originX, originY).size(width, height).scale(scaleX, scaleY)
		.rotation(rotation).region(u, v, u2, v2).flip(flipX, flipY);
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:13,代码来源:CompliantBatch.java

示例13: GameObject

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public GameObject(Texture lookout, long id)
{
    sprite = new Sprite(lookout);
    sprite.setRegion(lookout);
    collisionRectangle.width = lookout.getWidth();
    collisionRectangle.height = lookout.getHeight();
    this.id = id;
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:9,代码来源:GameObject.java

示例14: create

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
@Override
public void create() {
    TextureComponent textureComponent = getComponentByType(TextureComponent.class);
    if (textureComponent != null) {
        Texture texture = new Texture(Gdx.files.internal(mTexturePath));
        textureComponent.textureRegion = new TextureRegion(texture);

        SizeComponent sizeComponent = getComponentByType(SizeComponent.class);
        if (sizeComponent != null && sizeComponent.height == -1.f) {
            float aspect = (float)texture.getWidth() / (float)texture.getHeight();
            sizeComponent.height = sizeComponent.width / aspect;
        }
    }
}
 
开发者ID:tgobbens,项目名称:fluffybalance,代码行数:15,代码来源:SpriteEntity.java

示例15: createTorpedoProjectile

import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
/**
 * Creating a new entity moving forward and causing much damage.
 *
 * @param ecs
 *            entity component system
 * @param x
 *            x start position of projectile
 * @param y
 *            y start position of projectile
 * @param texture
 *            texture of projectile
 * @return projectile entity
 */
public static Entity createTorpedoProjectile(EntityManager ecs, float x, float y, Texture texture, float moveX,
        float moveY, Entity playerEntity, Entity enemyEntity) {

    // create new entity
    Entity projectileEntity = new Entity(ecs);

    // every entity requires a position component
    projectileEntity.addComponent(new PositionComponent(x, y), PositionComponent.class);

    // add texture component to draw texture
    projectileEntity.addComponent(
            new DrawTextureComponent(texture, texture.getWidth() / 2, texture.getHeight() / 2),
            DrawTextureComponent.class);

    // add component to move entity
    projectileEntity.addComponent(new MoveComponent(moveX, moveY, 4f), MoveComponent.class);

    // add collision component, so entity can collide with other space
    // shuttles or meteorites
    projectileEntity.addComponent(new CollisionComponent(), CollisionComponent.class);
    projectileEntity.getComponent(CollisionComponent.class)
            .addInnerShape(new CCircle(texture.getWidth() / 2, texture.getHeight() / 2, texture.getWidth() / 2));

    // add attack component
    projectileEntity.addComponent(new DealDamageOnCollisionComponent(800, true, playerEntity));

    // add component to avoid camera shake, if player fires projectile (if
    // projectile starts, projectile is in player collision hull)
    projectileEntity.addComponent(new AvoidCollisionCameraShakeComponent(),
            AvoidCollisionCameraShakeComponent.class);

    // add component to avoid collision sound
    projectileEntity.addComponent(new AvoidCollisionSoundComponent(), AvoidCollisionSoundComponent.class);

    // AI
    // projectileEntity.addComponent(new
    // SimpleFollowAIMovementComponent(enemyEntity));

    // add component to auto remove projectile after a given time
    projectileEntity.addComponent(new TimedAutoRemoveComponent(3000L));

    // add component for smoke particles
    // create smoke effect
    ParticleEffect smokeEffect = new ParticleEffect();
    smokeEffect.load(Gdx.files.internal("./data/particles/smokeGrey.p"), Gdx.files.internal(""));
    BaseParticleEffect particleEffect = new MovementDirectionBasedParticleEffect(smokeEffect,
            texture.getWidth() / 2 - 12, texture.getHeight() / 2 - 12);
    projectileEntity.addComponent(new ParticleComponent(particleEffect));

    return projectileEntity;
}
 
开发者ID:opensourcegamedev,项目名称:SpaceChaos,代码行数:65,代码来源:ProjectileFactory.java


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