Class UIUtil

java.lang.Object
squidpony.squidgrid.gui.gdx.UIUtil

public class UIUtil
extends Object
Author:
smelC
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  UIUtil.CornerStyle  
    static class  UIUtil.YMoveKind
    A vertical move triggered by keyboard keys.
  • Constructor Summary

    Constructors 
    Constructor Description
    UIUtil()  
  • Method Summary

    Modifier and Type Method Description
    static void drawLimitedWidthText​(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.BitmapFont font, String text, com.badlogic.gdx.graphics.Color color, int align, float width, float x, float y)
    Writes text at (x, y) by cutting off using "…" if it gets wider than width.
    static void drawMarginsAround​(float botLeftX, float botLeftY, int width, int height, int xmargin, int ymargin, com.badlogic.gdx.graphics.Color c)
    Draws margins around a rectangle
    static void drawMarginsAround​(com.badlogic.gdx.graphics.glutils.ShapeRenderer renderer_, float botLeftX, float botLeftY, float width, float height, float margin, com.badlogic.gdx.graphics.Color color, UIUtil.CornerStyle cornerStyle)  
    static void drawMarginsAround​(com.badlogic.gdx.graphics.glutils.ShapeRenderer renderer_, float botLeftX, float botLeftY, float width, float height, float margin, com.badlogic.gdx.graphics.Color color, UIUtil.CornerStyle cornerStyle, float zoomX, float zoomY)  
    static void drawMarginsAround​(com.badlogic.gdx.graphics.glutils.ShapeRenderer renderer_, com.badlogic.gdx.scenes.scene2d.Actor a, float margin, com.badlogic.gdx.graphics.Color color, UIUtil.CornerStyle cornerStyle)
    Draws margins around an actor.
    static void drawRectangle​(float botLeftX, float botLeftY, float width, float height, com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType st, com.badlogic.gdx.graphics.Color color)
    Draws a rectangle using a ShapeRenderer, allocating a new one for the occasion.
    static void drawRectangle​(com.badlogic.gdx.graphics.glutils.ShapeRenderer sRender_, float botLeftX, float botLeftY, float width, float height, com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType st, com.badlogic.gdx.graphics.Color color)
    Draws a rectangle using a ShapeRenderer.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • drawLimitedWidthText

      public static void drawLimitedWidthText​(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.BitmapFont font, String text, com.badlogic.gdx.graphics.Color color, int align, float width, float x, float y)
      Writes text at (x, y) by cutting off using "…" if it gets wider than width.
      Parameters:
      batch -
      font - The font to use
      text - The text to draw
      color - The text's color
      align - The alignment (see Align).
      width - The desired width of the text
      x - Where to draw
      y - Where to draw
    • drawMarginsAround

      public static void drawMarginsAround​(com.badlogic.gdx.graphics.glutils.ShapeRenderer renderer_, com.badlogic.gdx.scenes.scene2d.Actor a, float margin, com.badlogic.gdx.graphics.Color color, UIUtil.CornerStyle cornerStyle)
      Draws margins around an actor.
      Parameters:
      renderer_ - The renderer to use. If null a new one will be allocated.
      a - the actor to draw around
      margin - The size of the margin to draw.
      color - The margins' colors.
    • drawMarginsAround

      public static void drawMarginsAround​(float botLeftX, float botLeftY, int width, int height, int xmargin, int ymargin, com.badlogic.gdx.graphics.Color c)
      Draws margins around a rectangle
      Parameters:
      botLeftX - The rectangle's bottom left.
      botLeftY - The rectangle's bottom left.
      width - The rectangle's width.
      height - The rectangle's height.
      xmargin - The size of the left margin and the size of the right margin.
      ymargin - The size of the bottom margin and the size of the top margin.
      c - The margins' colors.
    • drawMarginsAround

      public static void drawMarginsAround​(com.badlogic.gdx.graphics.glutils.ShapeRenderer renderer_, float botLeftX, float botLeftY, float width, float height, float margin, com.badlogic.gdx.graphics.Color color, UIUtil.CornerStyle cornerStyle)
      Parameters:
      renderer_ - The renderer to use. If null a new one will be allocated.
      botLeftX - The bottom left x cell of the rectangle to draw around.
      botLeftY - The bottom left y cell of the rectangle to draw around.
      width - The width of the button considered.
      height - The width of the button considered.
      margin - The size of the margin to draw.
      color - The color to draw
      cornerStyle - The style with which to draw the margins
    • drawMarginsAround

      public static void drawMarginsAround​(com.badlogic.gdx.graphics.glutils.ShapeRenderer renderer_, float botLeftX, float botLeftY, float width, float height, float margin, com.badlogic.gdx.graphics.Color color, UIUtil.CornerStyle cornerStyle, float zoomX, float zoomY)
      Parameters:
      renderer_ - The renderer to use. If null a new one will be allocated.
      botLeftX - The bottom left x cell of the rectangle to draw around.
      botLeftY - The bottom left y cell of the rectangle to draw around.
      width - The width of the button considered.
      height - The width of the button considered.
      margin - The size of the margin to draw.
      color - The color to draw
      cornerStyle - The style with which to draw the margins
      zoomX - A multiplier for the world x-size of non-ShapeRenderer objects, that needs to be reversed for this
      zoomY - A multiplier for the world y-size of non-ShapeRenderer objects, that needs to be reversed for this
    • drawRectangle

      public static void drawRectangle​(com.badlogic.gdx.graphics.glutils.ShapeRenderer sRender_, float botLeftX, float botLeftY, float width, float height, com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType st, com.badlogic.gdx.graphics.Color color)
      Draws a rectangle using a ShapeRenderer.
      Parameters:
      sRender_ - The renderer to use. If null a new one will be allocated.
      botLeftX - The bottom left x of the rectangle.
      botLeftY - The bottom left y of the rectangle.
      width - The rectangle's width
      height - The rectangle's height
      st - The style to use
      color - The rectangle's color
    • drawRectangle

      public static void drawRectangle​(float botLeftX, float botLeftY, float width, float height, com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType st, com.badlogic.gdx.graphics.Color color)
      Draws a rectangle using a ShapeRenderer, allocating a new one for the occasion.
      Parameters:
      botLeftX - The bottom left x of the rectangle.
      botLeftY - The bottom left y of the rectangle.
      width - The rectangle's width
      height - The rectangle's height
      st - The style to use
      color - The rectangle's color