diff --git a/examples/demo.cpp b/examples/demo.cpp index 546b868..dec37f7 100644 --- a/examples/demo.cpp +++ b/examples/demo.cpp @@ -21,11 +21,40 @@ #include "Window.hpp" #include "Widget.hpp" +#include + // ------------------------------------------------------ // use namespace using namespace DGL; +// taken from http://slabode.exofire.net/circle_draw.shtml +template +void drawCircle(const Point& fPos, const T& fSize, const int fNumSegments, const bool isOutline) +{ + // precalculate the sine and cosine + const float fTheta = 2.0f * 3.1415926f / float(fNumSegments); + const float fCos = std::cos(fTheta); + const float fSin = std::sin(fTheta); + + // paint + float t, x = fSize, y = 0; + + glBegin(isOutline ? GL_LINE_LOOP : GL_POLYGON); + + for (int i=0; i(Point(150, 200), 50, 300, false); + + glLineWidth(2.0f); + glColor3f(0.176f/4, 0.212f/4, 0.235f/4); + drawCircle(Point(150, 200), 50, 300, true); } void onReshape(int width, int height) override