Examples of Vector2


Examples of com.badlogic.gdx.math.Vector2

      nextState = GameState.PLAYING;
      maxTime = 90;
      currentTime = maxTime;
      msg = "Reorganize\nos objetos.\nVoce tem\n" + (int)maxTime + " segundos.";
      for (GameObject objeto : objetos) {
        objeto.AddComponent(new TouchComponent(new Vector2(100, 100)));
        verifyOriginalLocation.add(objeto.getComponent(MyHomeComponent.class));
      }
    }
  }
View Full Code Here

Examples of com.badlogic.gdx.math.Vector2

public class PhysicsGDX implements Physics {

    @Override
    public void initialize() {

        m_world = new World(new Vector2(0, 0), true);
        m_bodies = new HashMap<>();
        m_mapBodies = new ArrayList<>();
        m_segments = new HashMap<>();
        m_debugSegments = new ArrayList<>();
        m_bodiesSizes = new HashMap<>();
View Full Code Here

Examples of com.badlogic.gdx.math.Vector2

        /*
         * Shape creation
         */
        PolygonShape shape = new PolygonShape();
        Vector2 pos = new Vector2(size.x / (2.f * PIXELS_PER_METERS), size.y / (2.f * PIXELS_PER_METERS));
        shape.setAsBox(size.x / (2.f * PIXELS_PER_METERS), size.y / (2.f * PIXELS_PER_METERS), pos, 0);

        m_bodiesSizes.put(name, new Vector2D(size));

        /*
 
View Full Code Here

Examples of com.badlogic.gdx.math.Vector2

                        /*
                         * Shape creation
                         */
                        EdgeShape shape = new EdgeShape();
                        Vector2 first = toVector2(new Vector2D(seg.getFirst()).translate((x) * 64, (y) * 64).scale(1.f / PIXELS_PER_METERS));
                        Vector2 second = toVector2(new Vector2D(seg.getSecond()).translate((x) * 64, (y) * 64).scale(1.f / PIXELS_PER_METERS));
                        shape.set(first, second);

                        /*
                         * Body Creation
                         */
 
View Full Code Here

Examples of com.badlogic.gdx.math.Vector2

        return toVector2D(m_bodies.get(name).getPosition()).scale(PIXELS_PER_METERS);
    }

    @Override
    public void setBodyPosition(String name, Vector2D position) {
        Vector2 pos = toVector2(new Vector2D(position).scale(1.f / PIXELS_PER_METERS));
        float rotation = m_bodies.get(name).getAngle();
        m_bodies.get(name).setTransform(pos, rotation);
    }
View Full Code Here

Examples of com.badlogic.gdx.math.Vector2

            String name = m_positionsToModify.keySet().iterator().next();
            Vector2D position = m_positionsToModify.remove(name);
            Vector2D velocity = m_velocitiesToModify.remove(name);
            float rotation = m_rotationToModify.remove(name);
            if (m_bodies.containsKey(name)) {
                Vector2 pos = toVector2(new Vector2D(position).scale(1.f / PIXELS_PER_METERS));
//                float rotation = m_bodies.get(name).getAngle();
                m_bodies.get(name).setTransform(pos, rotation);
                m_bodies.get(name).setLinearVelocity(toVector2(new Vector2D(velocity).scale(1.f / PIXELS_PER_METERS)));
            }
        }
View Full Code Here

Examples of com.badlogic.gdx.math.Vector2

    @Override
    public Vector2D getBodyCenter(String name) {
        Body body = m_bodies.get(name);
        Vector2D size = m_bodiesSizes.get(name);
        return toVector2D(body.getTransform().mul(new Vector2(size.x / (PIXELS_PER_METERS * 2.f), size.y / (PIXELS_PER_METERS * 2.f)))).scale(PIXELS_PER_METERS);
    }
View Full Code Here

Examples of com.badlogic.gdx.math.Vector2

                for (Fixture fixture : body.getFixtureList()) {

                    if (fixture != null && fixture.getType() == Type.Polygon) {
                        PolygonShape shape = (PolygonShape) fixture.getShape();
                        for (int i = 0; i < shape.getVertexCount(); i++) {
                            Vector2 vec = new Vector2();
                            shape.getVertex(i, vec);
                            vertices.add(body.getTransform().mul(vec));
                        }

                        for (int i = 0; i < vertices.size(); i++) {
View Full Code Here

Examples of com.badlogic.gdx.math.Vector2

    private static Vector2D toVector2D(Vector2 v) {
        return new Vector2D(v.x, v.y);
    }

    private static Vector2 toVector2(Vector2D v) {
        return new Vector2(v.x, v.y);
    }
View Full Code Here

Examples of com.badlogic.gdx.math.Vector2

        }
    }

    private void packTileSet(TileSet set, FileHandle inputDirHandle, File outputDir, Settings settings) throws IOException {
        BufferedImage tile;
        Vector2 tileLocation;
        TileSetLayout packerTileSet;
        Graphics g;

        packer = new TexturePacker(settings);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.