diff --git a/image/background.png b/image/background.png deleted file mode 100644 index 6f04f51..0000000 Binary files a/image/background.png and /dev/null differ diff --git a/main/main.cpp b/main/main.cpp index 5e23b47..97583c4 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1,19 +1,19 @@ -#pragma comment(lib, "fltk.lib") -#pragma comment(lib, "wsock32.lib") -#pragma comment(lib, "comctl32.lib") -#pragma comment(linker, "/NODEFAULTLIB:LIBCMTD.lib") - #include #include #include #include -#include +#include -#define window_size 400 + +#define window_height 600 +#define window_width 800 + /*****************************************************************************/ /* This class provides a view to copy the offscreen surface to */ + +int color_map[window_width][window_height]; class My_Window : public Fl_Window{ int x,y,button; int handle(int e) @@ -28,25 +28,42 @@ class My_Window : public Fl_Window{ return 1; case FL_KEYBOARD: button = Fl::event_button(); - std::cout<<"Keyboard:"<< button <(1), x(), y(), w(), h(), color); + } + +public: + Pixel(int x,int y,int w,int h,int RGB) : + Fl_Widget(x,y,w,h,0) { + this->color = fl_rgb_color((uchar)((RGB&0xff000000)>>24),(uchar)((RGB&0xff0000)>>16),(uchar)((RGB&0xff00)>>8)); + } +}; + int main(int argc, char **argv) { - - int x, y, button; - My_Window* window = new My_Window(window_size, window_size, "example"); - Fl_Box* box = new Fl_Box(10,10,380,380); - + for(int i=0;i<100;i++){ + for (int j = 0; j < 100 ; j++) { + color_map[i][j]=0xff000000; + } + } + My_Window* window = new My_Window(window_width, window_height, "example"); window->begin(); - Fl_PNG_Image* background = new Fl_PNG_Image("../image/background.png"); - std::cout<Fl_Image::fail()<image(background); - box->redraw(); + for(int i=0;i<100;i++){ + for (int j = 0; j < 100 ; j++) { + new Pixel(i,j,1,1,color_map[i][j]); + } + } window->end(); window->show(argc,argv); return Fl::run();