fltk_hello world

int main(int argc, char *argv[])

{

#define WINDOW_BG FL_BLACK

#define WINDOW_WIDTH 640

#define WINDOW_HEIGHT 480

#define BOX_WIDTH 100

#define BOX_HEIGHT 40

#define TEXT_COLOR FL_GREEN

#define TEXT_FONT FL_BOLD

#define TEXT_SIZE 40

// replace by xml ?



    const char* pszText = "Hello FLTK";

    int iW = 0;

    int iH = 0;



        

    Fl_Double_Window win(640, 480);

    win.color(FL_BLACK);



    fl_font(TEXT_FONT, TEXT_SIZE);

    fl_measure(pszText, iW, iH);



    Fl_Box* box = new Fl_Box(WINDOW_WIDTH/2 - iW/2, WINDOW_HEIGHT/2 - iH/2, iW, iH);

    box->box(FL_FLAT_BOX);

    box->color(TEXT_COLOR);

    box->labelfont(TEXT_FONT);

    box->labelsize(TEXT_SIZE);

    box->label(pszText);



    

    win.show();

    win.end();



    return Fl::run();

}

 

你可能感兴趣的:(Hello world)