#include using namespace std; #include "canvas.h" #include "dice.h" // illustrate MKAdapter, make a circle where mouse is clicked class MakeCircle : public MKAdapter // stateless, make a circle where clicked { public: MakeCircle() { } void processClick(const Point& p, AnimatedCanvas& ac) // post: circle of random radius created at mouse click point // center labeled withcoordinates { Dice d(6); CircleShape circ(p,d.Roll()*5, CanvasColor::MAGENTA); ac.addShape(circ); TextShape label(p,p.tostring(),CanvasColor::BLACK); ac.addShape(label); } }; int main() { AnimatedCanvas ac(200,200,20,20); MakeCircle mc; ac.addShape(mc); ac.runUntilEscape(10); return 0; }