| Modifier and Type | Field and Description |
|---|---|
LibgdxSpriteBatchWrapper |
spriteBatch |
| Constructor and Description |
|---|
LibgdxGraphics(GameWrapper gameWrapper,
LibgdxSpriteBatchWrapper spriteBatch,
com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch polygonSpriteBatch,
com.badlogic.gdx.graphics.glutils.ShapeRenderer shapeRenderer) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearBlendFunction()
Resets the blend function to its default
|
void |
clearContext()
Clears the graphics context (e.g.
|
void |
clearContext(Color color)
Clears the graphics context (e.g.
|
void |
clearContext(Color color,
boolean depthBufferBit,
boolean colorBufferBit)
Clears the graphics context (e.g.
|
void |
clearScaling()
Resets scaling back to default values
|
void |
clearShader()
Clears the
Shader program applied to this instance |
void |
disableBlending()
Disables blending during rendering
|
void |
drawCircle(float centerX,
float centerY,
float radius)
Draws a circle to the window in the current
Color with the set
line height |
void |
drawCircle(float centerX,
float centerY,
int radius)
Draws a circle to the window in the current
Color with the set
line height |
void |
drawFontCache(GameFontCache fontCache)
Draws a
GameFontCache to the screen |
void |
drawLineSegment(float x1,
float y1,
float x2,
float y2)
Renders a line segment to the window in the current
Color with
the set line height |
void |
drawNinePatch(NinePatch ninePatch,
float x,
float y,
float width,
float height)
Draws a
NinePatch to screen |
void |
drawParticleEffect(ParticleEffect effect)
Draws a
ParticleEffect to screen |
void |
drawPolygon(float[] vertices)
Draws a polygon to the window in the current
Color |
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(Sprite sprite)
Draws a
Sprite with all transformations applied to this graphics
context |
void |
drawSprite(Sprite sprite,
float x,
float y)
Draws a
Sprite at the given coordinates with all transformations
applied to this graphics context |
void |
drawSpriteCache(SpriteCache spriteCache,
int cacheId)
Draws a
SpriteCache |
void |
drawString(java.lang.String text,
float x,
float y)
Draws a string to the window
|
void |
drawString(java.lang.String text,
float x,
float y,
float targetWidth)
Draws a string to the window, automatically wrapping it within a
specified width
|
void |
drawString(java.lang.String text,
float x,
float y,
float targetWidth,
int horizontalAlign)
Draws a string to the window, automatically wrapping it within a
specified width and aligning it to the left, center or right of the width
|
void |
drawTexture(Texture texture,
float x,
float y)
Draws a texture to this graphics context
|
void |
drawTexture(Texture texture,
float x,
float y,
boolean flipY)
Draws a texture to this graphics context
|
void |
drawTexture(Texture texture,
float x,
float y,
float width,
float height)
Draws a texture to this graphics context
|
void |
drawTexture(Texture texture,
float x,
float y,
float width,
float height,
boolean flipY) |
void |
drawTextureRegion(TextureRegion textureRegion,
float x,
float y)
Draws a texture region to this graphics context
|
void |
drawTextureRegion(TextureRegion textureRegion,
float x,
float y,
float width,
float height)
Draws a texture region to this graphics context
|
void |
drawTextureRegion(TextureRegion textureRegion,
float x,
float y,
float width,
float height,
float rotation)
Draws a texture region to this graphics context
|
void |
drawTilingDrawable(TilingDrawable tilingDrawable,
float x,
float y,
float width,
float height)
Draws a
TilingDrawable to screen |
void |
drawTriangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
Draws a triangle to the window in the current
Color |
void |
enableBlending()
Enables blending during rendering
|
void |
fillCircle(float centerX,
float centerY,
float radius)
Fills a circle to the window in the current
Color |
void |
fillCircle(float centerX,
float centerY,
int radius)
Fills a circle to the window in the current
Color |
void |
fillPolygon(float[] vertices,
short[] triangles)
Fills a polygon 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 |
void |
fillShape(Shape shape)
Fills an instance of
Shape |
void |
fillTriangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
Draws a triangle to the window in the current
Color |
void |
flush()
Immediately flushes everything rendered rather than waiting until the end
of rendering
|
Color |
getBackgroundColor()
Returns the background
Color |
Color |
getColor()
Returns the
Color to draw shapes with |
GameFont |
getFont()
Returns the
GameFont to draw Strings with |
long |
getFrameId()
Returns the frame number
|
int |
getLineHeight()
Returns the line height used
|
TextureFilter |
getMagFilter()
Returns the current mag texture filter.
|
TextureFilter |
getMinFilter()
Returns the current min texture filter.
|
org.mini2Dx.gdx.math.Matrix4 |
getProjectionMatrix()
Returns the
Matrix4 viewport projection |
float |
getRotation()
Returns the viewport rotation (in degrees)
|
float |
getRotationX()
Returns the origin X coordinate of the viewport rotation
|
float |
getRotationY()
Returns the origin Y coordinate of the viewport rotation
|
float |
getScaleX()
Returns the X scaling factor
|
float |
getScaleY()
Returns the Y scaling factor
|
Shader |
getShader()
Returns the currently applied
Shader program |
Color |
getTint()
Returns the
Color tint being applied to all draw operations |
float |
getTranslationX()
Returns the translation of the viewport along the X axis
|
float |
getTranslationY()
Returns the translation of the viewport along the Y axis
|
float |
getViewportHeight()
Returns the height of the viewport
|
float |
getViewportWidth()
Returns the width of the viewport
|
int |
getWindowHeight()
Returns the height of the window
|
int |
getWindowSafeHeight()
Returns the safe height of the window.
|
int |
getWindowSafeWidth()
Returns the safe width of the window.
|
int |
getWindowSafeX()
Returns the X coordinate of the beginning of the safe area.
|
int |
getWindowSafeY()
Returns the Y coordinate of the beginning of the safe area.
|
int |
getWindowWidth()
Returns the width of the window
|
boolean |
isWindowReady()
Returns if the game window is initialised natively
|
Rectangle |
peekClip()
Returns the current clip
|
void |
peekClip(Rectangle rectangle)
Returns the current clip
|
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 (multiplies scale value)
|
void |
setBackgroundColor(Color backgroundColor)
Sets the background
Color to be used |
void |
setBlendFunction(Mini2DxBlendFunction srcFunc,
Mini2DxBlendFunction dstFunc)
Sets the blend function to be applied
OpenGL Blend Function Cheatsheet
|
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(Color color)
Sets the
Color to draw shapes with |
void |
setFont(GameFont font)
Sets the
GameFont to draw Strings with |
void |
setLineHeight(int lineHeight)
Sets the line height to be used
|
void |
setMagFilter(TextureFilter filter)
Sets the texture mag filter that will be used for all the subsequent texture drawing operations
|
void |
setMinFilter(TextureFilter filter)
Sets the texture min filter that will be used for all the subsequent texture drawing operations
|
void |
setRotation(float degrees,
float x,
float y)
Sets the canvas rotation around a provided point
|
void |
setScale(float scaleX,
float scaleY)
Sets the canvas scale
|
void |
setShader(Shader shader)
Applies a
Shader program to this instance |
void |
setTint(Color tint)
Sets the
Color to apply to draw operations |
void |
setTranslation(float translateX,
float translateY)
Sets the translation coordinates
|
void |
translate(float translateX,
float translateY)
Moves the graphics context by a certain amount of the X and Y axis
|
public final LibgdxSpriteBatchWrapper spriteBatch
public LibgdxGraphics(GameWrapper gameWrapper, LibgdxSpriteBatchWrapper spriteBatch, com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch polygonSpriteBatch, com.badlogic.gdx.graphics.glutils.ShapeRenderer shapeRenderer)
public void preRender(int gameWidth,
int gameHeight)
Graphicspublic void postRender()
GraphicspostRender in interface Graphicspublic void clearContext()
GraphicsclearContext in interface Graphicspublic void clearContext(Color color)
GraphicsclearContext in interface Graphicscolor - The Color to clear withpublic void clearContext(Color color, boolean depthBufferBit, boolean colorBufferBit)
GraphicsclearContext in interface Graphicscolor - The Color to clear withdepthBufferBit - True if depth buffer bit should be set during clearcolorBufferBit - True if color buffer bit should be set during clearpublic void drawLineSegment(float x1,
float y1,
float x2,
float y2)
GraphicsColor with
the set line heightdrawLineSegment in interface Graphicsx1 - X coordinate of point Ay1 - Y coordinate of point Ax2 - X coordinate of point By2 - Y coordinate of point Bpublic void drawRect(float x,
float y,
float width,
float height)
GraphicsColor with the
set line heightpublic void fillRect(float x,
float y,
float width,
float height)
GraphicsColorpublic void drawCircle(float centerX,
float centerY,
int radius)
GraphicsColor with the set
line heightdrawCircle in interface GraphicscenterX - The x coordinate of the center of the circlecenterY - The y coordinate of the center of the circleradius - The radius of the circlepublic void drawCircle(float centerX,
float centerY,
float radius)
GraphicsColor with the set
line heightdrawCircle in interface GraphicscenterX - 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)
GraphicsColorfillCircle in interface GraphicscenterX - 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,
float radius)
GraphicsColorfillCircle in interface GraphicscenterX - The x coordinate of the center of the circlecenterY - The y coordinate of the center of the circleradius - The radius of the circlepublic void drawTriangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
GraphicsColordrawTriangle in interface Graphicsx1 - The x coordinate of the first pointy1 - The y coordinate of the first pointx2 - The x coordinate of the second pointy2 - The y coordinate of the second pointx3 - The x coordinate of the third pointy3 - The y coordinate of the third pointpublic void fillTriangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
GraphicsColorfillTriangle in interface Graphicsx1 - The x coordinate of the first pointy1 - The y coordinate of the first pointx2 - The x coordinate of the second pointy2 - The y coordinate of the second pointx3 - The x coordinate of the third pointy3 - The y coordinate of the third pointpublic void drawPolygon(float[] vertices)
GraphicsColordrawPolygon in interface Graphicsvertices - The vertices of the polygon in format x1,y1,x2,y2,x3,y3,etc.public void fillPolygon(float[] vertices,
short[] triangles)
GraphicsColorfillPolygon in interface Graphicsvertices - The vertices of the polygon in format x1,y1,x2,y2,x3,y3,etc.triangles - The indices in the vertices parameter that make up the
triangles of the polygonpublic void drawString(java.lang.String text,
float x,
float y)
GraphicsdrawString in interface Graphicstext - The String to drawx - The x coordinate to draw aty - The y coordinate to draw atpublic void drawString(java.lang.String text,
float x,
float y,
float targetWidth)
GraphicsdrawString in interface Graphicstext - The String to drawx - The x coordinate to draw aty - The y coordinate to draw attargetWidth - The width to render the String at. Note: The string
will automatically wrapped if it is longer.public void drawString(java.lang.String text,
float x,
float y,
float targetWidth,
int horizontalAlign)
GraphicsdrawString in interface Graphicstext - The String to drawx - The x coordinate to draw aty - The y coordinate to draw attargetWidth - The width to render the String at. Note: The string
will automatically wrapped if it is longer.horizontalAlign - The horizontal alignmentpublic void drawTexture(Texture texture, float x, float y)
GraphicsdrawTexture in interface Graphicstexture - The Texture to drawx - The x coordinate to draw aty - The y coordinate to draw atpublic void drawTexture(Texture texture, float x, float y, boolean flipY)
GraphicsdrawTexture in interface Graphicstexture - The Texture to drawx - The x coordinate to draw aty - The y coordinate to draw atflipY - True if the texture should be flipped verticallypublic void drawTexture(Texture texture, float x, float y, float width, float height)
GraphicsdrawTexture in interface Graphicstexture - The Texture to drawx - The x coordinate to draw aty - The y coordinate to draw atwidth - The width to draw the texture (this can stretch/shrink the
texture if not matching the texture's width)height - The height to draw the texture (this can stretch/shrink the
texture if not matching the texture's height)public void drawTexture(Texture texture, float x, float y, float width, float height, boolean flipY)
drawTexture in interface Graphicstexture - The Texture to drawx - The x coordinate to draw aty - The y coordinate to draw atwidth - The width to draw the texture (this can stretch/shrink the
texture if not matching the texture's width)height - The height to draw the texture (this can stretch/shrink the
texture if not matching the texture's height)flipY - True if the texture should be flipped verticallypublic void drawTextureRegion(TextureRegion textureRegion, float x, float y)
GraphicsdrawTextureRegion in interface GraphicstextureRegion - The TextureRegion to drawx - The x coordinate to draw aty - The y coordinate to draw atpublic void drawTextureRegion(TextureRegion textureRegion, float x, float y, float width, float height)
GraphicsdrawTextureRegion in interface GraphicstextureRegion - The TextureRegion to drawx - The x coordinate to draw aty - The y coordinate to draw atwidth - The width to draw the region (this can stretch/shrink the
texture if not matching the region's width)height - The height to draw the region (this can stretch/shrink the
texture if not matching the region's height)public void drawTextureRegion(TextureRegion textureRegion, float x, float y, float width, float height, float rotation)
GraphicsdrawTextureRegion in interface GraphicstextureRegion - The TextureRegion to drawx - The x coordinate to draw aty - The y coordinate to draw atwidth - The width to draw the region (this can stretch/shrink the
texture if not matching the region's width)height - The height to draw the region (this can stretch/shrink the
texture if not matching the region's height)rotation - The rotation in degrees (rotated around the top-left corner of the region)public void drawShape(Shape shape)
GraphicsShapepublic void fillShape(Shape shape)
GraphicsShapepublic void drawSprite(Sprite sprite)
GraphicsSprite with all transformations applied to this graphics
contextdrawSprite in interface Graphicssprite - The Sprite to drawpublic void drawSprite(Sprite sprite, float x, float y)
GraphicsSprite at the given coordinates with all transformations
applied to this graphics contextdrawSprite in interface Graphicssprite - The Sprite to drawx - The x coordinate to render aty - The y coordinate to render atpublic void drawSpriteCache(SpriteCache spriteCache, int cacheId)
GraphicsSpriteCachedrawSpriteCache in interface GraphicsspriteCache - The SpriteCache to drawcacheId - The cacheId to drawpublic void drawParticleEffect(ParticleEffect effect)
GraphicsParticleEffect to screendrawParticleEffect in interface Graphicseffect - The effect to be drawnpublic void drawNinePatch(NinePatch ninePatch, float x, float y, float width, float height)
GraphicsNinePatch to screendrawNinePatch in interface GraphicsninePatch - The NinePatch to be drawnx - The x coordinate to draw aty - The y coordiante to draw atwidth - The width to apply to the NinePatchheight - The height to apply to the NinePatchpublic void drawTilingDrawable(TilingDrawable tilingDrawable, float x, float y, float width, float height)
GraphicsTilingDrawable to screendrawTilingDrawable in interface GraphicstilingDrawable - The TilingDrawable to be drawnx - The x coordinate to draw aty - The y coordinate to draw atwidth - The width to renderheight - The height to renderpublic void drawFontCache(GameFontCache fontCache)
GraphicsGameFontCache to the screendrawFontCache in interface GraphicsfontCache - The GameFontCache to renderpublic void setClip(float x,
float y,
float width,
float height)
Graphicspublic void setClip(Rectangle clip)
Graphicspublic Rectangle removeClip()
GraphicsremoveClip in interface Graphicspublic Rectangle peekClip()
GraphicspeekClip in interface GraphicsRectangle set to the clip coordinates. See Graphics.peekClip(Rectangle)public void peekClip(Rectangle rectangle)
Graphicspublic void setTint(Color tint)
GraphicsColor to apply to draw operationspublic void removeTint()
GraphicsColorremoveTint in interface Graphicspublic void enableBlending()
GraphicsenableBlending in interface Graphicspublic void disableBlending()
GraphicsdisableBlending in interface Graphicspublic void setShader(Shader shader)
GraphicsShader program to this instancepublic Shader getShader()
GraphicsShader programpublic void clearShader()
GraphicsShader program applied to this instanceclearShader in interface Graphicspublic void setBlendFunction(Mini2DxBlendFunction srcFunc, Mini2DxBlendFunction dstFunc)
GraphicssetBlendFunction in interface GraphicssrcFunc - Source GL functiondstFunc - Destination GL functionpublic void clearBlendFunction()
GraphicsclearBlendFunction in interface Graphicspublic void flush()
Graphicspublic void setFont(GameFont font)
GraphicsGameFont to draw Strings withpublic void setLineHeight(int lineHeight)
GraphicssetLineHeight in interface GraphicslineHeight - A value greater than 0public void setColor(Color color)
GraphicsColor to draw shapes withpublic void setBackgroundColor(Color backgroundColor)
GraphicsColor to be usedsetBackgroundColor in interface Graphicspublic void scale(float scaleX,
float scaleY)
Graphicspublic void setScale(float scaleX,
float scaleY)
Graphicspublic void clearScaling()
GraphicsclearScaling in interface Graphicspublic void translate(float translateX,
float translateY)
Graphicspublic void setTranslation(float translateX,
float translateY)
GraphicssetTranslation in interface GraphicstranslateX - The x axis translationtranslateY - The y axis translationpublic void rotate(float degrees,
float x,
float y)
Graphicspublic void setRotation(float degrees,
float x,
float y)
GraphicssetRotation in interface Graphicsdegrees - The degree value in a clockwise directionx - The x coordinate to rotate aroundy - The y coordinate to rotate aroundpublic org.mini2Dx.gdx.math.Matrix4 getProjectionMatrix()
GraphicsMatrix4 viewport projectiongetProjectionMatrix in interface Graphicspublic boolean isWindowReady()
GraphicsisWindowReady in interface Graphicspublic int getWindowWidth()
GraphicsgetWindowWidth in interface Graphicspublic int getWindowHeight()
GraphicsgetWindowHeight in interface Graphicspublic float getViewportWidth()
GraphicsgetViewportWidth in interface Graphicspublic float getViewportHeight()
GraphicsgetViewportHeight in interface Graphicspublic int getWindowSafeX()
GraphicsgetWindowSafeX in interface Graphicspublic int getWindowSafeY()
GraphicsgetWindowSafeY in interface Graphicspublic int getWindowSafeWidth()
GraphicsgetWindowSafeWidth in interface Graphicspublic int getWindowSafeHeight()
GraphicsgetWindowSafeHeight in interface Graphicspublic long getFrameId()
GraphicsgetFrameId in interface Graphicspublic TextureFilter getMinFilter()
GraphicsgetMinFilter in interface Graphicspublic void setMinFilter(TextureFilter filter)
GraphicssetMinFilter in interface Graphicsfilter - The min filter to be set.public TextureFilter getMagFilter()
GraphicsgetMagFilter in interface Graphicspublic void setMagFilter(TextureFilter filter)
GraphicssetMagFilter in interface Graphicsfilter - The mag filter to be set.public float getRotation()
GraphicsgetRotation in interface Graphicspublic float getRotationX()
GraphicsgetRotationX in interface Graphicspublic float getRotationY()
GraphicsgetRotationY in interface Graphicspublic float getTranslationX()
GraphicsgetTranslationX in interface Graphicspublic float getTranslationY()
GraphicsgetTranslationY in interface Graphicspublic float getScaleX()
Graphicspublic float getScaleY()
Graphicspublic Color getTint()
GraphicsColor tint being applied to all draw operationspublic Color getBackgroundColor()
GraphicsColorgetBackgroundColor in interface Graphicspublic Color getColor()
GraphicsColor to draw shapes withpublic int getLineHeight()
GraphicsgetLineHeight in interface Graphics