Package dev.prozilla.pine.core.rendering
Class Renderer
java.lang.Object
dev.prozilla.pine.core.rendering.Renderer
- All Implemented Interfaces:
Destructible,Initializable
Handles the rendering process.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbegin()Begin rendering.voidclear()Clears the drawing area.voiddestroy()Disposes renderer and cleans up its used data.voiddrawDebugText(CharSequence text, float x, float y) Draw debug text at the specified position.voiddrawDebugText(CharSequence text, float x, float y, Color c) Draw debug text at the specified position and color.voiddrawRect(float x, float y, float z, float width, float height) Draws a white rectangle at the given position.voidDraws a colored rectangle at the given position.voiddrawRotatedTexture(TextureBase texture, float x, float y, float z, float r) voiddrawRotatedTexture(TextureBase texture, float x, float y, float z, Color c, float r) voiddrawRotatedTextureRegion(TextureBase texture, float x, float y, float z, float regX, float regY, float regWidth, float regHeight, float r) voiddrawRotatedTextureRegion(TextureBase texture, float x1, float y1, float x2, float y2, float z, float s1, float t1, float s2, float t2, float r) voiddrawRotatedTextureRegion(TextureBase texture, float x1, float y1, float x2, float y2, float z, float s1, float t1, float s2, float t2, Color c, float r) voiddrawRotatedTextureRegion(TextureBase texture, float x, float y, float z, float regX, float regY, float regWidth, float regHeight, Color c, float r) voiddrawText(Font font, CharSequence text, float x, float y, float z) Draw text at the specified position.voiddrawText(Font font, CharSequence text, float x, float y, float z, Color c) Draw text at the specified position and color.voiddrawText(CharSequence text, float x, float y, float z) voiddrawText(CharSequence text, float x, float y, float z, Color c) voiddrawTexture(TextureBase texture, float x, float y, float z) Draws a texture on specified coordinates.voiddrawTexture(TextureBase texture, float x, float y, float z, Color c) Draws a texture on specified coordinates and with specified color.voiddrawTextureRegion(TextureBase texture, float x, float y, float z, float regX, float regY, float regWidth, float regHeight) Draws a texture region on specified coordinates.voiddrawTextureRegion(TextureBase texture, float x1, float y1, float x2, float y2, float z, float s1, float t1, float s2, float t2) Draws a texture region on specified coordinates.voiddrawTextureRegion(TextureBase texture, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float z, float s1, float t1, float s2, float t2, Color c) Draws a texture region on specified coordinates.voiddrawTextureRegion(TextureBase texture, float x1, float y1, float x2, float y2, float z, float s1, float t1, float s2, float t2, Color c) Draws a texture region on specified coordinates.voiddrawTextureRegion(TextureBase texture, float x, float y, float z, float regX, float regY, float regWidth, float regHeight, Color c) Draws a texture region on specified coordinates.voidend()End rendering.voidflush()Flushes the data to the GPU to let it get rendered.intCalculates total height of a debug text.intCalculates total width of a debug text.intintgetTextHeight(Font font, CharSequence text) Calculates total height of a text.intgetTextHeight(CharSequence text) getTextSize(Font font, CharSequence text) getTextSize(CharSequence text) intgetTextWidth(Font font, CharSequence text) Calculates total width of a text.intgetTextWidth(CharSequence text) Creates a newVector2fthat represents the center of the viewport.intgetWidth()voidinit()Initializes this object to prepare its usage.voidinitPreview(int width, int height) booleanDeprecated.booleanbooleanoutOfBounds(float x, float y) Checks if coordinates are outside the screen bounds.booleanoutOfBounds(float x1, float y1, float x2, float y2) Checks if a line is outside the screen bounds.booleanoutOfBounds(float x1, float y1, float x2, float y2, float x3, float y3) booleanoutOfBounds(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) Checks if a quad is outside the screen bounds.voidvoidvoidvoidvoidresize()Updates the projection matrix according to the window's dimensions.voidsetMirrorHorizontally(boolean mirrorHorizontally) voidsetMirrorVertically(boolean mirrorVertically) voidsetRegion(float x, float y, float width, float height) Limits the rendering to the given region.voidsetRegion(int x, int y, int width, int height) Limits the rendering to the given region.voidsetScale(float scale) void
-
Constructor Details
-
Renderer
-
-
Method Details
-
init
public void init()Description copied from interface:InitializableInitializes this object to prepare its usage.- Specified by:
initin interfaceInitializable
-
initPreview
public void initPreview(int width, int height) -
clear
public void clear()Clears the drawing area. -
begin
Begin rendering.- Throws:
IllegalStateException
-
end
End rendering.- Throws:
IllegalStateException
-
flush
public void flush()Flushes the data to the GPU to let it get rendered. -
resetTransform
public void resetTransform() -
resetScale
public void resetScale() -
setScale
public void setScale(float scale) -
setScale
-
setMirrorHorizontally
public void setMirrorHorizontally(boolean mirrorHorizontally) -
setMirrorVertically
public void setMirrorVertically(boolean mirrorVertically) -
resetMirror
public void resetMirror() -
setRegion
public void setRegion(float x, float y, float width, float height) Limits the rendering to the given region. -
setRegion
public void setRegion(int x, int y, int width, int height) Limits the rendering to the given region. -
resetRegion
public void resetRegion() -
getDebugTextWidth
Calculates total width of a debug text.- Parameters:
text- The text- Returns:
- Total width of the text
-
getDebugTextHeight
Calculates total height of a debug text.- Parameters:
text- The text- Returns:
- Total width of the text
-
drawDebugText
Draw debug text at the specified position.- Parameters:
text- TextRenderer to drawx- X coordinate of the text positiony- Y coordinate of the text position
-
drawDebugText
Draw debug text at the specified position and color.- Parameters:
text- TextRenderer to drawx- X coordinate of the text positiony- Y coordinate of the text positionc- Color to use
-
getTextSize
-
getTextSize
-
getTextWidth
-
getTextWidth
Calculates total width of a text.- Parameters:
text- The text- Returns:
- Total width of the text
-
getTextHeight
-
getTextHeight
Calculates total height of a text.- Parameters:
text- The text- Returns:
- Total width of the text
-
drawText
-
drawText
Draw text at the specified position.- Parameters:
text- TextRenderer to drawx- X coordinate of the text positiony- Y coordinate of the text position
-
drawText
-
drawText
Draw text at the specified position and color.- Parameters:
text- TextRenderer to drawx- X coordinate of the text positiony- Y coordinate of the text positionc- Color to use
-
drawRect
public void drawRect(float x, float y, float z, float width, float height) Draws a white rectangle at the given position.- Parameters:
x- X positiony- Y positionwidth- Width of the rectangleheight- Height of the rectangle
-
drawRect
Draws a colored rectangle at the given position.- Parameters:
x- X positiony- Y positionwidth- Width of the rectangleheight- Height of the rectanglec- Color
-
drawRotatedTexture
-
drawRotatedTexture
-
drawTexture
Draws a texture on specified coordinates.- Parameters:
texture- Used for getting width and height of the texturex- X position of the texturey- Y position of the texture
-
drawTexture
Draws a texture on specified coordinates and with specified color.- Parameters:
texture- Used for getting width and height of the texturex- X position of the texturey- Y position of the texturec- The color to use
-
drawRotatedTextureRegion
public void drawRotatedTextureRegion(TextureBase texture, float x, float y, float z, float regX, float regY, float regWidth, float regHeight, float r) -
drawRotatedTextureRegion
public void drawRotatedTextureRegion(TextureBase texture, float x, float y, float z, float regX, float regY, float regWidth, float regHeight, Color c, float r) -
drawRotatedTextureRegion
public void drawRotatedTextureRegion(TextureBase texture, float x1, float y1, float x2, float y2, float z, float s1, float t1, float s2, float t2, float r) -
drawRotatedTextureRegion
public void drawRotatedTextureRegion(TextureBase texture, float x1, float y1, float x2, float y2, float z, float s1, float t1, float s2, float t2, Color c, float r) -
drawTextureRegion
public void drawTextureRegion(TextureBase texture, float x, float y, float z, float regX, float regY, float regWidth, float regHeight) Draws a texture region on specified coordinates.- Parameters:
texture- Used for getting width and height of the texturex- X position of the texturey- Y position of the textureregX- X position of the texture regionregY- Y position of the texture regionregWidth- Width of the texture regionregHeight- Height of the texture region
-
drawTextureRegion
public void drawTextureRegion(TextureBase texture, float x, float y, float z, float regX, float regY, float regWidth, float regHeight, Color c) Draws a texture region on specified coordinates.- Parameters:
texture- Used for getting width and height of the texturex- X position of the texturey- Y position of the textureregX- X position of the texture regionregY- Y position of the texture regionregWidth- Width of the texture regionregHeight- Height of the texture regionc- The color to use
-
drawTextureRegion
public void drawTextureRegion(TextureBase texture, float x1, float y1, float x2, float y2, float z, float s1, float t1, float s2, float t2) Draws a texture region on specified coordinates.- Parameters:
x1- Bottom left x positiony1- Bottom left y positionx2- Top right x positiony2- Top right y positions1- Bottom left s coordinatet1- Bottom left t coordinates2- Top right s coordinatet2- Top right t coordinate
-
drawTextureRegion
public void drawTextureRegion(TextureBase texture, float x1, float y1, float x2, float y2, float z, float s1, float t1, float s2, float t2, Color c) Draws a texture region on specified coordinates.- Parameters:
x1- Bottom left x positiony1- Bottom left y positionx2- Top right x positiony2- Top right y positions1- Bottom left s coordinatet1- Bottom left t coordinates2- Top right s coordinatet2- Top right t coordinatec- The color to use
-
drawTextureRegion
public void drawTextureRegion(TextureBase texture, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float z, float s1, float t1, float s2, float t2, Color c) Draws a texture region on specified coordinates. -
outOfBounds
public boolean outOfBounds(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) Checks if a quad is outside the screen bounds. -
outOfBounds
public boolean outOfBounds(float x1, float y1, float x2, float y2, float x3, float y3) -
outOfBounds
public boolean outOfBounds(float x1, float y1, float x2, float y2) Checks if a line is outside the screen bounds. -
outOfBounds
public boolean outOfBounds(float x, float y) Checks if coordinates are outside the screen bounds.- Parameters:
x- X positiony- Y position- Returns:
- True if the coordinate is outside of bounds
-
destroy
public void destroy()Disposes renderer and cleans up its used data.- Specified by:
destroyin interfaceDestructible
-
resize
public void resize()Updates the projection matrix according to the window's dimensions. -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
isDrawing
Deprecated.Replaced byisRenderingas of 2.1.0 -
isRendering
public boolean isRendering() -
getFrameBufferObject
-
getConfig
-
getFallbackColor
-
getViewportCenter
Creates a newVector2fthat represents the center of the viewport.
-
isRenderingas of 2.1.0