Package squidpony.squidgrid.gui.gdx
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)
Writestext
at(x, y)
by cutting off using "…" if it gets wider thanwidth
.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 rectanglestatic 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 aShapeRenderer
, 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 aShapeRenderer
.
-
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)Writestext
at(x, y)
by cutting off using "…" if it gets wider thanwidth
.- Parameters:
batch
-font
- The font to usetext
- The text to drawcolor
- The text's coloralign
- The alignment (seeAlign
).width
- The desired width of the textx
- Where to drawy
- 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. Ifnull
a new one will be allocated.a
- the actor to draw aroundmargin
- 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. Ifnull
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 drawcornerStyle
- 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. Ifnull
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 drawcornerStyle
- The style with which to draw the marginszoomX
- A multiplier for the world x-size of non-ShapeRenderer objects, that needs to be reversed for thiszoomY
- 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 aShapeRenderer
.- Parameters:
sRender_
- The renderer to use. Ifnull
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 widthheight
- The rectangle's heightst
- The style to usecolor
- 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 aShapeRenderer
, 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 widthheight
- The rectangle's heightst
- The style to usecolor
- The rectangle's color
-