public class Graphics extends Object
| Constructor and Description |
|---|
Graphics(com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch) |
| Modifier and Type | Method and Description |
|---|---|
void |
drawCircle(float centerX,
float centerY,
int radius)
Draws a circle to the window in the current
Color with the set
line height |
void |
drawRect(float x,
float y,
float width,
float height)
Renders a rectangle to the window in the current
Color with the
set line height |
void |
drawSprite(com.badlogic.gdx.graphics.g2d.Sprite sprite)
Draws a
Sprite with all transformations applied to this graphics
context |
void |
drawSprite(com.badlogic.gdx.graphics.g2d.Sprite sprite,
float x,
float y)
Draws a
Sprite at the given coordinates with all transformations
applied to this graphics context |
void |
drawString(String text,
float x,
float y)
Draws a string to the window
|
void |
drawTexture(com.badlogic.gdx.graphics.Texture texture,
float x,
float y)
Draws a texture to this graphics context
|
void |
drawTextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion,
float x,
float y)
Draws a texture region to this graphics context
|
void |
fillCircle(float centerX,
float centerY,
int radius)
Fills a circle to the window in the current
Color |
void |
fillRect(float x,
float y,
float width,
float height)
Fills a rectangle to the window in the current
Color |
com.badlogic.gdx.graphics.Color |
getBackgroundColor()
Returns the background
Color |
com.badlogic.gdx.graphics.Color |
getColor()
Returns the
Color to draw shapes with |
com.badlogic.gdx.graphics.g2d.BitmapFont |
getFont()
Returns the
BitmapFont to draw Strings with |
int |
getLineHeight()
Returns the line height used
|
com.badlogic.gdx.graphics.Color |
getTint()
Returns the
Color tint being applied to all draw operations |
void |
postRender()
Called by mini2Dx after rendering
|
void |
preRender(int gameWidth,
int gameHeight)
Called by mini2Dx before rendering begins
|
void |
removeTint()
Removes the tinting
Color |
void |
rotate(float degrees)
Rotates the canvas by the provided degrees around the center of the game
screen
|
void |
rotate(float degrees,
float x,
float y)
Rotates the canvas by the provided degrees around the provided point
|
void |
scale(float scaleX,
float scaleY)
Scales the canvas
|
void |
setBackgroundColor(com.badlogic.gdx.graphics.Color backgroundColor)
Sets the background
Color to be used |
void |
setColor(com.badlogic.gdx.graphics.Color color)
Sets the
Color to draw shapes with |
void |
setFont(com.badlogic.gdx.graphics.g2d.BitmapFont font)
Sets the
BitmapFont to draw Strings with |
void |
setLineHeight(int lineHeight)
Sets the line height to be used
|
void |
setTint(com.badlogic.gdx.graphics.Color tint)
Sets the
Color to apply to draw operations |
void |
translate(int translateX,
int translateY)
Applies a translation to rendering
|
public void preRender(int gameWidth,
int gameHeight)
gameWidth - The current game window widthgameHeight - The current game window heightpublic void postRender()
public void drawRect(float x,
float y,
float width,
float height)
Color with the
set line heightx - The x coordinate to render aty - The y coordinate to render atwidth - The width of the rectangleheight - The height of the rectanglepublic void fillRect(float x,
float y,
float width,
float height)
Colorx - The x coordinate to render aty - The y coordinate to render atwidth - The width of the rectangleheight - The height of the rectanglepublic void drawCircle(float centerX,
float centerY,
int radius)
Color with the set
line heightcenterX - The x coordinate of the center of the circlecenterY - The y coordinate of the center of the circleradius - The radius of the circlepublic void fillCircle(float centerX,
float centerY,
int radius)
ColorcenterX - The x coordinate of the center of the circlecenterY - The y coordinate of the center of the circleradius - The radius of the circlepublic void drawString(String text, float x, float y)
text - The String to drawx - The x coordinate to draw aty - The y coordinate to draw atpublic void drawTexture(com.badlogic.gdx.graphics.Texture texture,
float x,
float y)
texture - The Texture to drawx - The x coordinate to draw aty - The y coordinate to draw atpublic void drawTextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion,
float x,
float y)
textureRegion - The TextureRegion to drawx - The x coordinate to draw aty - The y coordinate to draw atpublic void drawSprite(com.badlogic.gdx.graphics.g2d.Sprite sprite)
Sprite with all transformations applied to this graphics
contextsprite - The Sprite to drawpublic void drawSprite(com.badlogic.gdx.graphics.g2d.Sprite sprite,
float x,
float y)
Sprite at the given coordinates with all transformations
applied to this graphics contextsprite - The Sprite to drawx - The x coordinate to render aty - The y coordinate to render atpublic void rotate(float degrees)
degrees - The degree value in a clockwise directionpublic void rotate(float degrees,
float x,
float y)
degrees - The degree value in a clockwise directionpublic void scale(float scaleX,
float scaleY)
scaleX - Scaling along the X axisscaleY - Scaling along the Y axospublic void translate(int translateX,
int translateY)
translateX - The x axis translationtranslateY - The y axis translationpublic void setTint(com.badlogic.gdx.graphics.Color tint)
Color to apply to draw operationstint - The Color to tint withpublic void removeTint()
Colorpublic int getLineHeight()
public void setLineHeight(int lineHeight)
lineHeight - A value greater than 0public com.badlogic.gdx.graphics.Color getColor()
Color to draw shapes withpublic void setColor(com.badlogic.gdx.graphics.Color color)
Color to draw shapes withcolor - public com.badlogic.gdx.graphics.Color getBackgroundColor()
Colorpublic void setBackgroundColor(com.badlogic.gdx.graphics.Color backgroundColor)
Color to be usedpublic com.badlogic.gdx.graphics.g2d.BitmapFont getFont()
BitmapFont to draw Strings withpublic void setFont(com.badlogic.gdx.graphics.g2d.BitmapFont font)
BitmapFont to draw Strings withfont - A non-null instance of BitmapFontpublic com.badlogic.gdx.graphics.Color getTint()
Color tint being applied to all draw operationsCopyright © 2014. All rights reserved.