| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- /*
- * PROJECT: LVGL PC Simulator using Visual Studio
- * FILE: LVGL.Simulator.cpp
- * PURPOSE: Implementation for LVGL ported to Windows Desktop
- *
- * LICENSE: The MIT License
- *
- * DEVELOPER: Mouri_Naruto (Mouri_Naruto AT Outlook.com)
- */
- #include <Windows.h>
- #include "resource.h"
- #if _MSC_VER >= 1200
- // Disable compilation warnings.
- #pragma warning(push)
- // nonstandard extension used : bit field types other than int
- #pragma warning(disable:4214)
- // 'conversion' conversion from 'type1' to 'type2', possible loss of data
- #pragma warning(disable:4244)
- #endif
- #include "lvgl/lvgl.h"
- #include "lv_drivers/win32drv/win32drv.h"
- extern "C"{
- #include "pikascript_entry.h"
- }
- #if _MSC_VER >= 1200
- // Restore compilation warnings.
- #pragma warning(pop)
- #endif
- #include <stdio.h>
- int main()
- {
- lv_init();
- if (!lv_win32_init(
- GetModuleHandleW(NULL),
- SW_SHOW,
- 800,
- 480,
- LoadIconW(GetModuleHandleW(NULL), MAKEINTRESOURCE(IDI_LVGL))))
- {
- return -1;
- }
- lv_win32_add_all_input_devices_to_group(NULL);
- pikascript_entry();
- /*
- * Demos, benchmarks, and tests.
- *
- * Uncomment any one (and only one) of the functions below to run that
- * item.
- */
- // ----------------------------------
- // my freetype application
- // ----------------------------------
- ///*Init freetype library
- // *Cache max 64 faces and 1 size*/
- //lv_freetype_init(64, 1, 0);
- ///*Create a font*/
- //static lv_ft_info_t info;
- //info.name = "./lvgl/src/extra/libs/freetype/arial.ttf";
- //info.weight = 36;
- //info.style = FT_FONT_STYLE_NORMAL;
- //lv_ft_font_init(&info);
- ///*Create style with the new font*/
- //static lv_style_t style;
- //lv_style_init(&style);
- //lv_style_set_text_font(&style, info.font);
- ///*Create a label with the new style*/
- //lv_obj_t* label = lv_label_create(lv_scr_act());
- //lv_obj_add_style(label, &style, 0);
- //lv_label_set_text(label, "FreeType Arial Test");
- // ----------------------------------
- // my Win32 filesystem driver application
- // ----------------------------------
- /*::lv_fs_win32_init();
- lv_fs_dir_t d;
- if (lv_fs_dir_open(&d, "/") == LV_FS_RES_OK)
- {
- char b[MAX_PATH];
- memset(b, 0, MAX_PATH);
- while (lv_fs_dir_read(&d, b) == LV_FS_RES_OK)
- {
- printf("%s\n", b);
- }
- lv_fs_dir_close(&d);
- }*/
- // ----------------------------------
- // Demos from lv_examples
- // ----------------------------------
- // lv_demo_widgets(); // ok
- // lv_demo_benchmark();
- // lv_demo_keypad_encoder(); // ok
- // lv_demo_music(); // removed from repository
- // lv_demo_printer(); // removed from repository
- // lv_demo_stress(); // ok
- // ----------------------------------
- // LVGL examples
- // ----------------------------------
- /*
- * There are many examples of individual widgets found under the
- * lvgl\exampless directory. Here are a few sample test functions.
- * Look in that directory to find all the rest.
- */
- // lv_ex_get_started_1();
- // lv_ex_get_started_2();
- // lv_ex_get_started_3();
- // lv_example_flex_1();
- // lv_example_flex_2();
- // lv_example_flex_3();
- // lv_example_flex_4();
- // lv_example_flex_5();
- // lv_example_flex_6(); // ok
- // lv_example_grid_1();
- // lv_example_grid_2();
- // lv_example_grid_3();
- // lv_example_grid_4();
- // lv_example_grid_5();
- // lv_example_grid_6();
- // lv_port_disp_template();
- // lv_port_fs_template();
- // lv_port_indev_template();
- // lv_example_scroll_1();
- // lv_example_scroll_2();
- // lv_example_scroll_3();
- // lv_example_style_1();
- // lv_example_style_2();
- // lv_example_style_3();
- // lv_example_style_4(); // ok
- // lv_example_style_6(); // file has no source code
- // lv_example_style_7();
- // lv_example_style_8();
- // lv_example_style_9();
- // lv_example_style_10();
- // lv_example_style_11(); // ok
- // ----------------------------------
- // LVGL widgets examples
- // ----------------------------------
- // lv_example_arc_1();
- // lv_example_arc_2();
- // lv_example_bar_1(); // ok
- // lv_example_bar_2();
- // lv_example_bar_3();
- // lv_example_bar_4();
- // lv_example_bar_5();
- // lv_example_bar_6(); // issues
- // lv_example_btn_1();
- // lv_example_btn_2();
- // lv_example_btn_3();
- // lv_example_btnmatrix_1();
- // lv_example_btnmatrix_2();
- // lv_example_btnmatrix_3();
- // lv_example_calendar_1();
- // lv_example_canvas_1();
- // lv_example_canvas_2();
- // lv_example_chart_1(); // ok
- // lv_example_chart_2(); // ok
- // lv_example_chart_3(); // ok
- // lv_example_chart_4(); // ok
- // lv_example_chart_5(); // ok
- // lv_example_chart_6(); // ok
- // lv_example_checkbox_1();
- // lv_example_colorwheel_1(); // ok
- // lv_example_dropdown_1();
- // lv_example_dropdown_2();
- // lv_example_dropdown_3();
- // lv_example_img_1();
- // lv_example_img_2();
- // lv_example_img_3();
- // lv_example_img_4(); // ok
- // lv_example_imgbtn_1();
- // lv_example_keyboard_1(); // ok
- // lv_example_label_1();
- // lv_example_label_2(); // ok
- // lv_example_led_1();
- // lv_example_line_1();
- // lv_example_list_1();
- // lv_example_meter_1();
- // lv_example_meter_2();
- // lv_example_meter_3();
- // lv_example_meter_4(); // ok
- // lv_example_msgbox_1();
- // lv_example_obj_1(); // ok
- // lv_example_roller_1();
- // lv_example_roller_2(); // ok
- // lv_example_slider_1(); // ok
- // lv_example_slider_2(); // issues
- // lv_example_slider_3(); // issues
- // lv_example_spinbox_1();
- // lv_example_spinner_1(); // ok
- // lv_example_switch_1(); // ok
- // lv_example_table_1();
- // lv_example_table_2(); // ok
- // lv_example_tabview_1();
- // lv_example_textarea_1(); // ok
- // lv_example_textarea_2();
- // lv_example_textarea_3(); // ok, but not all button have functions
- // lv_example_tileview_1(); // ok
- // lv_example_win_1(); // ok
- // ----------------------------------
- // Task handler loop
- // ----------------------------------
- while (!lv_win32_quit_signal)
- {
- lv_task_handler();
- Sleep(1);
- }
- return 0;
- }
|