Example usage for com.badlogic.gdx.math Rectangle setSize

List of usage examples for com.badlogic.gdx.math Rectangle setSize

Introduction

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

Prototype

public Rectangle setSize(float width, float height) 

Source Link

Document

Sets the width and height of this rectangle

Usage

From source file:com.redtoorange.game.gameobject.GameMap.java

License:Open Source License

/**
 * Strip the rectangle objects from the TMX file and resize them to the correct scale for the game world.
 *
 * @param source      The collection of source rectangles from the TMX file.
 * @param destination The collection to place the resized rectangles.
 *///from   w w w .j  av  a  2 s.  co m
private void pullAndAddRectangles(Array<RectangleMapObject> source, Array<Rectangle> destination) {
    for (RectangleMapObject r : source) {
        Rectangle rectangle = r.getRectangle();

        Vector2 size = new Vector2();
        Vector2 center = new Vector2();

        rectangle.getSize(size);
        rectangle.getCenter(center);

        size.scl(mapScale);
        center.scl(mapScale);

        rectangle.setSize(size.x, size.y);
        rectangle.setCenter(center.x, center.y);

        destination.add(rectangle);
    }
}

From source file:de.cubicvoxel.openspacebox.ingame.object.Asteroid.java

License:Open Source License

private static Rectangle createRectangle(AsteroidProperties asteroidProperties) {
    Rectangle rect = new Rectangle();
    rect.setSize(asteroidProperties.getSize(), asteroidProperties.getSize());
    return rect;/*from  www . j  a  v a  2s. c  o  m*/
}

From source file:net.mwplay.cocostudio.ui.widget.TImage.java

License:Apache License

public Rectangle copyBox(float scale) {
    Rectangle rectangle = new Rectangle(box);
    rectangle.setSize(rectangle.getWidth() / 2f, rectangle.getHeight() / 2f);
    return rectangle;
}