c++imagedrawfltk

How to draw a little square with a pic on it with fltk


i wanna create a board with little squares , and put a picture on every square , how can I do it using fltk on c++ ?


Solution

  • The recommended method to draw a box with an image in FLTK is to use an Fl_Box widget and assign an image to it which will be used as its label, like:

    Fl_Box b(0, 0, 100, 100);
    b.image(my_image);
    

    Of course, my_image needs to be a valid image like Fl_Image, Fl_PNG_Image etc.