diff options
Diffstat (limited to 'src/render.cpp')
-rw-r--r-- | src/render.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/render.cpp b/src/render.cpp index 8d4949b..c3266ef 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -402,6 +402,39 @@ void state_t::render_line(v2f_t x0, v2f_t x1, sf::Color color) window->draw(line, 2, sf::Lines); } +void state_t::render_circle(v2f_t x, float r, sf::Color color) +{ + sf::CircleShape circle; + circle.setRadius(r); + circle.setPosition(x - v2f_t(r, r)); + circle.setFillColor(color); + window->draw(circle); +} + +void state_t::render_ring_sect(v2f_t x, float r0, float r1, float t0, float t1, + sf::Color color) +{ + sf::VertexArray array(sf::TriangleStrip); + float t; + bool done = false; + + for (t = t0; !done; t += 0.1f) { + v2f_t rad; + + if (t > t1) { + t = t1; + done = true; + } + + rad = v2f_t::rad(t); + array.append(sf::Vertex(x + rad * r0, color)); + array.append(sf::Vertex(x + rad * r1, color)); + } + + + window->draw(array); +} + void state_t::debug_path(v2f_t x, std::list<v2f_t> *path) { sf::Vertex line[2]; |