1 /******************************************************************************* 2 * Copyright 2011 See AUTHORS file. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 ******************************************************************************/ 16 17 package com.badlogic.gdx.maps.objects; 18 19 import com.badlogic.gdx.maps.MapObject; 20 import com.badlogic.gdx.math.Rectangle; 21 22 /** @brief Represents a rectangle shaped map object */ 23 public class RectangleMapObject extends MapObject { 24 25 private Rectangle rectangle; 26 27 /** @return rectangle shape */ 28 public Rectangle getRectangle () { 29 return rectangle; 30 } 31 32 /** Creates a rectangle object which lower left corner is at (0, 0) with width=1 and height=1 */ 33 public RectangleMapObject () { 34 this(0.0f, 0.0f, 1.0f, 1.0f); 35 } 36 37 /** Creates a {@link Rectangle} object with the given X and Y coordinates along with a given width and height. 38 * 39 * @param x X coordinate 40 * @param y Y coordinate 41 * @param width Width of the {@link Rectangle} to be created. 42 * @param height Height of the {@link Rectangle} to be created. */ 43 public RectangleMapObject (float x, float y, float width, float height) { 44 super(); 45 rectangle = new Rectangle(x, y, width, height); 46 } 47 48 } 49