Steward
分享是一種喜悅、更是一種幸福
程式語言 - LVGL - SDL v2.0 - Hello, world!
參考資訊:
https://docs.lvgl.io/master/
https://github.com/lvgl/lvgl
https://docs.lvgl.io/master/details/integration/driver/sdl.html
main.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <lvgl.h> #include <SDL2/SDL.h> static lv_display_t *disp = NULL ; int main ( int argc, char *argv[]) { lv_init (); disp = lv_sdl_window_create (320, 240); lv_obj_t * label = lv_label_create ( lv_screen_active ()); lv_label_set_text ( label , "Hello, world!" ); lv_timer_handler (); SDL_Delay (3000); return 0; } |
編譯、執行
$ gcc main.c -o main -I/usr/local/include/lvgl/src -llvgl -lSDL2 $ ./main