Example usage for com.badlogic.gdx.math Vector2 Vector2

List of usage examples for com.badlogic.gdx.math Vector2 Vector2

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Vector2 Vector2.

Prototype

public Vector2() 

Source Link

Document

Constructs a new vector at (0,0)

Usage

From source file:com.mob.client.engine.PhysicsEngine.java

License:Open Source License

public void initEngine() {

    // Init box2d world
    this.mWorld = new World(new Vector2(), true);
    this.mDebugRenderer = new Box2DDebugRenderer();
    this.mDebugRenderer.setDrawBodies(false);

    // RayHandler setup
    RayHandler.setGammaCorrection(true);
    RayHandler.useDiffuseLight(true);//from w  w w.j a  va  2s.c  o  m
    this.mRayHandler = new RayHandler(this.mWorld);
    this.mRayHandler.setCulling(true);
    this.mRayHandler.setBlurNum(5);

    // LightHandler setup
    this.setLightHandler(new LightHandler(this.mGame));
}

From source file:com.mobidevelop.maps.editor.ui.utils.Tooltips.java

License:Apache License

public void showTooltip(Actor actor) {
    Vector2 v = new Vector2();
    actor.localToStageCoordinates(v);//from ww  w  . j  ava 2 s  .  c  o m
    if (tooltip == null) {
        LabelStyle style = new LabelStyle();
        style.font = tooltipStyle.font;
        style.background = tooltipStyle.background;
        style.fontColor = tooltipStyle.fontColor;
        tooltip = new Label(tooltips.get(actor), style);
        tooltip.setStyle(style);
        tooltip.pack();
        tooltip.setPosition(v.x + 7.5f, v.y - tooltip.getPrefHeight() - 15);

        tooltip.setOriginY(tooltip.getPrefHeight());
        tooltip.setColor(1, 1, 1, 0);
        tooltip.setScale(1, 0);
        tooltip.addAction(parallel(fadeIn(0.15f), scaleTo(1, 1, 0.15f)));
    } else {
        tooltip.setText(tooltips.get(actor));
        tooltip.pack();
        tooltip.setPosition(v.x + 7.5f, v.y - tooltip.getPrefHeight() - 15);
    }
    stage.addActor(tooltip);
}

From source file:com.mygdx.entities.DynamicEntities.SteerableEntity.java

public SteerableEntity(Vector2 pos, float w, float h) {
    super(pos, w, h);

    bd.position.set(pos.x / PPM, pos.y / PPM);
    bd.type = BodyDef.BodyType.DynamicBody;
    cshape.setRadius(width / PPM);/*from   w  w  w . j a v  a2  s . c o m*/
    shape.setAsBox(width / PPM, height / PPM);
    fd.shape = cshape;
    userdata = "steerable_" + id;

    this.maxLinearSpeed = 500f;
    this.maxLinearAcceleration = 500f;
    this.maxAngularSpeed = 30f;
    this.maxAngularAcceleration = 5f;

    boundingRadius = cshape.getRadius();

    this.tagged = false;
    this.steeringOutput = new SteeringAcceleration<Vector2>(new Vector2());

}