diff --git a/dpf b/dpf index 4c0161d..9e61837 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit 4c0161dab66c05d20d4629222c89e5a662fc09bd +Subproject commit 9e618371d7ac1f3d6984b0b96102d3bfe56c68d5 diff --git a/examples/demo.cpp b/examples/demo.cpp index 7dff95b..622614f 100644 --- a/examples/demo.cpp +++ b/examples/demo.cpp @@ -28,33 +28,6 @@ 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); + cir.draw(); glLineWidth(2.0f); glColor3f(0.176f/4, 0.212f/4, 0.235f/4); - drawCircle(Point(150, 200), 50, 300, true); + cir.drawOutline(); } void onReshape(int width, int height) override @@ -114,6 +87,9 @@ protected: // center triangle tri = Triangle(width*0.5, height*0.1, width*0.1, height*0.9, width*0.9, height*0.9); + // circle + cir = Circle(width/2, height*2/3, height/6, 300); + // make widget same size as window setSize(width, height); @@ -124,6 +100,7 @@ protected: private: Rectangle bgFull, bgSmall; Triangle tri; + Circle cir; }; // ------------------------------------------------------