// Program: demo2.cpp // Demo program for libwindow. #include #include int main() { // define a 300 x 300 pixel window ifm::Wstream w(300, 300, "LibWindow-Example"); // read in a circle std::cout << "Enter a circle." << std::endl; ifm::Circle c; w >> c; // print c and its bounding square w << ifm::yellow << c << ifm::red << ifm::Rectangle(c.x() - c.r(), c.y() - c.r(), c.x() + c.r(), c.y() + c.r()) << ifm::flush; // tracks mouse pointer std::cout << "Scribbling, click to end." << std::endl; ifm::Point p_last(c.x(), c.y()); do { int x, y; w.get_mouse(x, y); w << ifm::blue << ifm::Line(p_last.x(), p_last.y(), x, y) << ifm::flush; p_last = ifm::Point(x, y); } while (!w.check_mouse_click()); return 0; }