1 Star 0 Fork 0

liangbinqiang/vscode_mingw_cmake

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.c 2.02 KB
一键复制 编辑 原始数据 按行查看 历史
#include <stdlib.h>
#include <unistd.h>
#include "GUI/lvgl/lvgl.h"
#include "GUI/lv_examples/src/lv_demo_widgets/lv_demo_widgets.h"
#include "GUI/lv_drivers/win32drv/win32drv.h"
#include <windows.h>
static void hal_init(void);
static int tick_thread(void *data);
HINSTANCE hInstance=NULL;
uint32_t button_click_num=0;
static void btn_event_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * btn = lv_event_get_target(e);
if(code == LV_EVENT_CLICKED) {
static uint8_t cnt = 0;
cnt++;
button_click_num++;
/*Get the first child of the button which is the label and change its text*/
lv_obj_t * label = lv_obj_get_child(btn, 0);
lv_label_set_text_fmt(label, "Button: %d", cnt);
}
}
/**
* Create a button with a label and react on click event.
*/
void lv_example_get_started99(void)
{
lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button the current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
lv_obj_set_size(btn, 120, 50); /*Set its size*/
lv_obj_set_style_bg_color(btn,lv_color_make(0xff, 0x67, 0x00),0);
lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/
lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/
lv_label_set_text(label, "Button"); /*Set the labels text*/
lv_obj_center(label);
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int nCmdShow)
{
//printf("hello vscode\r\n");
//HeadLightInit();
lv_init();
lv_win32_init(hInstance, SW_SHOWNORMAL, 800, 480, NULL);
lv_demo_widgets();
//lv_example_get_started99();
while(!lv_win32_quit_signal) {
/* Periodically call the lv_task handler.
* It could be done in a timer interrupt or an OS task too.*/
lv_task_handler();
usleep(10000); /*Just to let the system breath*/
}
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/liangbinqiang/vscode_mingw_cmake.git
git@gitee.com:liangbinqiang/vscode_mingw_cmake.git
liangbinqiang
vscode_mingw_cmake
vscode_mingw_cmake
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385