修改了一些逻辑
This commit is contained in:
+1
-6
@@ -41,12 +41,7 @@ void main_app()
|
||||
|
||||
}
|
||||
*/
|
||||
if(ui->refresh_ui_flag==1)
|
||||
{
|
||||
ui->refresh_ui_flag=0;
|
||||
Refresh_UI(ui);
|
||||
|
||||
}
|
||||
UI_Server(ui);
|
||||
TP_Server();
|
||||
EEPROM_SLOWWRITE_SERVER();
|
||||
}
|
||||
|
||||
+21
-6
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "windows.h"
|
||||
#include "touch.h"
|
||||
//接口
|
||||
//设置屏幕像素坐标
|
||||
void Inteface_SetCursor(uint16_t Xpos, uint16_t Ypos)
|
||||
@@ -281,7 +282,7 @@ void Refresh_UI(UI *ui)
|
||||
#define BAR 2
|
||||
#define CLOSE 3
|
||||
|
||||
uint8_t Chack(window *this_window,uint16_t x,uint16_t y)
|
||||
uint8_t Chack(window *this_window,int x,int y)
|
||||
{
|
||||
int a=0;
|
||||
|
||||
@@ -309,9 +310,11 @@ void UI_Server(UI *ui)
|
||||
//touch_device *temp_touch=NULL;
|
||||
int flag=0;
|
||||
uint8_t hit_flag=0;
|
||||
|
||||
int t_x,t_y;
|
||||
//touch
|
||||
//temp_touch=ui->touch;
|
||||
if(1)//Touch_Server(temp_touch))
|
||||
if(TP_XY(&t_x, &t_y))//Touch_Server(temp_touch))
|
||||
{
|
||||
temp_window=NULL;
|
||||
temp_windows_stack=ui->last_windows; //获取ui中最前端的窗口 从前往后扫描
|
||||
@@ -322,7 +325,7 @@ void UI_Server(UI *ui)
|
||||
flag=1; //检查到有窗口 需要循环一次以检查是否有下一个窗口
|
||||
//
|
||||
temp_window=temp_windows_stack->window; //取出这个窗口
|
||||
//hit_flag=Chack(temp_window,temp_touch->x,temp_touch->y); //检查触摸是否命中 直接返回命中窗口的位置
|
||||
hit_flag=Chack(temp_window,t_x,t_y); //检查触摸是否命中 直接返回命中窗口的位置
|
||||
if(hit_flag) // 命中继续
|
||||
{
|
||||
if(temp_windows_stack!=ui->last_windows) //检查是否最前端的窗口 如果不是就放最前面
|
||||
@@ -351,12 +354,20 @@ void UI_Server(UI *ui)
|
||||
ui->refresh_ui_flag=1; //发生了变化 刷新ui的显示
|
||||
break;
|
||||
case BAR:
|
||||
//Set_Windows_XY_BY_ACC(temp_windows_stack->window,temp_touch->acc_x,temp_touch->acc_y);
|
||||
|
||||
if(ui->window_move_lock==0)
|
||||
{
|
||||
ui->window_move_x=t_x;
|
||||
ui->window_move_y=t_y;
|
||||
}
|
||||
Set_Windows_XY_BY_ACC(temp_windows_stack->window,t_x-ui->window_move_x,t_y-ui->window_move_y);
|
||||
ui->window_move_x=t_x;
|
||||
ui->window_move_y=t_y;
|
||||
ui->refresh_ui_flag=1; //发生了变化 刷新ui的显示
|
||||
break;
|
||||
case BODY:
|
||||
ui->background=temp_windows_stack->window->background;
|
||||
ui->refresh_ui_flag=1;
|
||||
//ui->background=temp_windows_stack->window->background;
|
||||
//ui->refresh_ui_flag=1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -369,6 +380,10 @@ void UI_Server(UI *ui)
|
||||
flag=0; //一个窗口都没有 直接结束循环
|
||||
}
|
||||
}while(flag);
|
||||
ui->window_move_lock=1;
|
||||
}else
|
||||
{
|
||||
ui->window_move_lock=0;
|
||||
}
|
||||
//display
|
||||
if(ui->refresh_ui_flag==1)
|
||||
|
||||
+4
-2
@@ -39,8 +39,10 @@ typedef struct
|
||||
windows_stack *windows;
|
||||
windows_stack *last_windows;
|
||||
//touch_device *touch; //Ò»¸öUI¹ÒÔØÒ»¸ö´¥¿ØÉ豸
|
||||
uint8_t refresh_ui_flag;
|
||||
|
||||
int window_move_x;
|
||||
int window_move_y;
|
||||
uint8_t refresh_ui_flag:1;
|
||||
uint8_t window_move_lock:1;
|
||||
}UI;
|
||||
|
||||
void Inteface_SetCursor(uint16_t Xpos, uint16_t Ypos);
|
||||
|
||||
Reference in New Issue
Block a user