Search in sources :

Example 6 with TextureView

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;
}
Also used : TextureView(ilargia.egdx.logicbricks.component.game.TextureView)

Example 7 with TextureView

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;
}
Also used : GameEntity(ilargia.egdx.logicbricks.gen.game.GameEntity) Vector2(com.badlogic.gdx.math.Vector2) Vector3(com.badlogic.gdx.math.Vector3) TextureView(ilargia.egdx.logicbricks.component.game.TextureView) RigidBody(ilargia.egdx.logicbricks.component.game.RigidBody)

Aggregations

TextureView (ilargia.egdx.logicbricks.component.game.TextureView)7 GameEntity (ilargia.egdx.logicbricks.gen.game.GameEntity)5 TextureActuator (ilargia.egdx.logicbricks.component.actuator.TextureActuator)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Vector2 (com.badlogic.gdx.math.Vector2)1 Vector3 (com.badlogic.gdx.math.Vector3)1 Body (com.badlogic.gdx.physics.box2d.Body)1 ParticleEffectActuator (ilargia.egdx.logicbricks.component.actuator.ParticleEffectActuator)1 Animations (ilargia.egdx.logicbricks.component.game.Animations)1 RigidBody (ilargia.egdx.logicbricks.component.game.RigidBody)1 ActuatorEntity (ilargia.egdx.logicbricks.gen.actuator.ActuatorEntity)1