|
本帖最后由 二哲科技 于 2023-10-21 16:04 编辑
1、介绍
本来想用最近开发的DwinQuick和DE-RTOS设计一些传感类型的Demo,不过DwinQuick到可以真正使用还需要一段时间,下面是DwinQuick软件的部分界面。
图1
图2
接下来进入今天开源项目的正题,项目采用的是【DWG80480F043】屏幕,分辨率800x480,做了一些界面切换的Demo和动态的下拉框,也是可以让大家移植到自己项目中。
2、设计
首先准备素材,如下图所示。
图3
接下来就是界面的设计,主要是主界面和动态下拉框的设计,其他界面都只是一个图片和一个按钮控件。
图4
图5
这次设计主要都是用的基本图形功能,用矩形填充控件,进行矩形覆盖面的修改,这样就可以做到类似PPT一样的切屏过度效果。动态下拉框,也是用的基本图形,将其他页面的内容显示在当前页面上,但是不是立马显示,而且需要根据时间一点一点显示。
图6
用的还是DE-RTOS框架,切屏效果和动态下拉框主要代码如下:
- void display_task()
- {
- static uint8_t one_flag = 1;
- static uint16_t timer_cnt = 0;
- static uint16_t step_cnt = 0;
- timer_cnt++;
- if(timer_cnt >= 200)
- {
- timer_cnt = 0;
- if(display_mode == 0x01)
- {
- step_cnt++;
- if(step_cnt >= step_period)
- {
- step_cnt = 0;
- base_graph_rectangle_param1.end_x--;
- if(base_graph_rectangle_param1.end_x == 0)
- {
- display_mode = 0x00;
- }
- base_graph_rectangle_fill_set(0x2000, &base_graph_rectangle_param1, 1);
- }
- }
- else if(display_mode == 0x02)
- {
- step_cnt++;
- if(step_cnt >= step_period)
- {
- step_cnt = 0;
- base_graph_rectangle_param1.start_x++;
- if(base_graph_rectangle_param1.start_x == 800)
- {
- display_mode = 0x00;
- }
- base_graph_rectangle_fill_set(0x2000, &base_graph_rectangle_param1, 1);
- }
- }
- else if(display_mode == 0x03)
- {
- step_cnt++;
- if(step_cnt >= step_period * 2)
- {
- step_cnt = 0;
- base_graph_rectangle_param1.end_y--;
- if(base_graph_rectangle_param1.end_y == 0)
- {
- display_mode = 0x00;
- }
- base_graph_rectangle_fill_set(0x2000, &base_graph_rectangle_param1, 1);
- }
-
- }
- else if(display_mode == 0x04)
- {
- step_cnt++;
- if(step_cnt >= step_period * 2)
- {
- step_cnt = 0;
- base_graph_rectangle_param1.start_y++;
- if(base_graph_rectangle_param1.start_y == 480)
- {
- display_mode = 0x00;
- }
- base_graph_rectangle_fill_set(0x2000, &base_graph_rectangle_param1, 1);
- }
-
- }
- else if(display_mode == 0x05)
- {
- if(one_flag == 1)
- {
- base_graph_rectangle_param2[0].start_x = 0;
- base_graph_rectangle_param2[0].start_y = 0;
- base_graph_rectangle_param2[0].end_x = 400;
- base_graph_rectangle_param2[0].end_y = 480;
- base_graph_rectangle_param2[1].start_x = 400;
- base_graph_rectangle_param2[1].start_y = 0;
- base_graph_rectangle_param2[1].end_x = 800;
- base_graph_rectangle_param2[1].end_y = 480;
- one_flag = 0;
- }
- step_cnt++;
- if(step_cnt >= step_period)
- {
- step_cnt = 0;
-
- base_graph_rectangle_param2[0].start_x++;
- base_graph_rectangle_param2[1].end_x--;
- if(base_graph_rectangle_param2[0].start_x == 400)
- {
- display_mode = 0x00;
- }
- base_graph_rectangle_fill_set(0x2100, &base_graph_rectangle_param2, 2);
- }
- }
- else if(display_mode == 0x06)
- {
- if(one_flag == 1)
- {
- base_graph_rectangle_param2[0].start_x = 0;
- base_graph_rectangle_param2[0].start_y = 0;
- base_graph_rectangle_param2[0].end_x = 400;
- base_graph_rectangle_param2[0].end_y = 480;
- base_graph_rectangle_param2[1].start_x = 400;
- base_graph_rectangle_param2[1].start_y = 0;
- base_graph_rectangle_param2[1].end_x = 800;
- base_graph_rectangle_param2[1].end_y = 480;
- one_flag = 0;
- }
-
- step_cnt++;
- if(step_cnt >= step_period)
- {
- step_cnt = 0;
- base_graph_rectangle_param2[0].end_x--;
- base_graph_rectangle_param2[1].start_x++;
- if(base_graph_rectangle_param2[0].end_x == 0)
- {
- display_mode = 0x00;
- }
- base_graph_rectangle_fill_set(0x2100, &base_graph_rectangle_param2, 2);
- }
- }
- else if(display_mode == 0x07)
- {
- if(one_flag == 1)
- {
- base_graph_rectangle_param2[0].start_x = 0;
- base_graph_rectangle_param2[0].start_y = 0;
- base_graph_rectangle_param2[0].end_x = 800;
- base_graph_rectangle_param2[0].end_y = 240;
- base_graph_rectangle_param2[1].start_x = 0;
- base_graph_rectangle_param2[1].start_y = 240;
- base_graph_rectangle_param2[1].end_x = 800;
- base_graph_rectangle_param2[1].end_y = 480;
- one_flag = 0;
- }
-
- step_cnt++;
- if(step_cnt >= step_period * 2)
- {
- step_cnt = 0;
- base_graph_rectangle_param2[0].start_y++;
- base_graph_rectangle_param2[1].end_y--;
- if(base_graph_rectangle_param2[0].start_y == 240)
- {
- display_mode = 0x00;
- }
- base_graph_rectangle_fill_set(0x2100, &base_graph_rectangle_param2, 2);
- }
-
- }
- else if(display_mode == 0x08)
- {
- if(one_flag == 1)
- {
- base_graph_rectangle_param2[0].start_x = 0;
- base_graph_rectangle_param2[0].start_y = 0;
- base_graph_rectangle_param2[0].end_x = 800;
- base_graph_rectangle_param2[0].end_y = 240;
- base_graph_rectangle_param2[1].start_x = 0;
- base_graph_rectangle_param2[1].start_y = 240;
- base_graph_rectangle_param2[1].end_x = 800;
- base_graph_rectangle_param2[1].end_y = 480;
- one_flag = 0;
- }
-
- step_cnt++;
- if(step_cnt >= step_period * 2)
- {
- step_cnt = 0;
- base_graph_rectangle_param2[0].end_y--;
- base_graph_rectangle_param2[1].start_y++;
- if(base_graph_rectangle_param2[0].end_y == 0)
- {
- display_mode = 0x00;
- }
- base_graph_rectangle_fill_set(0x2100, &base_graph_rectangle_param2, 2);
- }
-
- }
- else if(display_mode == 0x09)
- {
- step_cnt++;
- if(step_cnt >= step_period * 2)
- {
- step_cnt = 0;
- base_graph_rectangle_param3.start_y++;
- base_graph_rectangle_param3.start_x = base_graph_rectangle_param3.start_y * 1.67 ;
- base_graph_rectangle_param3.end_y--;
- base_graph_rectangle_param3.end_x = base_graph_rectangle_param3.end_y * 1.67;
- if(base_graph_rectangle_param3.start_y == 240)
- {
- display_mode = 0x00;
- }
- base_graph_rectangle_fill_set(0x2200, &base_graph_rectangle_param3, 1);
- }
- }
- else if(display_mode == 0x0A)
- {
- if(one_flag == 1)
- {
- base_graph_rectangle_param3.start_y = 240;
- base_graph_rectangle_param3.start_x = 480;
- base_graph_rectangle_param3.end_y = 240;
- base_graph_rectangle_param3.end_x = 480;
- base_graph_rectangle_fill_set(0x2200, &base_graph_rectangle_param3, 1);
- one_flag = 0;
- }
- step_cnt++;
- if(step_cnt >= step_period * 2)
- {
- step_cnt = 0;
- base_graph_rectangle_param3.start_y--;
- base_graph_rectangle_param3.start_x = base_graph_rectangle_param3.start_y * 1.67 ;
- base_graph_rectangle_param3.end_y++;
- base_graph_rectangle_param3.end_x = base_graph_rectangle_param3.end_y * 1.67;
- if(base_graph_rectangle_param3.start_y == 0)
- {
- base_graph_rectangle_param3.start_y = 240;
- base_graph_rectangle_param3.start_x = 480;
- base_graph_rectangle_param3.end_y = 240;
- base_graph_rectangle_param3.end_x = 480;
- base_graph_rectangle_fill_set(0x2200, &base_graph_rectangle_param3, 1);
- display_mode = 0x00;
- }
- base_graph_rectangle_fill_set(0x2200, &base_graph_rectangle_param3, 1);
- }
- }
- else if(display_mode == 0x20)
- {
- if(dropdown_flag == 0)
- {
- base_graph_page_copy_param4.end_y++;
- if(base_graph_page_copy_param4.end_y == 312)
- {
- dropdown_flag = 1;
- display_mode = 0x00;
- }
- base_graph_page_copy_fill_set(0x2A00, &base_graph_page_copy_param4, 1);
- }
- else if(dropdown_flag == 1)
- {
- base_graph_page_copy_param4.end_y--;
- if(base_graph_page_copy_param4.end_y == 0)
- {
- dropdown_flag = 0;
- display_mode = 0x00;
- }
- base_graph_page_copy_fill_set(0x2A00, &base_graph_page_copy_param4, 1);
- }
- }
- else if(display_mode == 0x10) //返回
- {
- base_graph_rectangle_param1.start_x = 0;
- base_graph_rectangle_param1.start_y = 0;
- base_graph_rectangle_param1.end_x = 800;
- base_graph_rectangle_param1.end_y = 480;
- base_graph_rectangle_param1.color = 0x0000;
- base_graph_rectangle_fill_set(0x2000, &base_graph_rectangle_param1, 1);
- display_mode = 0x00;
- }
- else if(display_mode == 0x11) //返回
- {
- one_flag = 1;
- base_graph_rectangle_param2[0].start_x = 0;
- base_graph_rectangle_param2[0].start_y = 0;
- base_graph_rectangle_param2[0].end_x = 400;
- base_graph_rectangle_param2[0].end_y = 480;
- base_graph_rectangle_param2[1].start_x = 400;
- base_graph_rectangle_param2[1].start_y = 0;
- base_graph_rectangle_param2[1].end_x = 800;
- base_graph_rectangle_param2[1].end_y = 480;
- base_graph_rectangle_fill_set(0x2100, &base_graph_rectangle_param1, 2);
- display_mode = 0x00;
- }
- else if(display_mode == 0x12) //返回
- {
- one_flag = 1;
- base_graph_rectangle_param3.start_x = 0;
- base_graph_rectangle_param3.start_y = 0;
- base_graph_rectangle_param3.end_x = 800;
- base_graph_rectangle_param3.end_y = 480;
- base_graph_rectangle_param3.color = 0x0000;
- base_graph_rectangle_fill_set(0x2200, &base_graph_rectangle_param3, 1);
- display_mode = 0x00;
- }
- else if(display_mode == 0x13) //返回
- {
- base_graph_page_copy_param4.page_id = 6;
- base_graph_page_copy_param4.start_x = 0;
- base_graph_page_copy_param4.start_y = 0;
- base_graph_page_copy_param4.end_x = 264;
- base_graph_page_copy_param4.end_y = 0;//312;
- base_graph_page_copy_param4.current_x = 255;
- base_graph_page_copy_param4.current_y = 145;
- base_graph_page_copy_fill_set(0x2A00, &base_graph_page_copy_param4, 1);
- display_mode = 0x00;
- }
- }
- }
复制代码
3、结论
其实界面设计有很多可玩性,我也只是在发掘其中的一小部分,感觉大家可以天马行空的进行想象,只要能想出来的基本就是可以做到的,后面的开源项目,我依旧会设计更多新颖和炫酷的功能~ 工程文件: 演示视频:
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|