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
FieldsModifier and TypeFieldDescription(package private) javafx.scene.image.ImageThe background image to be rendered, if it is not null(package private) javafx.scene.paint.ColorDefault background color(package private) javafx.scene.canvas.CanvasThe JavaFX canvas, on which images and other stuff are rendered(package private) javafx.scene.text.FontDefault font(package private) javafx.scene.canvas.GraphicsContextThe GraphicsContext is used to render images and image tiles to the screen(package private) javafx.scene.GroupThe JavaFX group, used for adding shapes(package private) javafx.scene.SceneThe Scene on which everything is rendered -
Constructor Summary
ConstructorsConstructorDescriptionRenderer(javafx.scene.Group group, javafx.scene.Scene scene, javafx.scene.canvas.Canvas canvas) Initializing the renderer -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all objects from the renderer queuevoiddrawCircle(Vector2 position, float radius, boolean isFilled, javafx.scene.paint.Paint paint) Drawing a circle of specified measurementsvoidDrawing a image of specified measurementsvoiddrawImageTile(ImageTile imageTile, Vector2 position, int tileX, int tileY) Drawing a image tile of specified measurementsvoidDrawing text of specified measurementsvoiddrawPolygon(double[] coords, boolean isFilled, javafx.scene.paint.Paint paint) Drawing text of specified measurementsvoiddrawRectangle(Vector2 position, float width, float height, boolean isFilled, javafx.scene.paint.Paint paint) Drawing a rectangle of specified measurementsvoiddrawText(String textContent, Vector2 position, javafx.scene.paint.Paint paint, javafx.scene.text.Font font) Drawing text of specified measurementsjavafx.scene.paint.ColorGets the background colorjavafx.scene.text.FontGets the default fontjavafx.scene.canvas.GraphicsContextGets the Graphics contextjavafx.geometry.Point2DGets the screen centervoidsetBackgroundColor(javafx.scene.paint.Color backgroundColor) Sets the Graphics contextvoidsetDefaultFont(javafx.scene.text.Font defaultFont) Sets the default fontvoidtransformContext(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
-