Water.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:water2d-libgdx 作者:
/**
 * Constructor that allows to specify if there is an effect of waves and splash particles.
 * @param waves Specifies whether the object will have waves
 * @param splashParticles Specifies whether the object will have splash particles
 */
public Water(boolean waves, boolean splashParticles) {

    this.waves = waves;
    this.splashParticles = splashParticles;
    this.fixturePairs = new HashSet<Pair<Fixture, Fixture>>();
    this.setDebugMode(false);

    if (waves) {
        textureWater = new TextureRegion(new Texture(Gdx.files.internal("water.png")));
        polyBatch = new PolygonSpriteBatch();
    }

    if (splashParticles) {
        textureDrop = new Texture(Gdx.files.internal("drop.png"));
        spriteBatch = new SpriteBatch();
        particles = new ArrayList<Particle>();
    }

    shapeBatch = new ShapeRenderer();
    shapeBatch.setColor(0, 0.5f, 1, 1);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号