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 |
drawShape(Shape shape)
Draws an instance of
Shape |
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 |
drawSpriteCache(com.badlogic.gdx.graphics.g2d.SpriteCache spriteCache,
int cacheId) |
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.math.Matrix4 |
getProjectionMatrix() |
float |
getRotation() |
float |
getRotationX() |
float |
getRotationY() |
float |
getScaleX() |
float |
getScaleY() |
com.badlogic.gdx.graphics.Color |
getTint()
Returns the
Color tint being applied to all draw operations |
float |
getTranslationX() |
float |
getTranslationY() |
void |
postRender()
Called by mini2Dx after rendering
|
void |
preRender(int gameWidth,
int gameHeight)
Called by mini2Dx before rendering begins
|
Rectangle |
removeClip()
Removes the applied clip
|
void |
removeTint()
Removes the tinting
Color |
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 |
setClip(float x,
float y,
float width,
float height)
Sets the graphics context clip.
|
void |
setClip(Rectangle clip)
Sets the graphics context clip.
|
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 |
String |
toString() |
void |
translate(float translateX,
float translateY)
Moves the graphics context by a certain amount of the X and Y axis
|
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 drawShape(Shape shape)
Shapeshape - The implementation of Shape to drawpublic 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 drawSpriteCache(com.badlogic.gdx.graphics.g2d.SpriteCache spriteCache,
int cacheId)
public void rotate(float degrees,
float x,
float y)
degrees - The degree value in a clockwise directionx - The x coordinate to rotate aroundy - The y coordinate to rotate aroundpublic void scale(float scaleX,
float scaleY)
scaleX - Scaling along the X axisscaleY - Scaling along the Y axospublic void translate(float translateX,
float translateY)
translateX - The x axis translationtranslateY - The y axis translationpublic void setClip(float x,
float y,
float width,
float height)
x - The x coordinate the clip begins aty - The y coordinate the clip begins atwidth - The width of the clipheight - The height of the clippublic void setClip(Rectangle clip)
clip - The clip areapublic Rectangle removeClip()
public void setTint(com.badlogic.gdx.graphics.Color tint)
Color to apply to draw operationstint - The Color to tint withpublic void setFont(com.badlogic.gdx.graphics.g2d.BitmapFont font)
BitmapFont to draw Strings withfont - A non-null instance of BitmapFontpublic 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 com.badlogic.gdx.graphics.Color getTint()
Color tint being applied to all draw operationspublic float getScaleX()
public float getScaleY()
public float getTranslationX()
public float getTranslationY()
public float getRotation()
public float getRotationX()
public float getRotationY()
public com.badlogic.gdx.math.Matrix4 getProjectionMatrix()
Copyright © 2014. All rights reserved.