samedi 19 août 2017

This is about FLTK c++ Lib rary and its draw functiom

#include<FL/Fl.H>
#include<FL/Fl_Window.H>
#include<FL/fl_draw.H>
#include<string>
#include<vector>
using namespace std;
class window:Fl_Window{
 public:
    window(int left,int top,int width,int height,string `enter code here`title):Fl_Window(left,top,width,height,title.c_str()){

    color(FL_BLACK);

    show();
    }
    void draw()
    {
        draw_box(FL_UP_BOX,0,0,100,100,FL_RED);
    }


};
int main()
{
    window *wd = new window(Fl::w()/2,0,Fl::w()/2,Fl::h()/2,"title1");



    return Fl::run();



}

When I run this code the box is drawn automatically why is that?I am new to C++ and this got to do something with function overriding but I am not understanding it

Aucun commentaire:

Enregistrer un commentaire