java.lang.Object
dev.aurumbyte.sypherengine.core.graphics.Renderer
The renderer/graphics backend, containing all the rendering helper methods
- Since:
- v0.3.0
- Author:
- AurumByte
-
Field Summary
Modifier and TypeFieldDescription(package private) javafx.scene.image.Image
The background image to be rendered, if it is not null(package private) javafx.scene.paint.Color
Default background color(package private) javafx.scene.canvas.Canvas
The JavaFX canvas, on which images and other stuff are rendered(package private) javafx.scene.text.Font
Default font(package private) javafx.scene.canvas.GraphicsContext
The GraphicsContext is used to render images and image tiles to the screen(package private) javafx.scene.Group
The JavaFX group, used for adding shapes(package private) javafx.scene.Scene
The Scene on which everything is rendered -
Constructor Summary
ConstructorDescriptionRenderer
(javafx.scene.Group group, javafx.scene.Scene scene, javafx.scene.canvas.Canvas canvas) Initializing the renderer -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears all objects from the renderer queuevoid
drawCircle
(Vector2 position, float radius, boolean isFilled, javafx.scene.paint.Paint paint) Drawing a circle of specified measurementsvoid
Drawing a image of specified measurementsvoid
drawImageTile
(ImageTile imageTile, Vector2 position, int tileX, int tileY) Drawing a image tile of specified measurementsvoid
Drawing text of specified measurementsvoid
drawPolygon
(double[] coords, boolean isFilled, javafx.scene.paint.Paint paint) Drawing text of specified measurementsvoid
drawRectangle
(Vector2 position, float width, float height, boolean isFilled, javafx.scene.paint.Paint paint) Drawing a rectangle of specified measurementsvoid
drawText
(String textContent, Vector2 position, javafx.scene.paint.Paint paint, javafx.scene.text.Font font) Drawing text of specified measurementsjavafx.scene.paint.Color
Gets the background colorjavafx.scene.text.Font
Gets the default fontjavafx.scene.canvas.GraphicsContext
Gets the Graphics contextjavafx.geometry.Point2D
Gets the screen centervoid
setBackgroundColor
(javafx.scene.paint.Color backgroundColor) Sets the Graphics contextvoid
setDefaultFont
(javafx.scene.text.Font defaultFont) Sets the default fontvoid
transformContext
(Entity entity) Transforms on an entity(image)
-
Field Details
-
group
javafx.scene.Group groupThe JavaFX group, used for adding shapes -
scene
javafx.scene.Scene sceneThe Scene on which everything is rendered -
canvas
javafx.scene.canvas.Canvas canvasThe JavaFX canvas, on which images and other stuff are rendered -
graphicsContext
javafx.scene.canvas.GraphicsContext graphicsContextThe GraphicsContext is used to render images and image tiles to the screen -
background
javafx.scene.image.Image backgroundThe background image to be rendered, if it is not null -
backgroundColor
javafx.scene.paint.Color backgroundColorDefault background color -
defaultFont
javafx.scene.text.Font defaultFontDefault font
-
-
Constructor Details
-
Renderer
public Renderer(javafx.scene.Group group, javafx.scene.Scene scene, javafx.scene.canvas.Canvas canvas) Initializing the renderer
- Parameters:
group
- The groupscene
- The scenecanvas
- The canvas- Since:
- 0.3.0
-
-
Method Details
-
clear
public void clear()Clears all objects from the renderer queue
- Since:
- 0.3.0
-
transformContext
Transforms on an entity(image)
- Since:
- 0.3.0
-
drawRectangle
public void drawRectangle(Vector2 position, float width, float height, boolean isFilled, javafx.scene.paint.Paint paint) Drawing a rectangle of specified measurements
- Parameters:
position
- The position of the rectanglewidth
- The width of the rectangleheight
- The height of the rectangleisFilled
- Specify whether the rectangle should be filled in or notpaint
- The Color or gradient to be filled in- Since:
- 0.3.0
-
drawCircle
public void drawCircle(Vector2 position, float radius, boolean isFilled, javafx.scene.paint.Paint paint) Drawing a circle of specified measurements
- Parameters:
position
- The position of the circleradius
- The radius of the circleisFilled
- Specify whether the circle should be filled in or notpaint
- The Color or gradient to be filled in- Since:
- 0.3.0
-
drawImage
Drawing a image of specified measurements
- Parameters:
image
- The image to be renderedposition
- The position of the imagewidth
- The width of the imageheight
- The height of the image- Since:
- 0.3.0
-
drawImageTile
Drawing a image tile of specified measurements
- Parameters:
imageTile
- The image tile to be renderedposition
- The position of the imagetileX
- The tile count from left to right, starting from 0tileY
- The tile count from the top to bottom, starting from 0- Since:
- 0.3.0
-
drawText
public void drawText(String textContent, Vector2 position, javafx.scene.paint.Paint paint, javafx.scene.text.Font font) Drawing text of specified measurements
- Parameters:
position
- The position of the texttextContent
- The text to be renderedfont
- The font of the textpaint
- The Color or gradient to be filled in- Since:
- 0.3.0
-
drawLine
Drawing text of specified measurements
- Parameters:
start
- The start position of the lineend
- The end position of the linepaint
- The Color or gradient to be filled in- Since:
- 0.3.0
-
drawPolygon
public void drawPolygon(double[] coords, boolean isFilled, javafx.scene.paint.Paint paint) Drawing text of specified measurements
- Parameters:
coords
- the coordinates of the polygon verticesisFilled
- Specify whether the polygon should be filled or notpaint
- The color or gradient to be filled in- Since:
- 0.3.0
-
getGraphicsContext
public javafx.scene.canvas.GraphicsContext getGraphicsContext()Gets the Graphics context -
getBackgroundColor
public javafx.scene.paint.Color getBackgroundColor()Gets the background color -
setBackgroundColor
public void setBackgroundColor(javafx.scene.paint.Color backgroundColor) Sets the Graphics context -
getDefaultFont
public javafx.scene.text.Font getDefaultFont()Gets the default font -
setDefaultFont
public void setDefaultFont(javafx.scene.text.Font defaultFont) Sets the default font -
getScreenCenter
public javafx.geometry.Point2D getScreenCenter()Gets the screen center
-