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 17package com.badlogic.gdx.maps.objects; 18 19import com.badlogic.gdx.graphics.g2d.TextureRegion; 20import com.badlogic.gdx.maps.MapObject; 21 22/** @brief Represents a map object containing a texture (region) */ 23public class TextureMapObject extends MapObject { 24 25 private float x = 0.0f; 26 private float y = 0.0f; 27 private float originX = 0.0f; 28 private float originY = 0.0f; 29 private float scaleX = 1.0f; 30 private float scaleY = 1.0f; 31 private float rotation = 0.0f; 32 private TextureRegion textureRegion = null; 33 34 /** @return x axis coordinate */ 35 public float getX () { 36 return x; 37 } 38 39 /** @param x new x axis coordinate */ 40 public void setX (float x) { 41 this.x = x; 42 } 43 44 /** @return y axis coordinate */ 45 public float getY () { 46 return y; 47 } 48 49 /** @param y new y axis coordinate */ 50 public void setY (float y) { 51 this.y = y; 52 } 53 54 /** @return x axis origin */ 55 public float getOriginX () { 56 return originX; 57 } 58 59 /** @param x new x axis origin */ 60 public void setOriginX (float x) { 61 this.originX = x; 62 } 63 64 /** @return y axis origin */ 65 public float getOriginY () { 66 return originY; 67 } 68 69 /** @param y new axis origin */ 70 public void setOriginY (float y) { 71 this.originY = y; 72 } 73 74 /** @return x axis scale */ 75 public float getScaleX () { 76 return scaleX; 77 } 78 79 /** @param x new x axis scale */ 80 public void setScaleX (float x) { 81 this.scaleX = x; 82 } 83 84 /** @return y axis scale */ 85 public float getScaleY () { 86 return scaleY; 87 } 88 89 /** @param y new y axis scale */ 90 public void setScaleY (float y) { 91 this.scaleY = y; 92 } 93 94 /** @return texture's rotation in radians */ 95 public float getRotation () { 96 return rotation; 97 } 98 99 /** @param rotation new texture's rotation in radians */ 100 public void setRotation (float rotation) { 101 this.rotation = rotation; 102 } 103 104 /** @return region */ 105 public TextureRegion getTextureRegion () { 106 return textureRegion; 107 } 108 109 /** @param region new texture region */ 110 public void setTextureRegion (TextureRegion region) { 111 textureRegion = region; 112 } 113 114 /** Creates an empty texture map object */ 115 public TextureMapObject () { 116 this(null); 117 } 118 119 /** Creates texture map object with the given region 120 * 121 * @param textureRegion the {@link TextureRegion} to use. */ 122 public TextureMapObject (TextureRegion textureRegion) { 123 super(); 124 this.textureRegion = textureRegion; 125 } 126} 127