Class UITextureController

java.lang.Object
tech.underoaks.coldcase.game.UITextureController

public class UITextureController extends Object
This class is responsible for providing the skin for the UI elements.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new UITextureController instance using the provided TextureFactory.
    static boolean
    Checks whether a UITextureController instance has been initialized.
    com.badlogic.gdx.scenes.scene2d.utils.Drawable
    Returns a Drawable representing the "button down" texture.
    com.badlogic.gdx.math.Vector2
    Calculates and returns the size of a button based on the dimensions of the buttonUp texture scaled by the button size multiplier.
    com.badlogic.gdx.scenes.scene2d.utils.Drawable
    Returns a Drawable representing the "button up" texture.
    com.badlogic.gdx.graphics.g2d.BitmapFont
    Returns the BitmapFont used by the UI.
    Returns the singleton instance of UITextureController.
    com.badlogic.gdx.scenes.scene2d.ui.Image
    Returns an Image configured as the menu background.
    com.badlogic.gdx.scenes.scene2d.utils.Drawable
    Returns a Drawable representing the reload button texture.
    com.badlogic.gdx.scenes.scene2d.ui.Skin
    Returns the Skin used for styling UI elements.
    static char
    mapIntToLetter(int number, boolean isUpperCase)
    Maps an integer to a letter.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static UITextureController create(TextureFactory factory)
      Creates a new UITextureController instance using the provided TextureFactory.

      If an instance is already initialized, this method throws an IllegalStateException.

      Parameters:
      factory - the TextureFactory used to create textures for UI elements
      Returns:
      the newly created UITextureController instance
      Throws:
      IllegalStateException - if the UITextureController has already been initialized
    • getInstance

      public static UITextureController getInstance()
      Returns the singleton instance of UITextureController.

      If the instance has not been created yet, this method throws an IllegalStateException.

      Returns:
      the UITextureController instance
      Throws:
      IllegalStateException - if the UITextureController is not initialized
    • exists

      public static boolean exists()
      Checks whether a UITextureController instance has been initialized.
      Returns:
      true if a UITextureController instance exists; false otherwise
    • getSkin

      public com.badlogic.gdx.scenes.scene2d.ui.Skin getSkin()
      Returns the Skin used for styling UI elements.
      Returns:
      the Skin instance
    • getButtonSize

      public com.badlogic.gdx.math.Vector2 getButtonSize()
      Calculates and returns the size of a button based on the dimensions of the buttonUp texture scaled by the button size multiplier.
      Returns:
      a Vector2 containing the width and height of a button
    • getButtonUp

      public com.badlogic.gdx.scenes.scene2d.utils.Drawable getButtonUp()
      Returns a Drawable representing the "button up" texture.
      Returns:
      a Drawable for the button up state
    • getButtonDown

      public com.badlogic.gdx.scenes.scene2d.utils.Drawable getButtonDown()
      Returns a Drawable representing the "button down" texture.
      Returns:
      a Drawable for the button down state
    • getReloadButton

      public com.badlogic.gdx.scenes.scene2d.utils.Drawable getReloadButton()
      Returns a Drawable representing the reload button texture.
      Returns:
      a Drawable for the reload button
    • getMenuBackground

      public com.badlogic.gdx.scenes.scene2d.ui.Image getMenuBackground()
      Returns an Image configured as the menu background.

      The returned Image is set to fill its parent and uses a fill scaling mode.

      Returns:
      the menu background Image
    • getFont

      public com.badlogic.gdx.graphics.g2d.BitmapFont getFont()
      Returns the BitmapFont used by the UI.
      Returns:
      the BitmapFont instance
    • mapIntToLetter

      public static char mapIntToLetter(int number, boolean isUpperCase)
      Maps an integer to a letter.
      Parameters:
      number - The number to map to a letter. Must be between 1 and 26. 1 corresponds to 'a' or 'A', 2 to 'b' or 'B', etc.
      isUpperCase - Whether the letter should be uppercase.
      Returns:
      The letter corresponding to the number.
      Throws:
      IllegalArgumentException - If the number is not between 1 and 26.