> I have one class "MainWindow" which is a subclass of "Window" class, and in it
> I've overloaded "draw()" method to draw some dots in window, but the
> following:
>
> ....
> #include <fltk/draw.h>
> ....
> void MainWindow::draw(void) {
> setcolor(3);
> for (int i = 0; i < someHeight; i += 2)
> for (int j = 0; j < someWidth; j += 2)
> drawpoint(j, i);
> Window::draw();
> }
>
> doesn't show anything in window. I suspect that "Window::draw();" draws over
> thise drawed dots, but anyhow, I need to call it so the window is shown
> properly.
>
> Can someone please tell me where am I wrong?
Seems like the mistake is simply that you should put Window::draw() before you
draw the points? like this:
#include <fltk/run.h>
#include <fltk/Window.h>
#include <fltk/SharedImage.h>
#include <fltk/Button.h>
#include <fltk/draw.h>
class MainWindow : public Window {
public:
MainWindow(int x,int y,int w,int h,const char *n):Window(x,y,w,h,n){}
void draw(void);
};//MainWindow
void MainWindow::draw(void) {
Window::draw();
setcolor(3);
int someHeight=30;
int someWidth=50;
for (int i = 0; i < someHeight; i += 2)
for (int j = 0; j < someWidth; j += 2)
drawpoint(j, i);
}
int main(void){
MainWindow w(0,0,400,400,"Window");
w.show();
return run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk