LVGL.Simulator.cpp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. /*
  2. * PROJECT: LVGL PC Simulator using Visual Studio
  3. * FILE: LVGL.Simulator.cpp
  4. * PURPOSE: Implementation for LVGL ported to Windows Desktop
  5. *
  6. * LICENSE: The MIT License
  7. *
  8. * DEVELOPER: Mouri_Naruto (Mouri_Naruto AT Outlook.com)
  9. */
  10. #include <Windows.h>
  11. #include "resource.h"
  12. #if _MSC_VER >= 1200
  13. // Disable compilation warnings.
  14. #pragma warning(push)
  15. // nonstandard extension used : bit field types other than int
  16. #pragma warning(disable:4214)
  17. // 'conversion' conversion from 'type1' to 'type2', possible loss of data
  18. #pragma warning(disable:4244)
  19. #endif
  20. #include "lvgl/lvgl.h"
  21. #include "lv_drivers/win32drv/win32drv.h"
  22. extern "C"{
  23. #include "pikascript_entry.h"
  24. }
  25. #if _MSC_VER >= 1200
  26. // Restore compilation warnings.
  27. #pragma warning(pop)
  28. #endif
  29. #include <stdio.h>
  30. int main()
  31. {
  32. lv_init();
  33. if (!lv_win32_init(
  34. GetModuleHandleW(NULL),
  35. SW_SHOW,
  36. 800,
  37. 480,
  38. LoadIconW(GetModuleHandleW(NULL), MAKEINTRESOURCE(IDI_LVGL))))
  39. {
  40. return -1;
  41. }
  42. lv_win32_add_all_input_devices_to_group(NULL);
  43. pikascript_entry();
  44. /*
  45. * Demos, benchmarks, and tests.
  46. *
  47. * Uncomment any one (and only one) of the functions below to run that
  48. * item.
  49. */
  50. // ----------------------------------
  51. // my freetype application
  52. // ----------------------------------
  53. ///*Init freetype library
  54. // *Cache max 64 faces and 1 size*/
  55. //lv_freetype_init(64, 1, 0);
  56. ///*Create a font*/
  57. //static lv_ft_info_t info;
  58. //info.name = "./lvgl/src/extra/libs/freetype/arial.ttf";
  59. //info.weight = 36;
  60. //info.style = FT_FONT_STYLE_NORMAL;
  61. //lv_ft_font_init(&info);
  62. ///*Create style with the new font*/
  63. //static lv_style_t style;
  64. //lv_style_init(&style);
  65. //lv_style_set_text_font(&style, info.font);
  66. ///*Create a label with the new style*/
  67. //lv_obj_t* label = lv_label_create(lv_scr_act());
  68. //lv_obj_add_style(label, &style, 0);
  69. //lv_label_set_text(label, "FreeType Arial Test");
  70. // ----------------------------------
  71. // my Win32 filesystem driver application
  72. // ----------------------------------
  73. /*::lv_fs_win32_init();
  74. lv_fs_dir_t d;
  75. if (lv_fs_dir_open(&d, "/") == LV_FS_RES_OK)
  76. {
  77. char b[MAX_PATH];
  78. memset(b, 0, MAX_PATH);
  79. while (lv_fs_dir_read(&d, b) == LV_FS_RES_OK)
  80. {
  81. printf("%s\n", b);
  82. }
  83. lv_fs_dir_close(&d);
  84. }*/
  85. // ----------------------------------
  86. // Demos from lv_examples
  87. // ----------------------------------
  88. // lv_demo_widgets(); // ok
  89. // lv_demo_benchmark();
  90. // lv_demo_keypad_encoder(); // ok
  91. // lv_demo_music(); // removed from repository
  92. // lv_demo_printer(); // removed from repository
  93. // lv_demo_stress(); // ok
  94. // ----------------------------------
  95. // LVGL examples
  96. // ----------------------------------
  97. /*
  98. * There are many examples of individual widgets found under the
  99. * lvgl\exampless directory. Here are a few sample test functions.
  100. * Look in that directory to find all the rest.
  101. */
  102. // lv_ex_get_started_1();
  103. // lv_ex_get_started_2();
  104. // lv_ex_get_started_3();
  105. // lv_example_flex_1();
  106. // lv_example_flex_2();
  107. // lv_example_flex_3();
  108. // lv_example_flex_4();
  109. // lv_example_flex_5();
  110. // lv_example_flex_6(); // ok
  111. // lv_example_grid_1();
  112. // lv_example_grid_2();
  113. // lv_example_grid_3();
  114. // lv_example_grid_4();
  115. // lv_example_grid_5();
  116. // lv_example_grid_6();
  117. // lv_port_disp_template();
  118. // lv_port_fs_template();
  119. // lv_port_indev_template();
  120. // lv_example_scroll_1();
  121. // lv_example_scroll_2();
  122. // lv_example_scroll_3();
  123. // lv_example_style_1();
  124. // lv_example_style_2();
  125. // lv_example_style_3();
  126. // lv_example_style_4(); // ok
  127. // lv_example_style_6(); // file has no source code
  128. // lv_example_style_7();
  129. // lv_example_style_8();
  130. // lv_example_style_9();
  131. // lv_example_style_10();
  132. // lv_example_style_11(); // ok
  133. // ----------------------------------
  134. // LVGL widgets examples
  135. // ----------------------------------
  136. // lv_example_arc_1();
  137. // lv_example_arc_2();
  138. // lv_example_bar_1(); // ok
  139. // lv_example_bar_2();
  140. // lv_example_bar_3();
  141. // lv_example_bar_4();
  142. // lv_example_bar_5();
  143. // lv_example_bar_6(); // issues
  144. // lv_example_btn_1();
  145. // lv_example_btn_2();
  146. // lv_example_btn_3();
  147. // lv_example_btnmatrix_1();
  148. // lv_example_btnmatrix_2();
  149. // lv_example_btnmatrix_3();
  150. // lv_example_calendar_1();
  151. // lv_example_canvas_1();
  152. // lv_example_canvas_2();
  153. // lv_example_chart_1(); // ok
  154. // lv_example_chart_2(); // ok
  155. // lv_example_chart_3(); // ok
  156. // lv_example_chart_4(); // ok
  157. // lv_example_chart_5(); // ok
  158. // lv_example_chart_6(); // ok
  159. // lv_example_checkbox_1();
  160. // lv_example_colorwheel_1(); // ok
  161. // lv_example_dropdown_1();
  162. // lv_example_dropdown_2();
  163. // lv_example_dropdown_3();
  164. // lv_example_img_1();
  165. // lv_example_img_2();
  166. // lv_example_img_3();
  167. // lv_example_img_4(); // ok
  168. // lv_example_imgbtn_1();
  169. // lv_example_keyboard_1(); // ok
  170. // lv_example_label_1();
  171. // lv_example_label_2(); // ok
  172. // lv_example_led_1();
  173. // lv_example_line_1();
  174. // lv_example_list_1();
  175. // lv_example_meter_1();
  176. // lv_example_meter_2();
  177. // lv_example_meter_3();
  178. // lv_example_meter_4(); // ok
  179. // lv_example_msgbox_1();
  180. // lv_example_obj_1(); // ok
  181. // lv_example_roller_1();
  182. // lv_example_roller_2(); // ok
  183. // lv_example_slider_1(); // ok
  184. // lv_example_slider_2(); // issues
  185. // lv_example_slider_3(); // issues
  186. // lv_example_spinbox_1();
  187. // lv_example_spinner_1(); // ok
  188. // lv_example_switch_1(); // ok
  189. // lv_example_table_1();
  190. // lv_example_table_2(); // ok
  191. // lv_example_tabview_1();
  192. // lv_example_textarea_1(); // ok
  193. // lv_example_textarea_2();
  194. // lv_example_textarea_3(); // ok, but not all button have functions
  195. // lv_example_tileview_1(); // ok
  196. // lv_example_win_1(); // ok
  197. // ----------------------------------
  198. // Task handler loop
  199. // ----------------------------------
  200. while (!lv_win32_quit_signal)
  201. {
  202. lv_task_handler();
  203. Sleep(1);
  204. }
  205. return 0;
  206. }