Class TextureScaler

java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.building.TextureScaler

public class TextureScaler extends Component
  • Field Details

    • drawPoints

      public List<com.badlogic.gdx.math.Vector2> drawPoints
    • linePoints

      public List<com.badlogic.gdx.math.Vector2> 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 entity
      maxX - bottom right point of entity (max x value)
      maxY - max y point of entity
      baseTexture - 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

      public void setSpawnPoint(com.badlogic.gdx.math.GridPoint2 tilePoint, TerrainComponent terrain)
    • setSpawnPoint

      public void setSpawnPoint(com.badlogic.gdx.math.GridPoint2 tilePoint, TerrainComponent terrain, com.badlogic.gdx.math.Vector2 offset)