2019-10-26 16:39:25 +02:00
|
|
|
#pragma comment(lib, "fltk.lib")
|
|
|
|
#pragma comment(lib, "wsock32.lib")
|
|
|
|
#pragma comment(lib, "comctl32.lib")
|
|
|
|
#pragma comment(linker, "/NODEFAULTLIB:LIBCMTD.lib")
|
2019-10-16 16:52:36 +02:00
|
|
|
|
2019-10-23 13:32:13 +02:00
|
|
|
|
2019-10-26 16:39:25 +02:00
|
|
|
#include <iostream>
|
|
|
|
#include <Fl/Fl.H>
|
|
|
|
#include <FL/Fl_Box.H>
|
|
|
|
#include <FL/Fl_Window.H>
|
|
|
|
#include <FL/Fl_PNG_Image.H>
|
2019-10-23 13:32:13 +02:00
|
|
|
|
|
|
|
|
2019-10-26 16:39:25 +02:00
|
|
|
#define window_size 400
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* This class provides a view to copy the offscreen surface to */
|
|
|
|
class My_Window : public Fl_Window{
|
|
|
|
int x,y,button;
|
|
|
|
int handle(int e)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (e)
|
|
|
|
{
|
|
|
|
case FL_MOVE:
|
|
|
|
x = Fl::event_x();
|
|
|
|
y = Fl::event_y();
|
|
|
|
std::cout<<"Postion X:"<< x <<" Postion Y:"<< y <<std::endl;
|
|
|
|
return 1;
|
|
|
|
case FL_KEYBOARD:
|
|
|
|
button = Fl::event_button();
|
|
|
|
std::cout<<"Keyboard:"<< button <<std::endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public:
|
|
|
|
My_Window(int x, int y, const char *l ) : Fl_Window(x,y,l){};
|
|
|
|
};
|
2019-10-23 13:32:13 +02:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2019-10-26 16:39:25 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
window->begin();
|
|
|
|
Fl_PNG_Image* background = new Fl_PNG_Image("../image/background.png");
|
|
|
|
std::cout<<background->Fl_Image::fail()<<std::endl;
|
|
|
|
box->image(background);
|
|
|
|
box->redraw();
|
|
|
|
window->end();
|
|
|
|
window->show(argc,argv);
|
|
|
|
return Fl::run();
|
|
|
|
} // main
|