本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.decals.Decal.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Decal.setWidth方法的具体用法?Java Decal.setWidth怎么用?Java Decal.setWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g3d.decals.Decal
的用法示例。
在下文中一共展示了Decal.setWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入方法依赖的package包/类
/**
* Sets the current position of the rendered {@link Decal}, and the rotation given by the bullet direction.
*
* @param entityId the bullet id
* @param renderSystem the delegating {@link RenderSystem}
*/
@Override
public void process(int entityId, RenderSystem renderSystem) {
PhysicComponent physic = renderSystem.getMapperPhysic().get(entityId);
RenderComponent render = renderSystem.getMapperRender().get(entityId);
float deg = (float) (Math.atan2(physic.body.getLinearVelocity().y, physic.body.getLinearVelocity().x) * 180.0 / Math.PI);
Decal decal = renderSystem.getDecalMap().get(entityId);
decal.setRotationZ(deg);
float stateTime = renderSystem.getStateTime();
TextureRegion region = render.getCurrentKeyFrame(stateTime);
region.flip(region.isFlipX() ^ render.flipX, region.isFlipY() ^ render.flipY);
decal.setTextureRegion(region);
RenderComponent.RenderTemplate.AnimationTemplate template = render.getCurrentAnimation();
decal.setWidth(template.width);
decal.setHeight(template.height);
decal.setPosition(physic.body.getPosition().x, physic.body.getPosition().y, decal.getZ());
}
示例2: sonarDecal
import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入方法依赖的package包/类
public Decal sonarDecal() {
Decal decal = Decal.newDecal(this.effectsAtlas.findRegion("sonar_ping"), true);
decal.setWidth(1);
decal.setHeight(1);
decal.rotateX(90);
return decal;
}
示例3: draw
import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入方法依赖的package包/类
public void draw(Type type, Texture texture, float x, float y, float z, float width, float height, Color tint) {
Decal sprite = nextUsable();
setTexture(sprite, texture);
sprite.setWidth(width);
sprite.setHeight(height);
sprite.setPosition(x, y, z);
setTintAndBlending(sprite, tint);
setRotation(sprite, type);
}
示例4: process
import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入方法依赖的package包/类
/**
* Updates the {@link gg.al.character.Character} {@link Decal}, and uses the currently set animation from the {@link RenderComponent}.<br>
* Also redraws the health and resource bars, and updates their position accordingly.
*
* @param entityId the {@link gg.al.character.Character} entity id
* @param renderSystem the delegating {@link RenderSystem}
*/
@Override
public void process(int entityId, RenderSystem renderSystem) {
PhysicComponent physic = renderSystem.getMapperPhysic().get(entityId);
RenderComponent render = renderSystem.getMapperRender().get(entityId);
StatComponent stats = renderSystem.getMapperStats().get(entityId);
CharacterComponent character = renderSystem.getMapperCharacterComponent().get(entityId);
Decal decal = renderSystem.getDecalMap().get(entityId);
float stateTime = renderSystem.getStateTime();
if (character != null && render.isInState(ATTACK)) {
stateTime = render.animations.get(PlayerRenderState.ATTACK.name()).getAnimationDuration() * character.getRenderMultiplicator();
} else if (character != null && render.isInAnyState(
ABILITY_1, ABILITY_2, ABILITY_3, ABILITY_4, TRAIT
)) {
stateTime = render.stateTimes.get(render.renderState);
stateTime += renderSystem.getDelta();
if (render.animations.get(render.renderState).isAnimationFinished(stateTime)) {
render.stateTimes.put(render.renderState, 0f);
render.setRenderState(IDLE);
} else
render.stateTimes.put(render.renderState, stateTime);
}
TextureRegion region = render.getCurrentKeyFrame(stateTime);
region.flip(region.isFlipX() ^ render.flipX, region.isFlipY() ^ render.flipY);
decal.setTextureRegion(region);
RenderComponent.RenderTemplate.AnimationTemplate template = render.getCurrentAnimation();
decal.setWidth(template.width);
decal.setHeight(template.height);
decal.setPosition(physic.body.getPosition().x, physic.body.getPosition().y, decal.getZ());
SpriteBatch shaderBatch = renderSystem.getShaderBatch();
ShaderProgram shader = renderSystem.getGradientShader();
drawToBuffer(healthBuffers.get(entityId), healthBarColor, renderSystem.getLevelAssets().health_bar_gradient,
stats.getRuntimeStat(StatComponent.RuntimeStat.health) / stats.getCurrentStat(StatComponent.BaseStat.maxHealth),
shaderBatch, shader, cameraBar.combined);
drawToBuffer(resourceBuffers.get(entityId), resourceBarColor, renderSystem.getLevelAssets().health_bar_gradient,
stats.getRuntimeStat(StatComponent.RuntimeStat.resource) / stats.getCurrentStat(StatComponent.BaseStat.maxResource),
shaderBatch, shader, cameraBar.combined);
FrameBuffer buffer = renderSystem.getBuffers().get(entityId);
buffer.begin();
AL.graphics.getGL20().glClearColor(0, 0, 0, 0);
AL.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT);
renderSystem.getSpriteBatch().setProjectionMatrix(uiCamera.combined);
renderSystem.getSpriteBatch().begin();
//renderSystem.getFont().draw(renderSystem.getSpriteBatch(), String.format("%1.0f", stats.getRuntimeStat(StatComponent.RuntimeStat.actionPoints)), 0, buffer.getHeight());
renderSystem.getSpriteBatch().draw(resourceBars.get(entityId), 50 - UI_WIDTH / 2, -UI_HEIGHT / 2 + RESOURCE_OFFSET, 175, 75 / 2);
renderSystem.getSpriteBatch().draw(healthBars.get(entityId), 50 - UI_WIDTH / 2, -30, 200, 100 / 2);
renderSystem.getFont().draw(renderSystem.getSpriteBatch(), String.format("%1.0f", stats.getRuntimeStat(StatComponent.RuntimeStat.actionPoints)),
-UI_WIDTH / 2 - 4, 20);
renderSystem.getSpriteBatch().end();
buffer.end();
Decal uiDecal = renderSystem.getUiMap().get(entityId);
uiDecal.setPosition(physic.body.getPosition().x, physic.body.getPosition().y + decal.getHeight() / 2, uiDecal.getZ());
}