Cos'รจ fltk?

fltk permette di programmare un interfacia grafica con C++.

  1. sudo apt update
    sudo apt install autoconf
    fltk - intro
  2. cd /code/
    git clone https://github.com/fltk/fltk.git
    cd fltk
    make
    fltk - intro
  3. cd /code/
    mkdir fltk-demo
    cd fltk-demo
    vi hello.cxx
    #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Box.H> int main(int argc, char **argv) { Fl_Window *window = new Fl_Window(340, 180); Fl_Box *box = new Fl_Box(20, 40, 300, 100, "Hello, World!"); box->box(FL_UP_BOX); box->labelfont(FL_BOLD + FL_ITALIC); box->labelsize(36); box->labeltype(FL_SHADOW_LABEL); window->end(); window->show(argc, argv); return Fl::run(); } fltk - basics
  4. /code/fltk-config --compile hello.cxx
    Che genere questo :
    g++ -I../fltk -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -pthread -DUSE_SYSTEM_LIBDECOR=0 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -o hello hello.cxx -rdynamic ../fltk/lib/libfltk.a -pthread -lpthread -lm -lwayland-cursor -lwayland-client -lxkbcommon -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo -lX11 -ldl -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo -lXinerama -lXcursor -lXfixes -lXrender -lX11
    fltk - basics - Compiling Programs with the 'fltk-config' Script
  5. ./hello
    Il risultato :
    Imagine della finestra di fltk-demo

Altri esempi