Josh's Graphics Library
|
Drawing functions for primitive 2D Shapes. More...
Functions | |
void | Begin (RenderTarget *render_target=nullptr, bool clear_buffers=false) |
Open a 2-D rendering context with the underlying graphics system (In this case& by default OpenGL). More... | |
void | End () |
Closes a 2-D rendering context with the underlying graphics system (In this case& by default OpenGL). More... | |
void | LightArray (Light *, size_t size) |
Provide a list of lights to be used in 2D space. More... | |
void | LightArray (std::vector< Light > lights) |
void | DrawPoint (const Color4 &color, const Vector2 &coordinates, float radius=1.f) |
Plots a single pixel on the screen. More... | |
void | DrawPoint (const Color4 &color, float x, float y, float radius=1.f) |
void | DrawPoints (const Color4 &color, const Vector2 *points, int num_points, float radius=1.f) |
Plots a series of pixel-points on the screen, in a batch. More... | |
void | DrawLine (const Color4 &color, const Vector2 &A, const Vector2 &B, float thickness=1) |
Plots a line (segment) on the screen. More... | |
void | DrawLine (const Color4 &color, float x1, float y1, float x2, float y2, float thickness=1) |
void | DrawGradientLine (const Color4 &color_a, const Color4 &color_b, const Vector2 &A, const Vector2 &B, float thickness=1) |
Draws a line with a color gradient that transitions across it. More... | |
void | DrawGradientLine (const Color4 &color_a, const Color4 &color_b, float x, float y, float w, float h, float thickness=1) |
void | OutlineRect (const Color4 &color, const Vector2 &pos, const Vector2 &size, float thickness=1) |
Draws an outline of a rectangle on the screen. More... | |
void | OutlineRoundedRect (const Color4 &color, const Vector2 &pos, const Vector2 &size, float radius=5, float thickness=1) |
Draws an outline of a rectangle with rounded corners onto the screen. More... | |
void | OutlineChamferRect (const Color4 &color, const Vector2 &pos, const Vector2 &size, float radius=5, float thickness=1) |
Draws an outline of a rectangle with chamfered corners onto the screen. More... | |
void | FillRect (const Color4 &color, const Vector2 &pos, const Vector2 &size) |
Draws a filled rectangle on the screen. More... | |
void | FillGradientRect (const Color4 &color1, const Color4 &color2, const Direction &gradient, const Vector2 &pos, const Vector2 &size) |
Draws a filled rectangle where the color transitions across it. More... | |
void | FillRoundedRect (const Color4 &color, const Vector2 &pos, const Vector2 &size, float radius=5, unsigned int subdivisions=8) |
Draws a filled rectangle with rounded corners on the screen. More... | |
void | FillChamferRect (const Color4 &color, const Vector2 &pos, const Vector2 &size, float radius=5) |
Draws a filled rectangle with chamfered (beveled) corners on the screen. More... | |
void | DrawRenderTarget (const RenderTarget &render_target, const Vector2 &position, float rad_rotation=0, const Vector2 &origin=Vector2(0, 0), const Vector2 &scale=Vector2(1, 1), const Color4 &color=Colors::White, Direction inversion=Direction::None) |
Draws a render-target (runtime-modifiable texture) to the screen. More... | |
void | DrawRenderTarget (const RenderTarget *render_target, const Vector2 &position, float rad_rotation=0, const Vector2 &origin=Vector2(0, 0), const Vector2 &scale=Vector2(1, 1), const Color4 &color=Colors::White, Direction inversion=Direction::None) |
void | DrawSprite (const RenderTarget &render_target, const Vector2 &position, float rad_rotation=0, const Vector2 &origin=Vector2(0, 0), const Vector2 &scale=Vector2(1, 1), const Color4 &color=Colors::White, Direction inversion=Direction::None) |
Draws a sprite (technically, actually a render target) to the screen. More... | |
void | DrawSprite (const RenderTarget *render_target, const Vector2 &position, float rad_rotation=0, const Vector2 &origin=Vector2(0, 0), const Vector2 &scale=Vector2(1, 1), const Color4 &color=Colors::White, Direction inversion=Direction::None) |
void | DrawSprite (const Texture &texture, const Vector2 &position, float rad_rotation=0, const Vector2 &origin=Vector2(0, 0), const Vector2 &scale=Vector2(1, 1), const Color4 &color=Colors::White, Direction inversion=Direction::None) |
Draws a sprite to the screen by passing a G̶L̶u̶i̶n̶t̶ JGL Texture that represents a handle to a loaded texture. More... | |
void | DrawSprite (const Texture *texture, const Vector2 &position, float rad_rotation=0, const Vector2 &origin=Vector2(0, 0), const Vector2 &scale=Vector2(1, 1), const Color4 &color=Colors::White, Direction inversion=Direction::None) |
void | DrawSprite (const Texture &texture, float positionX, float positionY, float rad_rotation=0, float originX=0, float originY=0, float scaleX=1, float scaleY=1, const Color4 &color=Colors::White, Direction inversion=Direction::None) |
void | DrawSprite (const Texture *texture, float positionX, float positionY, float rad_rotation=0, float originX=0, float originY=0, float scaleX=1, float scaleY=1, const Color4 &color=Colors::White, Direction inversion=Direction::None) |
void | DrawPartialSprite (const Texture &texture, const Vector2 &position, const Vector2 &sub_texture_position, const Vector2 &sub_texture_size, float rad_rotation=0, const Vector2 &origin=Vector2(0, 0), const Vector2 &scale=Vector2(1, 1), const Color4 &color=Colors::White, Direction inversion=Direction::None) |
Draws a piece of a sprite to the screen, similar to DrawSprite. More... | |
void | DrawPartialSprite (const Texture *texture, const Vector2 &position, const Vector2 &sub_texture_position, const Vector2 &sub_texture_size, float rad_rotation=0, const Vector2 &origin=Vector2(0, 0), const Vector2 &scale=Vector2(1, 1), const Color4 &color=Colors::White, Direction inversion=Direction::None) |
void | DrawPartialSprite (const Texture &texture, float positionX, float positionY, float sub_texture_positionX, float sub_texture_positionY, unsigned int sub_texture_sizeX, unsigned int sub_texture_sizeY, float rad_rotation=0, float originX=0, float originY=0, float scaleX=1, float scaleY=1, const Color4 &color=Colors::White, Direction inversion=Direction::None) |
void | DrawPartialSprite (const Texture *texture, float positionX, float positionY, float sub_texture_positionX, float sub_texture_positionY, unsigned int sub_texture_sizeX, unsigned int sub_texture_sizeY, float rad_rotation=0, float originX=0, float originY=0, float scaleX=1, float scaleY=1, const Color4 &color=Colors::White, Direction inversion=Direction::None) |
void | DrawMirrorSprite (const Texture &texture, const Vector2 &position, Direction mirror_axis=Direction::Horizontal|Direction::Vertical, float rad_rotation=0, const Vector2 &origin=Vector2(0, 0), const Vector2 &scale=Vector2(1, 1), const Color4 &color=Colors::White) |
To save v-ram, Use if a sprite would be identical if mirrored horizontally, vertically, or both. More... | |
void | DrawMirrorSprite (const Texture *texture, const Vector2 &position, Direction mirror_axis=Direction::Horizontal|Direction::Vertical, float rad_rotation=0, const Vector2 &origin=Vector2(0, 0), const Vector2 &scale=Vector2(1, 1), const Color4 &color=Colors::White) |
void | OutlineCircle (const Color4 &color, const Vector2 ¢er, float radius, unsigned int subdivisions=16, float thickness=1) |
Draws an outline of a circle on the screen. More... | |
void | FillCircle (const Color4 &color, const Vector2 ¢er, float radius, unsigned int subdivisions=8) |
Draws a filled circle on the screen. More... | |
void | OutlineTriangle (const Color4 &color, const Triangle2D &tri, float thickness=1) |
Draws an outline of a triangle on the screen. More... | |
void | OutlineTriangle (const Color4 &color, const Vector2 &triA, const Vector2 &triB, const Vector2 &triC, float thickness=1) |
void | FillTriangle (const Color4 &color, const Triangle2D &tri) |
Draws a filled triangle on the screen. More... | |
void | FIllTriangle (const Color4 &color, const Vector2 &triA, const Vector2 &triB, const Vector2 &triC) |
void | FillGradientTriangle (const Color4 &a_color, const Color4 &b_color, const Color4 &c_color, const Triangle2D &tri) |
Fills a triangle defined by the provided vertices with a gradient that transitions smoothly between the three specified colors at each corner. More... | |
void | FillGradientTriangle (const Color4 &a_color, const Color4 &b_color, const Color4 &c_color, const Vector2 &tri_a, const Vector2 &tri_b, const Vector2 &tri_c) |
void | DrawCubicBezierCurve (const Color4 &color, const Vector2 &controlA, const Vector2 &pointA, const Vector2 &pointB, const Vector2 &controlB, int subdivisions=10, float thickness=1) |
Draws a smooth, curved line segment between two control points, with the curve controlled by the two inner points. More... | |
void | OutlinePolygon (const Color4 &color, const Vector2 *points, int points_size, float thickness=1) |
Draws a series of points where the last point always connects to the first point. More... | |
void | DrawString (const Color4 &color, const std::string &text, float x, float y, float scale, u32 size, const Font &font) |
Draws a text string on the screen with a given point-size and font. More... | |
void | DrawArc (const Color4 &color, const Vector2 ¢er, float radius, float arc_begin, float arc_end, unsigned int subdivisions, float thickness) |
Draws an Arc (section of a circle) to the screen. More... | |
void | FillPolygon (const Color4 &color, const std::vector< Vector2 > &points) |
TODO Implement the following. These ones are going to be extremely annoying. More... | |
void | OutlineEllipse (const Color4 &color, const Vector2 &position, float radius_x, float radius_y, float thickness=1, int subdivisions=8) |
void | FillEllipse (const Color4 &color, const Vector2 &position, float radius_x, float radius_y, int subdivisions=8) |
Drawing functions for primitive 2D Shapes.
void JGL::J2D::Begin | ( | RenderTarget * | render_target = nullptr , |
bool | clear_buffers = false |
||
) |
Open a 2-D rendering context with the underlying graphics system (In this case& by default OpenGL).
render_target | |
clear_buffers |
void JGL::J2D::DrawArc | ( | const Color4 & | color, |
const Vector2 & | center, | ||
float | radius, | ||
float | arc_begin, | ||
float | arc_end, | ||
unsigned int | subdivisions, | ||
float | thickness | ||
) |
Draws an Arc (section of a circle) to the screen.
color | A 3-or-4 channel color value. |
center | The point in cartesian space at which to draw the arc. This will by-definition be the centroid of this partial circle. |
radius | The radius of the partial circle to be drawn. AKA Half the diameter. |
arc_begin | The point (0 - 2pi) around a unit-circle of which to start the arc. |
arc_end | The point (0 - 2pi) around a unit-circle of which to start the arc. |
subdivisions | The accuracy of the approximation of the circle, measured in iteration steps taken. |
thickness | The line-width to draw the arc with. |
void JGL::J2D::DrawCubicBezierCurve | ( | const Color4 & | color, |
const Vector2 & | controlA, | ||
const Vector2 & | pointA, | ||
const Vector2 & | pointB, | ||
const Vector2 & | controlB, | ||
int | subdivisions = 10 , |
||
float | thickness = 1 |
||
) |
Draws a smooth, curved line segment between two control points, with the curve controlled by the two inner points.
color | A 3-or-4 channel color value. |
controlA | The first control point, which can be considered the start of the line. |
pointA | The first inner point, which controls the contour of the curve. |
pointB | The second inner point, which controls the contour of the curve. |
controlB | The second control point, which can be considered the end of the line. |
subdivisions | The accuracy of the approximation of the curve, measured in iteration steps taken. |
thickness | The line-width to draw the curve with. |
void JGL::J2D::DrawGradientLine | ( | const Color4 & | color_a, |
const Color4 & | color_b, | ||
const Vector2 & | A, | ||
const Vector2 & | B, | ||
float | thickness = 1 |
||
) |
Draws a line with a color gradient that transitions across it.
color_a | A 3-or-4 channel color value. |
color_b | A 3-or-4 channel color value. |
A | The starting point of the line segment. |
B | The end point of the line segment. |
thickness | The width at which to render the line. |
void JGL::J2D::DrawGradientLine | ( | const Color4 & | color_a, |
const Color4 & | color_b, | ||
float | x, | ||
float | y, | ||
float | w, | ||
float | h, | ||
float | thickness = 1 |
||
) |
void JGL::J2D::DrawLine | ( | const Color4 & | color, |
const Vector2 & | A, | ||
const Vector2 & | B, | ||
float | thickness = 1 |
||
) |
Plots a line (segment) on the screen.
color | A 3-or-4 channel color value. |
A | The starting point of the line segment. |
B | The end point of the line segment. |
thickness | The width at which to render the line. |
void JGL::J2D::DrawLine | ( | const Color4 & | color, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2, | ||
float | thickness = 1 |
||
) |
void JGL::J2D::DrawMirrorSprite | ( | const Texture & | texture, |
const Vector2 & | position, | ||
Direction | mirror_axis = Direction::Horizontal | Direction::Vertical , |
||
float | rad_rotation = 0 , |
||
const Vector2 & | origin = Vector2(0,0) , |
||
const Vector2 & | scale = Vector2(1,1) , |
||
const Color4 & | color = Colors::White |
||
) |
To save v-ram, Use if a sprite would be identical if mirrored horizontally, vertically, or both.
For example, a circle. Assumes the input texture is the top left quadrant. You can use "SoftwareTexture" to invert it correctly so that's the case.
texture | A texture instance to be displayed. |
position | The point at which to draw the sprite (from the top-left down). |
mirror_axis | The axes to mirror across, Vertical and Horizontal or both only. |
rad_rotation | The rotation of the final result. |
origin | The point at which transformations are done about. |
scale | The scale transformation for the image. X and Y axis are independently-scalable. |
color | A 3-or-4 channel color value. |
void JGL::J2D::DrawMirrorSprite | ( | const Texture * | texture, |
const Vector2 & | position, | ||
Direction | mirror_axis = Direction::Horizontal | Direction::Vertical , |
||
float | rad_rotation = 0 , |
||
const Vector2 & | origin = Vector2(0,0) , |
||
const Vector2 & | scale = Vector2(1,1) , |
||
const Color4 & | color = Colors::White |
||
) |
void JGL::J2D::DrawPartialSprite | ( | const Texture & | texture, |
const Vector2 & | position, | ||
const Vector2 & | sub_texture_position, | ||
const Vector2 & | sub_texture_size, | ||
float | rad_rotation = 0 , |
||
const Vector2 & | origin = Vector2(0,0) , |
||
const Vector2 & | scale = Vector2(1, 1) , |
||
const Color4 & | color = Colors::White , |
||
Direction | inversion = Direction::None |
||
) |
Draws a piece of a sprite to the screen, similar to DrawSprite.
texture | A texture instance to be displayed. |
position | The point at which to draw the sprite (from the top-left down). |
sub_texture_position | The top left corner of the sub-texture to be drawn. |
sub_texture_size | The size of the sub-texture in px. |
origin | The center point around which the image should have all transformations applied to it. |
scale | The scale transformation for the image. X and Y axis are independently-scalable. |
color | A 3-or-4 channel color value. |
inversion |
void JGL::J2D::DrawPartialSprite | ( | const Texture & | texture, |
float | positionX, | ||
float | positionY, | ||
float | sub_texture_positionX, | ||
float | sub_texture_positionY, | ||
unsigned int | sub_texture_sizeX, | ||
unsigned int | sub_texture_sizeY, | ||
float | rad_rotation = 0 , |
||
float | originX = 0 , |
||
float | originY = 0 , |
||
float | scaleX = 1 , |
||
float | scaleY = 1 , |
||
const Color4 & | color = Colors::White , |
||
JGL::Direction | inversion = Direction::None |
||
) |
void JGL::J2D::DrawPartialSprite | ( | const Texture * | texture, |
const Vector2 & | position, | ||
const Vector2 & | sub_texture_position, | ||
const Vector2 & | sub_texture_size, | ||
float | rad_rotation = 0 , |
||
const Vector2 & | origin = Vector2(0,0) , |
||
const Vector2 & | scale = Vector2(1, 1) , |
||
const Color4 & | color = Colors::White , |
||
Direction | inversion = Direction::None |
||
) |
void JGL::J2D::DrawPartialSprite | ( | const Texture * | texture, |
float | positionX, | ||
float | positionY, | ||
float | sub_texture_positionX, | ||
float | sub_texture_positionY, | ||
unsigned int | sub_texture_sizeX, | ||
unsigned int | sub_texture_sizeY, | ||
float | rad_rotation = 0 , |
||
float | originX = 0 , |
||
float | originY = 0 , |
||
float | scaleX = 1 , |
||
float | scaleY = 1 , |
||
const Color4 & | color = Colors::White , |
||
Direction | inversion = Direction::None |
||
) |
void JGL::J2D::DrawPoint | ( | const Color4 & | color, |
const Vector2 & | coordinates, | ||
float | radius = 1.f |
||
) |
Plots a single pixel on the screen.
color | A 3-or-4 channel color value. |
coordinates | The pixel-point on-screen at which to plot the pixel. |
radius | The size of the point to plot. By default, a single pixel. |
void JGL::J2D::DrawPoint | ( | const Color4 & | color, |
float | x, | ||
float | y, | ||
float | radius = 1.f |
||
) |
void JGL::J2D::DrawPoints | ( | const Color4 & | color, |
const Vector2 * | points, | ||
int | num_points, | ||
float | radius = 1.f |
||
) |
Plots a series of pixel-points on the screen, in a batch.
color | A 3-or-4 channel color value. |
points | A set of x,y points to render. |
radius | The size of the point to plot. By default, a single pixel. |
void JGL::J2D::DrawRenderTarget | ( | const RenderTarget & | render_target, |
const Vector2 & | position, | ||
float | rad_rotation = 0 , |
||
const Vector2 & | origin = Vector2(0 , 0) , |
||
const Vector2 & | scale = Vector2(1, 1) , |
||
const Color4 & | color = Colors::White , |
||
Direction | inversion = Direction::None |
||
) |
Draws a render-target (runtime-modifiable texture) to the screen.
render_target | A RenderTarget instance to be displayed. |
position | The position at which to render this object from it's center-point, defined by the origin parameter. |
rad_rotation | The amount of radians to rotate this render-target about it's center-point. |
origin | The center-point in the image to use for rendering, rotation, and scaling. Top-left is {0,0} and bottom right is {1, 1}. |
scale | The amount (in both x, and y axis) to scale the image, with {1,1} being default scaling. |
color | A 3-or-4 channel color value. |
inversion |
void JGL::J2D::DrawRenderTarget | ( | const RenderTarget * | render_target, |
const Vector2 & | position, | ||
float | rad_rotation = 0 , |
||
const Vector2 & | origin = Vector2(0 , 0) , |
||
const Vector2 & | scale = Vector2(1, 1) , |
||
const Color4 & | color = Colors::White , |
||
Direction | inversion = Direction::None |
||
) |
void JGL::J2D::DrawSprite | ( | const RenderTarget & | render_target, |
const Vector2 & | position, | ||
float | rad_rotation = 0 , |
||
const Vector2 & | origin = Vector2(0 , 0) , |
||
const Vector2 & | scale = Vector2(1, 1) , |
||
const Color4 & | color = Colors::White , |
||
Direction | inversion = Direction::None |
||
) |
Draws a sprite (technically, actually a render target) to the screen.
render_target | A RenderTarget instance to be displayed. |
position | The position at which to render this object from it's center-point, defined by the origin parameter. |
rad_rotation | The amount of radians to rotate this render-target about it's center-point. |
origin | The center-point in the image to use for rendering, rotation, and scaling. Top-left is {0,0} and bottom right is {1, 1}. |
scale | The amount (in both x, and y axis) to scale the image, with {1,1} being default scaling. |
color | A 3-or-4 channel color value. |
inversion |
void JGL::J2D::DrawSprite | ( | const RenderTarget * | render_target, |
const Vector2 & | position, | ||
float | rad_rotation = 0 , |
||
const Vector2 & | origin = Vector2(0 , 0) , |
||
const Vector2 & | scale = Vector2(1, 1) , |
||
const Color4 & | color = Colors::White , |
||
Direction | inversion = Direction::None |
||
) |
void JGL::J2D::DrawSprite | ( | const Texture & | texture, |
const Vector2 & | position, | ||
float | rad_rotation = 0 , |
||
const Vector2 & | origin = Vector2(0,0) , |
||
const Vector2 & | scale = Vector2(1,1) , |
||
const Color4 & | color = Colors::White , |
||
Direction | inversion = Direction::None |
||
) |
Draws a sprite to the screen by passing a G̶L̶u̶i̶n̶t̶ JGL Texture that represents a handle to a loaded texture.
texture | A texture instance to be displayed. |
position | The point at which to draw the sprite (from the top-left down). |
origin | The center point around which the image should have all transformations applied to it. |
scale | The scale transformation for the image. X and Y axis are independently-scalable. |
rad_rotation | A float representing the rotation of the sprite where 0 is no rotation and 1 is the maximum rotation (would look the same as 0). |
color | A 3-or-4 channel color value. |
inversion |
void JGL::J2D::DrawSprite | ( | const Texture & | texture, |
float | positionX, | ||
float | positionY, | ||
float | rad_rotation = 0 , |
||
float | originX = 0 , |
||
float | originY = 0 , |
||
float | scaleX = 1 , |
||
float | scaleY = 1 , |
||
const Color4 & | color = Colors::White , |
||
Direction | inversion = Direction::None |
||
) |
void JGL::J2D::DrawSprite | ( | const Texture * | texture, |
const Vector2 & | position, | ||
float | rad_rotation = 0 , |
||
const Vector2 & | origin = Vector2(0,0) , |
||
const Vector2 & | scale = Vector2(1,1) , |
||
const Color4 & | color = Colors::White , |
||
Direction | inversion = Direction::None |
||
) |
void JGL::J2D::DrawSprite | ( | const Texture * | texture, |
float | positionX, | ||
float | positionY, | ||
float | rad_rotation = 0 , |
||
float | originX = 0 , |
||
float | originY = 0 , |
||
float | scaleX = 1 , |
||
float | scaleY = 1 , |
||
const Color4 & | color = Colors::White , |
||
Direction | inversion = Direction::None |
||
) |
void JGL::J2D::DrawString | ( | const Color4 & | color, |
const std::string & | text, | ||
float | x, | ||
float | y, | ||
float | scale, | ||
u32 | size, | ||
const Font & | font | ||
) |
Draws a text string on the screen with a given point-size and font.
color | A 3-or-4 channel color value. |
text | The text to be rendered. |
x | The position on the screen at which to draw the text, from the top-left. |
y | The position on the screen at which to draw the text, from the top-left. |
scale | The value (in both axes) to scale the text by. Defaults to {1,1}. |
size | The point-size at which to render the font out. Re-using the same point-size allows efficient glyph caching. |
font | The font to use for rendering. |
void JGL::J2D::End | ( | ) |
Closes a 2-D rendering context with the underlying graphics system (In this case& by default OpenGL).
void JGL::J2D::FillChamferRect | ( | const Color4 & | color, |
const Vector2 & | pos, | ||
const Vector2 & | size, | ||
float | radius = 5 |
||
) |
Draws a filled rectangle with chamfered (beveled) corners on the screen.
color | A 3-or-4 channel color value. |
pos | The top-left corner of the rectangle. |
size | The width and height of the rectangle. |
radius | The corner-rounding radius (in radians). |
void JGL::J2D::FillCircle | ( | const Color4 & | color, |
const Vector2 & | center, | ||
float | radius, | ||
unsigned int | subdivisions = 8 |
||
) |
Draws a filled circle on the screen.
color | A 3-or-4 channel color value. |
center | The point in cartesian space at which to draw the circle. This will by-definition be the centroid of this circle. |
radius | The radius of the circle to be drawn. AKA Half the diameter. |
subdivisions | The accuracy of the approximation of the circle, measured in iteration steps taken. |
void JGL::J2D::FillEllipse | ( | const Color4 & | color, |
const Vector2 & | position, | ||
float | radius_x, | ||
float | radius_y, | ||
int | subdivisions = 8 |
||
) |
void JGL::J2D::FillGradientRect | ( | const Color4 & | color1, |
const Color4 & | color2, | ||
const Direction & | gradient, | ||
const Vector2 & | pos, | ||
const Vector2 & | size | ||
) |
Draws a filled rectangle where the color transitions across it.
color1 | A 3-or-4 channel color value. |
color2 | A 3-or-4 channel color value. |
gradient | See enum Direction |
pos | The top-left corner of the rectangle. |
size | The width and height of the rectangle. |
void JGL::J2D::FillGradientTriangle | ( | const Color4 & | a_color, |
const Color4 & | b_color, | ||
const Color4 & | c_color, | ||
const Triangle2D & | tri | ||
) |
Fills a triangle defined by the provided vertices with a gradient that transitions smoothly between the three specified colors at each corner.
a_color | The color at vertex A of the triangle. |
b_color | The color at vertex B of the triangle. |
c_color | The color at vertex C of the triangle. |
tri | The triangle defined by its vertices (A, B, and C). |
void JGL::J2D::FillGradientTriangle | ( | const Color4 & | a_color, |
const Color4 & | b_color, | ||
const Color4 & | c_color, | ||
const Vector2 & | tri_a, | ||
const Vector2 & | tri_b, | ||
const Vector2 & | tri_c | ||
) |
void JGL::J2D::FillPolygon | ( | const Color4 & | color, |
const std::vector< Vector2 > & | points | ||
) |
TODO Implement the following. These ones are going to be extremely annoying.
void JGL::J2D::FillRect | ( | const Color4 & | color, |
const Vector2 & | pos, | ||
const Vector2 & | size | ||
) |
Draws a filled rectangle on the screen.
color | A 3-or-4 channel color value. |
pos | The top-left corner of the rectangle. |
size | The width and height of the rectangle. |
void JGL::J2D::FillRoundedRect | ( | const Color4 & | color, |
const Vector2 & | pos, | ||
const Vector2 & | size, | ||
float | radius = 5 , |
||
unsigned int | subdivisions = 8 |
||
) |
Draws a filled rectangle with rounded corners on the screen.
color | A 3-or-4 channel color value. |
pos | The top-left corner of the rectangle. |
size | The width and height of the rectangle. |
radius | The corner-rounding radius (in radians). |
subdivisions | The amount of sub-divisions (and calculations) to be performed per-arc rounding corner. |
void JGL::J2D::FillTriangle | ( | const Color4 & | color, |
const Triangle2D & | tri | ||
) |
Draws a filled triangle on the screen.
color | A 3-or-4 channel color value. |
tri | The triangle defined by its vertices (A, B, and C). |
void JGL::J2D::FIllTriangle | ( | const Color4 & | color, |
const Vector2 & | triA, | ||
const Vector2 & | triB, | ||
const Vector2 & | triC | ||
) |
void JGL::J2D::LightArray | ( | Light * | , |
size_t | size | ||
) |
Provide a list of lights to be used in 2D space.
Typically directly after J2D::Begin(); 8 lights maximum for now. Some kind of light sorting will eventually be needed per j2d element.
void JGL::J2D::LightArray | ( | std::vector< Light > | lights | ) |
void JGL::J2D::OutlineChamferRect | ( | const Color4 & | color, |
const Vector2 & | pos, | ||
const Vector2 & | size, | ||
float | radius = 5 , |
||
float | thickness = 1 |
||
) |
Draws an outline of a rectangle with chamfered corners onto the screen.
color | A 3-or-4 channel color value. |
pos | The top-left corner of the rectangle. |
size | The width and height of the rectangle. |
radius | The corner-rounding radius (in radians). |
thickness | The width at which to render the lines. |
void JGL::J2D::OutlineCircle | ( | const Color4 & | color, |
const Vector2 & | center, | ||
float | radius, | ||
unsigned int | subdivisions = 16 , |
||
float | thickness = 1 |
||
) |
Draws an outline of a circle on the screen.
color | A 3-or-4 channel color value. |
center | The point in cartesian space at which to draw the circle. This will by-definition be the centroid of this circle. |
radius | The radius of the circle to be drawn. AKA Half the diameter. |
subdivisions | The accuracy of the approximation of the circle, measured in iteration steps taken. |
thickness | The line-width of the circle to be rendered at. |
void JGL::J2D::OutlineEllipse | ( | const Color4 & | color, |
const Vector2 & | position, | ||
float | radius_x, | ||
float | radius_y, | ||
float | thickness = 1 , |
||
int | subdivisions = 8 |
||
) |
void JGL::J2D::OutlinePolygon | ( | const Color4 & | color, |
const Vector2 * | points, | ||
int | points_size, | ||
float | thickness = 1 |
||
) |
Draws a series of points where the last point always connects to the first point.
color | A 3-or-4 channel color value. |
points | The array of vector2's to draw as a polygon. |
points_size | The length of the array of vector2's. |
thickness | The line-width of the polygon |
void JGL::J2D::OutlineRect | ( | const Color4 & | color, |
const Vector2 & | pos, | ||
const Vector2 & | size, | ||
float | thickness = 1 |
||
) |
Draws an outline of a rectangle on the screen.
color | A 3-or-4 channel color value. |
pos | The top-left corner of the rectangle. |
size | The width and height of the rectangle. |
thickness | The width at which to render the lines. |
void JGL::J2D::OutlineRoundedRect | ( | const Color4 & | color, |
const Vector2 & | pos, | ||
const Vector2 & | size, | ||
float | radius = 5 , |
||
float | thickness = 1 |
||
) |
Draws an outline of a rectangle with rounded corners onto the screen.
color | A 3-or-4 channel color value. |
pos | The top-left corner of the rectangle. |
size | The width and height of the rectangle. |
radius | The corner-rounding radius (in radians). |
thickness | The width at which to render the lines. |
void JGL::J2D::OutlineTriangle | ( | const Color4 & | color, |
const Triangle2D & | tri, | ||
float | thickness = 1 |
||
) |
Draws an outline of a triangle on the screen.
color | A 3-or-4 channel color value. |
tri | The triangle defined by its vertices (A, B, and C). |
thickness | The line-width of the triangle to be rendered at. |
void JGL::J2D::OutlineTriangle | ( | const Color4 & | color, |
const Vector2 & | triA, | ||
const Vector2 & | triB, | ||
const Vector2 & | triC, | ||
float | thickness = 1 |
||
) |