轉自 | 嵌入式大雜燴
GT-HMI
GT-HMI(Human Machine Interface) 國產開源 GUI 框架及永久免費設計軟件。
開源許可協(xié)議:MIT
它提供創(chuàng)建具有易于使用的圖形元素,精美的視覺效果和低內存占用的嵌入式 GUI 所需的一切。針對國內市場及用戶需求,使用習慣進行了優(yōu)化設計,為國內工程師量身打造!
產品由中國高通 GENITOP 傾心打造,繼承了中國高通 30 年的漢顯技術及漢字技術積累。產品分為上位機 GT-HMI Designer 和下位機 GT-HMI Engine。
GT HMI Designer是一款功能強大的嵌入式人機界面設計軟件。它提供直觀的可視化設計界面,支持多種常用控件和豐富的交互功能。此外,它還支持多國語言界面設計和強大的仿真功能。通過GT HMI Designer,可以輕松設計出美觀、交互性強的界面,滿足各種應用場景的需求。
GT HMI Engine是一款功能強大、高性能、多平臺、多語言、穩(wěn)定可靠的嵌入式人機界面引擎,提供豐富的控件和強大的交互功能。
特性
上位機設計軟件 GT-HMI Designer 永久免費,下位機技術框架 GT-HMI Engine 開源,使用無拘束;
GT-HMI Designer 內嵌下位機技術框架編譯器,可自動生成下位機代碼;
提供 GT-HMI 模塊,已適配 GT-HMI 上下位機軟件及驅動,可以用于前期開發(fā)調試,也可以直接作為顯示模塊使用;
多平臺兼容,移植便捷;
上位機設計軟件 GT-HMI Designer;
可直接生成交互代碼,免去寫代碼的繁瑣工作;
模擬器仿真即見即所得;
內置了大量常用的組件,如按鈕、文本框、進度條、單選框等;
支持高通全系列點陣/矢量字庫,支持中外文及小語種,多種字號及字體;
內置中英文及數字輸入法;
持續(xù)更新的 GUI 示例庫和 UI 資源庫;
下位機技術框架 GT-HMI Engine;
純 C 語言編寫,使用無門檻;
小巧高效,不限平臺,最小僅需 24K RAM+32K FLASH,可運行在 Cortex-ARM M0M3 等小資源平臺;
移植便捷,切換平臺只需移植定時器、TP 和 LCD 接口,并提供移植教程及示例;
豐富詳實的例程,配套的開發(fā)套件易于上手;
支持自定義功能開發(fā),可用 GT-HMI Engine 自定義控件和功能,組合進 GT-HMI Designer 生成的標準代碼;
帶系統(tǒng)(如 RTOS、Linux 等)和裸機均可使用。
軟件架構
軟件架構說明
目錄 | 說明 |
---|---|
doc/ | 相關文檔說明資料 |
driver/ | 底層驅動相關的移植代碼 |
examples/ | 控件調用示例 |
sources/ | gui 內部使用的 images 素材 |
test/ | 單元測試代碼 |
src/ | gui 框架代碼 |
|-gt_conf.h | 配置 |
|-core/ | gui 核心代碼 |
|-extra/ | 拓展控件 |
|-font/ | 字體 |
|-hal/ | 中間件,中間層 |
|-others/ | 不好分類的代碼 |
|-utils/ | 工具類 |
|-widgets/ | 控件 |
|-|-gt_conf_widgets.h | 控件開關宏 |
演示示例
多國語言示例
#include"gt_ui.h" //screen_home gt_obj_st*screen_home=NULL; staticgt_obj_st*lab1=NULL; staticgt_obj_st*rect1=NULL; staticgt_obj_st*btn1=NULL; staticgt_obj_st*btn2=NULL; staticgt_obj_st*btn3=NULL; staticgt_obj_st*btn4=NULL; staticgt_obj_st*btn5=NULL; staticgt_obj_st*btn7=NULL; staticgt_obj_st*btn8=NULL; staticgt_obj_st*btn9=NULL; staticgt_obj_st*btn10=NULL; staticvoidbtn1_0_cb(gt_event_st*e){ gt_init_screen_1(); } staticvoidbtn2_0_cb(gt_event_st*e){ gt_init_screen_2(); } staticvoidbtn3_0_cb(gt_event_st*e){ gt_init_screen_3(); } staticvoidbtn4_0_cb(gt_event_st*e){ gt_init_screen_4(); } staticvoidbtn5_0_cb(gt_event_st*e){ gt_init_screen_5(); } staticvoidbtn7_0_cb(gt_event_st*e){ gt_init_screen_7(); } staticvoidbtn8_0_cb(gt_event_st*e){ gt_init_screen_8(); } staticvoidbtn9_0_cb(gt_event_st*e){ gt_init_screen_9(); } staticvoidbtn10_0_cb(gt_event_st*e){ gt_init_screen_10(); } voidgt_init_screen_home(void) { screen_home=gt_obj_create(NULL); gt_screen_set_bgcolor(screen_home,gt_color_hex(0xFFFFFF)); //lab1 lab1=gt_label_create(screen_home); gt_obj_set_pos(lab1,295,16); gt_obj_set_size(lab1,118,40); gt_label_set_font_color(lab1,gt_color_hex(0x000000)); gt_label_set_font_size(lab1,24); gt_label_set_font_family_cn(lab1,16); gt_label_set_font_align(lab1,GT_ALIGN_LEFT); gt_label_set_text(lab1,"語言設置"); //rect1 rect1=gt_rect_create(screen_home); gt_obj_set_pos(rect1,8,55); gt_obj_set_size(rect1,660,1); gt_rect_set_radius(rect1,0); gt_rect_set_bg_color(rect1,gt_color_hex(0xdbdbdb)); gt_rect_set_color_border(rect1,gt_color_hex(0xdbdbdb)); gt_rect_set_fill(rect1,1); gt_rect_set_border(rect1,0); //btn1 btn1=gt_btn_create(screen_home); gt_obj_set_pos(btn1,29,76); gt_obj_set_size(btn1,160,43); gt_btn_set_font_color(btn1,gt_color_hex(0x000000)); gt_btn_set_font_size(btn1,24); gt_btn_set_font_family_cn(btn1,16); gt_btn_set_font_family_en(btn1,84); gt_btn_set_font_align(btn1,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn1,5,0); gt_btn_set_font_thick_en(btn1,30); gt_btn_set_font_thick_cn(btn1,30); gt_btn_set_font_gray(btn1,1); gt_btn_set_text(btn1,"中文"); gt_btn_set_color_background(btn1,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn1,8); gt_obj_add_event_cb(btn1,btn1_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn2 btn2=gt_btn_create(screen_home); gt_obj_set_pos(btn2,264,76); gt_obj_set_size(btn2,160,43); gt_btn_set_font_color(btn2,gt_color_hex(0x000000)); gt_btn_set_font_size(btn2,24); gt_btn_set_font_family_cn(btn2,16); gt_btn_set_font_family_en(btn2,84); gt_btn_set_font_align(btn2,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn2,5,0); gt_btn_set_font_thick_en(btn2,30); gt_btn_set_font_thick_cn(btn2,30); gt_btn_set_font_gray(btn2,1); gt_btn_set_text(btn2,"日語"); gt_btn_set_color_background(btn2,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn2,8); gt_obj_add_event_cb(btn2,btn2_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn3 btn3=gt_btn_create(screen_home); gt_obj_set_pos(btn3,489,76); gt_obj_set_size(btn3,160,41); gt_btn_set_font_color(btn3,gt_color_hex(0x000000)); gt_btn_set_font_size(btn3,24); gt_btn_set_font_family_cn(btn3,16); gt_btn_set_font_family_en(btn3,84); gt_btn_set_font_align(btn3,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn3,5,0); gt_btn_set_font_thick_en(btn3,30); gt_btn_set_font_thick_cn(btn3,30); gt_btn_set_font_gray(btn3,1); gt_btn_set_text(btn3,"韓語"); gt_btn_set_color_background(btn3,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn3,8); gt_obj_add_event_cb(btn3,btn3_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn4 btn4=gt_btn_create(screen_home); gt_obj_set_pos(btn4,29,158); gt_obj_set_size(btn4,160,43); gt_btn_set_font_color(btn4,gt_color_hex(0x000000)); gt_btn_set_font_size(btn4,24); gt_btn_set_font_family_cn(btn4,16); gt_btn_set_font_family_en(btn4,41); gt_btn_set_font_align(btn4,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn4,5,0); gt_btn_set_text(btn4,"英語"); gt_btn_set_color_background(btn4,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn4,8); gt_obj_add_event_cb(btn4,btn4_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn5 btn5=gt_btn_create(screen_home); gt_obj_set_pos(btn5,263,158); gt_obj_set_size(btn5,160,43); gt_btn_set_font_color(btn5,gt_color_hex(0x000000)); gt_btn_set_font_size(btn5,24); gt_btn_set_font_family_cn(btn5,16); gt_btn_set_font_family_en(btn5,53); gt_btn_set_font_align(btn5,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn5,5,0); gt_btn_set_text(btn5,"法語"); gt_btn_set_color_background(btn5,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn5,8); gt_obj_add_event_cb(btn5,btn5_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn7 btn7=gt_btn_create(screen_home); gt_obj_set_pos(btn7,30,238); gt_obj_set_size(btn7,160,43); gt_btn_set_font_color(btn7,gt_color_hex(0x000000)); gt_btn_set_font_size(btn7,24); gt_btn_set_font_family_cn(btn7,16); gt_btn_set_font_family_en(btn7,53); gt_btn_set_font_align(btn7,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn7,5,0); gt_btn_set_text(btn7,"西班牙語"); gt_btn_set_color_background(btn7,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn7,8); gt_obj_add_event_cb(btn7,btn7_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn8 btn8=gt_btn_create(screen_home); gt_obj_set_pos(btn8,263,238); gt_obj_set_size(btn8,160,43); gt_btn_set_font_color(btn8,gt_color_hex(0x000000)); gt_btn_set_font_size(btn8,24); gt_btn_set_font_family_cn(btn8,16); gt_btn_set_font_family_en(btn8,41); gt_btn_set_font_align(btn8,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn8,5,0); gt_btn_set_text(btn8,"泰語"); gt_btn_set_color_background(btn8,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn8,8); gt_obj_add_event_cb(btn8,btn8_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn9 btn9=gt_btn_create(screen_home); gt_obj_set_pos(btn9,490,238); gt_obj_set_size(btn9,160,43); gt_btn_set_font_color(btn9,gt_color_hex(0x000000)); gt_btn_set_font_size(btn9,24); gt_btn_set_font_family_cn(btn9,16); gt_btn_set_font_family_en(btn9,75); gt_btn_set_font_align(btn9,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn9,5,0); gt_btn_set_text(btn9,"阿拉伯語"); gt_btn_set_color_background(btn9,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn9,8); gt_obj_add_event_cb(btn9,btn9_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn10 btn10=gt_btn_create(screen_home); gt_obj_set_pos(btn10,489,158); gt_obj_set_size(btn10,160,43); gt_btn_set_font_color(btn10,gt_color_hex(0x000000)); gt_btn_set_font_size(btn10,24); gt_btn_set_font_family_cn(btn10,16); gt_btn_set_font_family_en(btn10,60); gt_btn_set_font_align(btn10,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn10,5,0); gt_btn_set_text(btn10,"俄語"); gt_btn_set_color_background(btn10,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn10,8); gt_obj_add_event_cb(btn10,btn10_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); gt_disp_load_scr_anim(screen_home,GT_SCR_ANIM_TYPE_NONE,500,0,true); }
矢量字庫示例
#include"gt_ui.h" //screen_home gt_obj_st*screen_home=NULL; staticgt_obj_st*lab1=NULL; staticgt_obj_st*rect1=NULL; staticgt_obj_st*btn1=NULL; staticgt_obj_st*btn2=NULL; staticgt_obj_st*btn3=NULL; staticgt_obj_st*btn4=NULL; staticgt_obj_st*btn5=NULL; staticgt_obj_st*btn7=NULL; staticgt_obj_st*btn8=NULL; staticgt_obj_st*btn9=NULL; staticgt_obj_st*btn10=NULL; staticvoidbtn1_0_cb(gt_event_st*e){ gt_init_screen_1(); } staticvoidbtn2_0_cb(gt_event_st*e){ gt_init_screen_2(); } staticvoidbtn3_0_cb(gt_event_st*e){ gt_init_screen_3(); } staticvoidbtn4_0_cb(gt_event_st*e){ gt_init_screen_4(); } staticvoidbtn5_0_cb(gt_event_st*e){ gt_init_screen_5(); } staticvoidbtn7_0_cb(gt_event_st*e){ gt_init_screen_7(); } staticvoidbtn8_0_cb(gt_event_st*e){ gt_init_screen_8(); } staticvoidbtn9_0_cb(gt_event_st*e){ gt_init_screen_9(); } staticvoidbtn10_0_cb(gt_event_st*e){ gt_init_screen_6(); } voidgt_init_screen_home(void) { screen_home=gt_obj_create(NULL); gt_screen_set_bgcolor(screen_home,gt_color_hex(0xFFFFFF)); //lab1 lab1=gt_label_create(screen_home); gt_obj_set_pos(lab1,207,10); gt_obj_set_size(lab1,309,40); gt_label_set_font_color(lab1,gt_color_hex(0x000000)); gt_label_set_font_size(lab1,24); gt_label_set_font_family_cn(lab1,80); gt_label_set_font_align(lab1,GT_ALIGN_LEFT); gt_label_set_font_thick_en(lab1,30); gt_label_set_font_thick_cn(lab1,30); gt_label_set_font_gray(lab1,4); gt_label_set_text(lab1,"矢量字庫,灰度與多字形"); //rect1 rect1=gt_rect_create(screen_home); gt_obj_set_pos(rect1,8,55); gt_obj_set_size(rect1,660,1); gt_rect_set_radius(rect1,0); gt_rect_set_bg_color(rect1,gt_color_hex(0xdbdbdb)); gt_rect_set_color_border(rect1,gt_color_hex(0xdbdbdb)); gt_rect_set_fill(rect1,1); gt_rect_set_border(rect1,0); //btn1 btn1=gt_btn_create(screen_home); gt_obj_set_pos(btn1,33,78); gt_obj_set_size(btn1,160,43); gt_btn_set_font_color(btn1,gt_color_hex(0x000000)); gt_btn_set_font_size(btn1,24); gt_btn_set_font_family_cn(btn1,80); gt_btn_set_font_family_en(btn1,84); gt_btn_set_font_align(btn1,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn1,0,0); gt_btn_set_font_thick_en(btn1,30); gt_btn_set_font_thick_cn(btn1,30); gt_btn_set_font_gray(btn1,4); gt_btn_set_text(btn1,"中文宋體"); gt_btn_set_color_background(btn1,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn1,8); gt_obj_add_event_cb(btn1,btn1_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn2 btn2=gt_btn_create(screen_home); gt_obj_set_pos(btn2,266,76); gt_obj_set_size(btn2,160,43); gt_btn_set_font_color(btn2,gt_color_hex(0x000000)); gt_btn_set_font_size(btn2,24); gt_btn_set_font_family_cn(btn2,80); gt_btn_set_font_family_en(btn2,84); gt_btn_set_font_align(btn2,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn2,0,0); gt_btn_set_font_thick_en(btn2,30); gt_btn_set_font_thick_cn(btn2,30); gt_btn_set_font_gray(btn2,4); gt_btn_set_text(btn2,"中文黑體"); gt_btn_set_color_background(btn2,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn2,8); gt_obj_add_event_cb(btn2,btn2_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn3 btn3=gt_btn_create(screen_home); gt_obj_set_pos(btn3,493,76); gt_obj_set_size(btn3,160,41); gt_btn_set_font_color(btn3,gt_color_hex(0x000000)); gt_btn_set_font_size(btn3,24); gt_btn_set_font_family_cn(btn3,80); gt_btn_set_font_family_en(btn3,84); gt_btn_set_font_align(btn3,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn3,0,0); gt_btn_set_font_thick_en(btn3,30); gt_btn_set_font_thick_cn(btn3,30); gt_btn_set_font_gray(btn3,4); gt_btn_set_text(btn3,"英文斜體"); gt_btn_set_color_background(btn3,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn3,8); gt_obj_add_event_cb(btn3,btn3_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn4 btn4=gt_btn_create(screen_home); gt_obj_set_pos(btn4,33,160); gt_obj_set_size(btn4,160,43); gt_btn_set_font_color(btn4,gt_color_hex(0x000000)); gt_btn_set_font_size(btn4,24); gt_btn_set_font_family_cn(btn4,80); gt_btn_set_font_family_en(btn4,41); gt_btn_set_font_align(btn4,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn4,0,0); gt_btn_set_font_thick_en(btn4,30); gt_btn_set_font_thick_cn(btn4,30); gt_btn_set_font_gray(btn4,4); gt_btn_set_text(btn4,"英文手寫體"); gt_btn_set_color_background(btn4,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn4,8); gt_obj_add_event_cb(btn4,btn4_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn5 btn5=gt_btn_create(screen_home); gt_obj_set_pos(btn5,265,160); gt_obj_set_size(btn5,160,43); gt_btn_set_font_color(btn5,gt_color_hex(0x000000)); gt_btn_set_font_size(btn5,24); gt_btn_set_font_family_cn(btn5,80); gt_btn_set_font_family_en(btn5,53); gt_btn_set_font_align(btn5,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn5,0,0); gt_btn_set_font_thick_en(btn5,30); gt_btn_set_font_thick_cn(btn5,30); gt_btn_set_font_gray(btn5,4); gt_btn_set_text(btn5,"日文黑體"); gt_btn_set_color_background(btn5,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn5,8); gt_obj_add_event_cb(btn5,btn5_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn7 btn7=gt_btn_create(screen_home); gt_obj_set_pos(btn7,32,240); gt_obj_set_size(btn7,160,43); gt_btn_set_font_color(btn7,gt_color_hex(0x000000)); gt_btn_set_font_size(btn7,24); gt_btn_set_font_family_cn(btn7,80); gt_btn_set_font_family_en(btn7,53); gt_btn_set_font_align(btn7,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn7,0,0); gt_btn_set_font_thick_en(btn7,30); gt_btn_set_font_thick_cn(btn7,30); gt_btn_set_font_gray(btn7,4); gt_btn_set_text(btn7,"俄文"); gt_btn_set_color_background(btn7,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn7,8); gt_obj_add_event_cb(btn7,btn7_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn8 btn8=gt_btn_create(screen_home); gt_obj_set_pos(btn8,267,240); gt_obj_set_size(btn8,160,43); gt_btn_set_font_color(btn8,gt_color_hex(0x000000)); gt_btn_set_font_size(btn8,24); gt_btn_set_font_family_cn(btn8,80); gt_btn_set_font_family_en(btn8,41); gt_btn_set_font_align(btn8,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn8,0,0); gt_btn_set_font_thick_en(btn8,30); gt_btn_set_font_thick_cn(btn8,30); gt_btn_set_font_gray(btn8,4); gt_btn_set_text(btn8,"泰文"); gt_btn_set_color_background(btn8,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn8,8); gt_obj_add_event_cb(btn8,btn8_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn9 btn9=gt_btn_create(screen_home); gt_obj_set_pos(btn9,494,240); gt_obj_set_size(btn9,160,43); gt_btn_set_font_color(btn9,gt_color_hex(0x000000)); gt_btn_set_font_size(btn9,24); gt_btn_set_font_family_cn(btn9,80); gt_btn_set_font_family_en(btn9,75); gt_btn_set_font_align(btn9,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn9,0,0); gt_btn_set_font_thick_en(btn9,30); gt_btn_set_font_thick_cn(btn9,30); gt_btn_set_font_gray(btn9,4); gt_btn_set_text(btn9,"阿拉伯文"); gt_btn_set_color_background(btn9,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn9,8); gt_obj_add_event_cb(btn9,btn9_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //btn10 btn10=gt_btn_create(screen_home); gt_obj_set_pos(btn10,495,160); gt_obj_set_size(btn10,160,43); gt_btn_set_font_color(btn10,gt_color_hex(0x000000)); gt_btn_set_font_size(btn10,24); gt_btn_set_font_family_cn(btn10,80); gt_btn_set_font_family_en(btn10,60); gt_btn_set_font_align(btn10,GT_ALIGN_CENTER_MID); gt_btn_set_space(btn10,0,0); gt_btn_set_font_thick_en(btn10,30); gt_btn_set_font_thick_cn(btn10,30); gt_btn_set_font_gray(btn10,4); gt_btn_set_text(btn10,"韓文黑體"); gt_btn_set_color_background(btn10,gt_color_hex(0xddeeff)); gt_btn_set_radius(btn10,8); gt_obj_add_event_cb(btn10,btn10_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); gt_disp_load_scr_anim(screen_home,GT_SCR_ANIM_TYPE_NONE,500,0,true); }
幻燈片示例動畫
#include"gt_ui.h" //screen_home gt_obj_st*screen_home=NULL; staticgt_obj_st*lab1=NULL; staticgt_obj_st*img1=NULL; staticgt_obj_st*player1=NULL; staticgt_obj_st*svg1=NULL; staticgt_obj_st*svg2=NULL; staticvoidsvg1_0_cb(gt_event_st*e){ gt_player_turn_prev(player1); } staticvoidsvg2_0_cb(gt_event_st*e){ gt_player_turn_next(player1); } voidgt_init_screen_home(void) { screen_home=gt_obj_create(NULL); gt_screen_set_bgcolor(screen_home,gt_color_hex(0xFFFFFF)); //lab1 lab1=gt_label_create(screen_home); gt_obj_set_pos(lab1,223,71); gt_obj_set_size(lab1,96,51); gt_label_set_font_color(lab1,gt_color_hex(0x6e6e6e)); gt_label_set_font_size(lab1,32); gt_label_set_font_family_cn(lab1,19); gt_label_set_font_align(lab1,GT_ALIGN_LEFT); gt_label_set_text(lab1,"風速"); //img1 img1=gt_img_create(screen_home); gt_obj_set_pos(img1,157,75); gt_obj_set_size(img1,42,40); gt_img_set_src(img1,"f:img_42x40_9.png"); //player1 player1=gt_player_create(screen_home); gt_obj_set_pos(player1,153,136); gt_obj_set_size(player1,161,66); gt_player_add_item(player1,"f:img_161x66_4.png",sizeof("f:img_161x66_4.png")); gt_player_add_item(player1,"f:img_161x66_5.png",sizeof("f:img_161x66_5.png")); gt_player_add_item(player1,"f:img_161x66_6.png",sizeof("f:img_161x66_6.png")); gt_player_add_item(player1,"f:img_161x66_7.png",sizeof("f:img_161x66_7.png")); gt_player_add_item(player1,"f:img_161x66_8.png",sizeof("f:img_161x66_8.png")); gt_player_set_type(player1,GT_PLAYER_TYPE_IMG); gt_player_set_mode(player1,GT_PLAYER_MODE_LOOP); /svg1 svg1=gt_img_create(screen_home); gt_obj_set_pos(svg1,76,149); gt_obj_set_size(svg1,48,48); gt_img_set_src(svg1,"f:img_48x48_minus_0_3.png"); gt_obj_add_event_cb(svg1,svg1_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); //svg2 svg2=gt_img_create(screen_home); gt_obj_set_pos(svg2,341,148); gt_obj_set_size(svg2,48,48); gt_img_set_src(svg2,"f:img_48x48_plus_0_4.png"); gt_obj_add_event_cb(svg2,svg2_0_cb,GT_EVENT_TYPE_INPUT_RELEASED,NULL); gt_disp_load_scr_anim(screen_home,GT_SCR_ANIM_TYPE_NONE,500,0,true); }
鍵盤控件示例動畫
#include"gt_ui.h" //screen_home gt_obj_st*screen_home=NULL; staticgt_obj_st*input1=NULL; staticgt_obj_st*keyboard1=NULL; voidgt_init_screen_home(void) { screen_home=gt_obj_create(NULL); gt_screen_set_bgcolor(screen_home,gt_color_hex(0xFFFFFF)); //input1 input1=gt_input_create(screen_home); gt_obj_set_pos(input1,117,38); gt_obj_set_size(input1,249,84); gt_input_set_font_color(input1,gt_color_hex(0x000000)); gt_input_set_font_size(input1,16); gt_input_set_font_family_cn(input1,3); gt_input_set_font_family_en(input1,39); gt_input_set_font_align(input1,GT_ALIGN_LEFT); gt_input_set_placeholder(input1,"placeholder"); gt_input_set_bg_color(input1,gt_color_hex(0xffffff)); //keyboard1 keyboard1=gt_keypad_create(screen_home); gt_obj_set_pos(keyboard1,89,138); gt_obj_set_size(keyboard1,309,170); gt_keypad_set_font_color(keyboard1,gt_color_hex(0xffffff)); gt_keypad_set_font_size(keyboard1,16); gt_keypad_set_font_align(keyboard1,GT_ALIGN_CENTER_MID); gt_keypad_set_color_background(keyboard1,gt_color_hex(0x242424)); gt_keypad_set_target(keyboard1,input1); gt_disp_load_scr_anim(screen_home,GT_SCR_ANIM_TYPE_NONE,500,0,true); }
圖片按鈕控件示例動畫
#include"gt_ui.h" /**screen_home*/ gt_obj_st*screen_home=NULL; staticgt_obj_st*imgbtn1=NULL; voidgt_init_screen_home(void) { screen_home=gt_obj_create(NULL); gt_screen_set_bgcolor(screen_home,gt_color_hex(0xFFFFFF)); /**imgbtn1*/ imgbtn1=gt_imgbtn_create(screen_home); gt_obj_set_pos(imgbtn1,142,136); gt_obj_set_size(imgbtn1,185,50); gt_imgbtn_set_src(imgbtn1,"f:img_185x50_10.png"); gt_imgbtn_set_src_press(imgbtn1,"f:img_185x50_3.png"); gt_disp_load_scr_anim(screen_home,GT_SCR_ANIM_TYPE_NONE,500,0,true); }
-
嵌入式
+關注
關注
5082文章
19123瀏覽量
305147 -
開源
+關注
關注
3文章
3348瀏覽量
42496 -
GUI
+關注
關注
3文章
660瀏覽量
39674
原文標題:分享一款GUI開發(fā)神器
文章出處:【微信號:strongerHuang,微信公眾號:strongerHuang】歡迎添加關注!文章轉載請注明出處。
發(fā)布評論請先 登錄
相關推薦
評論