-
Notifications
You must be signed in to change notification settings - Fork 0
/
LVGL.Simulator.cpp
294 lines (233 loc) · 7.4 KB
/
LVGL.Simulator.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
/*
* 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 "lvgl/examples/lv_examples.h"
#include "lvgl/demos/lv_demos.h"
#include "lv_drivers/win32drv/win32drv.h"
#include "lvgl/demos/label/ui.h"
#include "lvgl/demos/label/ui_helpers.h"
#include "lvgl/study/02_pos-size-layout/02_layout.h"
#include "lvgl/study/03_style/03_style.h"
#include "lvgl/study/04_event/04_event.h"
#include "lvgl/study/05_label/05_label.h"
#include "lvgl/study/06_button/06_button.h"
#include "lvgl/study/07_group/07_group.h"
#include "lvgl/study/08_switch/08_switch.h"
#include "lvgl/study/09_checkbox/09_checkBox.h"
#include "lvgl/study/10_dropDown/10_dropDown.h"
#include "lvgl/study/11_roller/11_roller.h"
#include "lvgl/study/12_bar/12_bar.h"
#include "lvgl/study/13_slider/13_slider.h"
#include "lvgl/study/14_demo1/14_demo1.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);
/*
* 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
//ui_init();
//ui_init_02();
//ui_init_03();
//ui_init_04();
//ui_init_05();
//ui_init_06();
//ui_init_07();
//ui_init_08();
//ui_init_09();
//ui_init_10();
//ui_init_11();
//ui_init_12();
//ui_init_13();
ui_init_14();
// ----------------------------------
// 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;
}