use of ilargia.egdx.logicbricks.component.game.TextureView in project Entitas-Java by Rubentxu.
the class AnimationSystem method execute.
@Override
public void execute(float deltaTime) {
for (GameEntity e : _groupAnimation.getEntities()) {
Animations animations = e.getAnimations();
TextureView view = e.getTextureView();
animations.time += deltaTime;
Animation<TextureRegion> animation = animations.currentAnimation;
if (animation != null) {
view.texture = animation.getKeyFrame(animations.time);
}
}
}
use of ilargia.egdx.logicbricks.component.game.TextureView in project Entitas-Java by Rubentxu.
the class ActuatorEntity method addTextureActuator.
public ActuatorEntity addTextureActuator(Bounds bounds, int opacity, Boolean flipX, Boolean flipY, Color tint) {
TextureActuator component = (TextureActuator) recoverComponent(ActuatorComponentsLookup.TextureActuator);
if (component == null) {
component = new TextureActuator(bounds, opacity, flipX, flipY, tint);
} else {
component.actuator = (indexOwner) -> {
GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
TextureView view = owner.getTextureView();
if (bounds != null)
view.bounds = bounds;
if (flipX != null)
view.flipX = flipX;
if (flipY != null)
view.flipY = flipY;
if (opacity != -1)
view.opacity = opacity;
if (tint != null)
view.tint = tint;
};
}
addComponent(ActuatorComponentsLookup.TextureActuator, component);
return this;
}
use of ilargia.egdx.logicbricks.component.game.TextureView in project Entitas-Java by Rubentxu.
the class ActuatorEntity method replaceTextureActuator.
public ActuatorEntity replaceTextureActuator(Bounds bounds, int opacity, Boolean flipX, Boolean flipY, Color tint) {
TextureActuator component = (TextureActuator) recoverComponent(ActuatorComponentsLookup.TextureActuator);
if (component == null) {
component = new TextureActuator(bounds, opacity, flipX, flipY, tint);
} else {
component.actuator = (indexOwner) -> {
GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
TextureView view = owner.getTextureView();
if (bounds != null)
view.bounds = bounds;
if (flipX != null)
view.flipX = flipX;
if (flipY != null)
view.flipY = flipY;
if (opacity != -1)
view.opacity = opacity;
if (tint != null)
view.tint = tint;
};
}
replaceComponent(ActuatorComponentsLookup.TextureActuator, component);
return this;
}
use of ilargia.egdx.logicbricks.component.game.TextureView in project Entitas-Java by Rubentxu.
the class GameEntity method replaceTextureView.
public GameEntity replaceTextureView(TextureRegion texture, Bounds bounds, boolean flipX, boolean flipY, float opacity, int layer, Color tint) {
TextureView component = (TextureView) recoverComponent(GameComponentsLookup.TextureView);
if (component == null) {
component = new TextureView(texture, bounds, flipX, flipY, opacity, layer, tint);
} else {
component.texture = texture;
component.bounds = bounds;
component.flipX = flipX;
component.flipY = flipY;
component.opacity = opacity;
component.layer = layer;
component.tint = tint;
}
replaceComponent(GameComponentsLookup.TextureView, component);
return this;
}
use of ilargia.egdx.logicbricks.component.game.TextureView in project Entitas-Java by Rubentxu.
the class TextureRendererSystem method render.
@Override
public void render() {
batch.setProjectionMatrix(cam.combined);
batch.begin();
for (GameEntity e : groupTextureView.getEntities()) {
TextureView view = e.getTextureView();
Body body = e.getRigidBody().body;
processTextureFlip(view);
batch.setColor(1f, 1f, 1f, 1f);
if (view.opacity < 1)
batch.setColor(1f, 1f, 1f, view.opacity);
batch.draw(view.texture, body.getPosition().x - view.bounds.extentsX, body.getPosition().y - view.bounds.extentsY, view.bounds.extentsX, view.bounds.extentsY, view.bounds.extentsX * 2, view.bounds.extentsY * 2, 1, 1, MathUtils.radiansToDegrees * body.getTransform().getRotation());
}
for (ActuatorEntity e : groupEffect.getEntities()) {
if (e.getLink().isOpen) {
ParticleEffectActuator effectActuator = e.getParticleEffectActuator();
effectActuator.particleEffect.draw(batch);
}
}
batch.end();
}
Aggregations