List of usage examples for com.badlogic.gdx.math Rectangle setCenter
public Rectangle setCenter(float x, float y)
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 . jav a2s . c om 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); } }