Search in sources :

Example 1 with KeyState

use of ilargia.egdx.api.managers.data.KeyState in project Entitas-Java by Rubentxu.

the class InputManagerGDX method update.

@Override
public void update(float deltaTime) {
    //for every keystate, set pressed and released to false.
    for (int i = 0; i < 256; i++) {
        KeyState k = inputStateData.keyStates[i];
        k.pressed = false;
        k.released = false;
    }
    for (int i = 0; i < inputStateData.pointerStates.length; i++) {
        PointerState<Vector2, Vector3> t = inputStateData.pointerStates[i];
        if (t.down && !t.pressed)
            t.clickTime += deltaTime;
        t.pressed = false;
        t.released = false;
        t.displacement.x = 0;
        t.displacement.y = 0;
    }
    if (entitas.actuator.hasDragActuator() && jointDef == null) {
        this.dragActuator = entitas.actuator.getDragActuator();
        jointDef = new MouseJointDef();
        jointDef.bodyA = Indexed.getInteractiveEntity(dragActuator.targetEntity).getRigidBody().body;
        jointDef.collideConnected = dragActuator.collideConnected;
        jointDef.maxForce = dragActuator.maxForce;
    }
    for (GameController controller : controllers) {
        controller.update(this, entitas);
    }
}
Also used : Vector2(com.badlogic.gdx.math.Vector2) GameController(ilargia.egdx.api.GameController) Vector3(com.badlogic.gdx.math.Vector3) KeyState(ilargia.egdx.api.managers.data.KeyState) MouseJoint(com.badlogic.gdx.physics.box2d.joints.MouseJoint) MouseJointDef(com.badlogic.gdx.physics.box2d.joints.MouseJointDef)

Aggregations

Vector2 (com.badlogic.gdx.math.Vector2)1 Vector3 (com.badlogic.gdx.math.Vector3)1 MouseJoint (com.badlogic.gdx.physics.box2d.joints.MouseJoint)1 MouseJointDef (com.badlogic.gdx.physics.box2d.joints.MouseJointDef)1 GameController (ilargia.egdx.api.GameController)1 KeyState (ilargia.egdx.api.managers.data.KeyState)1