Class TextureScaler
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.building.TextureScaler
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTextureScaler
(com.badlogic.gdx.math.Vector2 leftPoint, com.badlogic.gdx.math.Vector2 maxX, com.badlogic.gdx.math.Vector2 maxY) TextureScaler
(com.badlogic.gdx.math.Vector2 leftPoint, com.badlogic.gdx.math.Vector2 maxX, com.badlogic.gdx.math.Vector2 maxY, com.badlogic.gdx.graphics.Texture baseTexture) Used to construct a TextureScaler with an existing texture - used for entities without a TextureRenderComponent. -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.math.GridPoint2
Returns the Gridpoint2 (x,y) position of this entity tile wiseint
Returns the height of this entity in tilesint
Returns the width of this entity in tilesboolean
setPreciseScale
(float desiredScale, boolean scaleWidth) Scales an entity with a TextureRenderComponent such that it occupies the desired number of tilesvoid
setSpawnPoint
(com.badlogic.gdx.math.GridPoint2 tilePoint, TerrainComponent terrain) void
setSpawnPoint
(com.badlogic.gdx.math.GridPoint2 tilePoint, TerrainComponent terrain, com.badlogic.gdx.math.Vector2 offset) Methods inherited from class com.deco2800.game.components.Component
create, dispose, earlyUpdate, getEntity, isAnimationRenderComponent, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Field Details
-
drawPoints
-
linePoints
-
-
Constructor Details
-
TextureScaler
public TextureScaler(com.badlogic.gdx.math.Vector2 leftPoint, com.badlogic.gdx.math.Vector2 maxX, com.badlogic.gdx.math.Vector2 maxY) -
TextureScaler
public TextureScaler(com.badlogic.gdx.math.Vector2 leftPoint, com.badlogic.gdx.math.Vector2 maxX, com.badlogic.gdx.math.Vector2 maxY, com.badlogic.gdx.graphics.Texture baseTexture) Used to construct a TextureScaler with an existing texture - used for entities without a TextureRenderComponent. For example, an Entity with an AnimationRenderComponent- Parameters:
leftPoint
- bottom left point of entitymaxX
- bottom right point of entity (max x value)maxY
- max y point of entitybaseTexture
- default texture of entity
-
-
Method Details
-
setPreciseScale
public boolean setPreciseScale(float desiredScale, boolean scaleWidth) Scales an entity with a TextureRenderComponent such that it occupies the desired number of tiles- Parameters:
desiredScale
- desired number of tiles to occupy (potentially float, but preferably integer input)scaleWidth
- scale the Entity's width if true, else scale Entitie's height- Returns:
- true if the entity was scaled, else false
-
getTileWidth
public int getTileWidth()Returns the width of this entity in tiles- Returns:
- tile width
-
getTileHeight
public int getTileHeight()Returns the height of this entity in tiles- Returns:
- tile height
-
getPosition
public com.badlogic.gdx.math.GridPoint2 getPosition()Returns the Gridpoint2 (x,y) position of this entity tile wise- Returns:
- tile position of Entity
-
setSpawnPoint
-
setSpawnPoint
public void setSpawnPoint(com.badlogic.gdx.math.GridPoint2 tilePoint, TerrainComponent terrain, com.badlogic.gdx.math.Vector2 offset)
-