Skip to content

Commit

Permalink
Add drawCircle(Mat3 modelview, Rgba) overload
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Oct 4, 2024
1 parent 1c127e3 commit d4a40c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/jngl/shapes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@ void drawCircle(Mat3 modelview, const float radius) {
}

void drawCircle(Mat3 modelview, const float radius, const Rgba color) {
drawCircle(modelview.scale(radius), color);
}

void drawCircle(Mat3 modelview, const Rgba color) {
glBindVertexArray(opengl::vaoStream);
auto tmp =
useSimpleShaderProgram(modelview.scale(radius).scale(static_cast<float>(getScaleFactor()),
static_cast<float>(getScaleFactor())),
color);
auto tmp = useSimpleShaderProgram(
modelview.scale(static_cast<float>(getScaleFactor()), static_cast<float>(getScaleFactor())),
color);
// clang-format off
const static float vertexes[] = {
1.f, 0.f, 0.9951847f, 0.09801714f, 0.9807853f, 0.1950903f, 0.9569403f, 0.2902847f,
Expand Down
6 changes: 4 additions & 2 deletions src/jngl/shapes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ void pushAlpha(unsigned char alpha);
/// \deprecated Use setAlpha instead
void popAlpha();

[[deprecated("Use drawRectangle instead")]]
/// \deprecated Use drawRectangle instead
[[deprecated("Use drawRect instead")]]
/// \deprecated Use drawRect instead
void setLineWidth(float width);

/// Draws a line from start to end, the width can be set using setLineWidth
Expand Down Expand Up @@ -75,6 +75,8 @@ void drawCircle(Mat3 modelview, float radius);
/// Draws a circle at (0, 0) with \a radius in \a color
void drawCircle(Mat3 modelview, float radius, Rgba color);

/// Draws a circle at (0, 0) with radius of 1 in \a color
void drawCircle(Mat3 modelview, Rgba color);

[[deprecated("Use drawCircle instead")]]
/// \deprecated Use drawCircle instead
Expand Down

0 comments on commit d4a40c2

Please sign in to comment.