use of ilargia.egdx.logicbricks.component.game.TextureView in project Entitas-Java by Rubentxu.
the class GameEntity method addTextureView.
public GameEntity addTextureView(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;
}
addComponent(GameComponentsLookup.TextureView, component);
return this;
}
use of ilargia.egdx.logicbricks.component.game.TextureView in project Entitas-Java by Rubentxu.
the class PointerOverSensorSystem method isOver.
private boolean isOver(PointerOverSensor sensor, int pointer) {
PointerState<Vector2, Vector3> touchState = inputManager.getTouchState(pointer);
if (touchState.down) {
Set<GameEntity> targets = Indexed.getTagEntities(sensor.targetTag);
for (GameEntity target : targets) {
TextureView view = target.getTextureView();
RigidBody rigidBody = target.getRigidBody();
if (view != null && rigidBody != null) {
testRectangle.setPosition(rigidBody.body.getPosition().x, rigidBody.body.getPosition().y);
testRectangle.setSize(view.bounds.extentsX * 2, view.bounds.extentsY * 2);
return testRectangle.contains(touchState.coordinates.x, touchState.coordinates.y);
}
}
}
return false;
}
Aggregations