How to make a shape outside of main()

Hi,

I know how to define a shape and attach it to a window as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <Simple_window.h>

void cir() { Circle c(Point(100,100),50); }

int main()
{
  Simple_window win(Point(100,100),600,400, "test");
  
  Rectangle r(Point(100,100),Point(300,200));
  win.attach(r);
  win.wait_for_botton();
}


But how to define a shape (say a circle by that cir() function which is) outside of the main() function? And how to attach it to be visible on window win?

PS: I have learned C++ just by PPP (http://books.google.com/books?id=We21AwAAQBAJ&lpg=PP1&dq=programming%20principle%20and%20practice&pg=PA519#v=onepage&q&f=true) book until end of chapter 14 :-)
Last edited on
Thank you.
This is a method of drawing circles (using fl_arc or fl_circle()) but if possible please suggest a way of using Circle (like the request of the question). :-)
but if possible please suggest a way of using Circle (like the request of the question). :-)

Create a Circle object that make relevant fltk draw call.
That answer is a kind of else question! Also (as I said) I want use of Circle not the FLTK facilities like fl_arc() and fl_circle().

But anyway, thanks for your answer.
Last edited on
Topic archived. No new replies allowed.