RTGUI第一个显示程序
新的GUI程序显示:贴代码#ifdef RT_USING_RTGUI
rtgui_system_server_init();
rtgui_startup();
#endif
void rtgui_startup(void)
{
rt_device_t device;
device = rt_device_find("lcd");
/* re-set graphic device */
rtgui_graphic_set_device(device);
bus_main_workbench_init();
rt_thread_delay(10);
}
void bus_main_workbench_init()
{
bus_main = rt_thread_create("bus_main",
bus_main_workbench_entry, RT_NULL,
4 * 1024, 25, 10);
rt_thread_startup(bus_main);
}
static void bus_main_workbench_entry(void* parameter)
{
struct rtgui_app *app;
struct rtgui_label *label;
struct rtgui_box *box;
struct rtgui_rect rect;
rect.x1 = 100;
rect.x2 = 800;
rect.y1 = 100;
rect.y2 = 380;
app = rtgui_app_create(rt_thread_self(), "MyAPP");
if (app == RT_NULL)
return;
rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect);
main_win = rtgui_win_create(RT_NULL, "demo_win", &rect,
RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE);
if (main_win == RT_NULL)
{
rtgui_app_destroy(app);
return;
}
label = rtgui_label_create("你好!");
RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_CENTER;
RTGUI_WIDGET_FOREGROUND(label) = RTGUI_RGB(64,224,208);
rtgui_container_add_child(RTGUI_CONTAINER(main_win), RTGUI_WIDGET(label));
rtgui_win_show(main_win, RT_FALSE);
/* 循环 */
rtgui_app_run(app);
rtgui_win_destroy(main_win);
rtgui_app_destroy(app);
}
第一个GUI程序如上,我想要的就是在屏上显示“你好!”但是程序运行之后,不但没有字体显示,连我设置的背景颜色也没有改变,请朋友帮忙指点一下 官网论坛上有RT-Thread GUI的教程,可以按照教材的步骤来。
http://www.rt-thread.org/phpBB3/viewforum.php?f=28
新版的RT-Thread GUI编程也变简单了,没有繁琐的workbench、view这些概念,完全窗口化方式。
感觉RT系列的文档还是不够全面啊,因为平常上班很忙,能花在看代码的时间不是很多,所以很多东西想只是通过阅读代码来理解还是比较有难度。一直纠结在ucosii+ucgui和rt-thread+rtgui上面...
页:
[1]