/**************************************************************************** * 名称: DispLogin() * 功能: 闪动显示"Loading...",并显示进度条。 * 入口参数: 无 * 出口参数: 无 ****************************************************************************/ void DispLogin(void) { int i; // 显示loding... GUI_PutString(30, 25, "Loading..."); // 显示进度条 GUI_Rectangle( PROG_STARTX, PROG_STARTY, PROG_STARTX+PROG_LENGTH, PROG_STARTY+PROG_HIGH, 1); // 循环增长进度 for(i=3; i<100; i+=1) { // 改变进度条显示 GUI_RectangleFill( PROG_STARTX, PROG_STARTY, PROG_STARTX+i, PROG_STARTY+PROG_HIGH, 1); // 若进度到尾数为5时,则使能"Loading..."显示 if((i%10) == 5) { GUI_PutString(30, 25, "Loading..."); } // 若进度到尾数为0时,则禁止"Loading..."显示 if((i%10) == 0) { GUI_PutString(30, 25, " "); } //vTaskDelay(100); } }
/** * @brief 画正方形. * @param x0:矩形左上角 y0:矩形左上角 with:边长 color:显示的颜色. * @retval None. * @verify . */ void GUI_Square(uint32_t x0, uint32_t y0, uint32_t with, TCOLOR color) { if(with==0) return; if( (x0+with) > GUI_LCM_XMAX ) return; if( (y0+with) > GUI_LCM_YMAX ) return; GUI_Rectangle(x0, y0, x0+with, y0+with, color); }
/**************************************************************************** * 名称:GUI_WindowsDraw() * 功能:显示窗口。根据提供的窗口参数进行画窗口。 * 入口参数:win 窗口句柄 * 出口参数:返回0表示操作失败,返回1表示操作成功 ****************************************************************************/ uint8 GUI_WindowsDraw(WINDOWS *win) { uint8 *str; int32 bak, bak1, bak2; /* 参数过滤,若窗口起出范围,则返回0 */ if( ( (win->with)<20 ) || ( (win->hight)<20 ) ) return(0); // 宽度、高度检查,限制最小窗口 if( (win->x + win->with ) > GUI_LCM_XMAX ) return(0); // 窗口宽度是否溢出 if( (win->y + win->hight ) > GUI_LCM_YMAX ) return(0); // 窗口高度是否溢出 /* 开始画窗口 */ GUI_RectangleFill(win->x, win->y, win->x + win->with - 1, win->y + win->hight - 1, back_color); GUI_Rectangle(win->x, win->y, win->x + win->with - 1, win->y + win->hight - 1, disp_color); // 画窗口 GUI_HLine(win->x, win->y + 12, win->x + win->with - 1, disp_color); // 画标题目栏 GUI_RLine(win->x + 12, win->y, win->y + 12, disp_color); // 画关闭窗号按钮 GUI_Line(win->x, win->y, win->x + 12, win->y + 12, disp_color); GUI_Line(win->x + 12, win->y, win->x, win->y + 12, disp_color); /* 写标题 */ if( win->title != NULL ) { str = win->title; bak = win->x + 15; bak1 = win->y + 3; bak2 = win->x + win->with -1; while(1) { if( (bak+8) > bak2 ) break; // 判断标题是否溢出 if(*str=='\0') break; // 判断字符串是否结束 GUI_PutChar(bak, bak1, *str++); // 显示标题 bak += 6; } } /* 写状态栏 */ if( win->state != NULL ) { if( win->hight < 60) return(0); // 判断是否可以画状态栏 /* 画状态栏 */ GUI_HLine(win->x, win->y + win->hight - 11, win->x + win->with - 1, disp_color); str = win->state; bak = win->x + 3; bak1 = win->y + win->hight - 9; bak2 = win->x + win->with -1; while(1) { if( (bak+8) > bak2 ) break; // 判断标题是否溢出 if(*str=='\0') break; // 判断字符串是否结束 GUI_PutChar(bak, bak1, *str++); // 显示标题 bak += 6; } } return(1); }
/* 获取被按下的图标 */ unsigned char menu_select() { unsigned int point[2]; while(1) { T_GetPoint(point); if(point[0]>50&&point[0]<130&&point[1]>80&&point[1]<160) { GUI_Rectangle(50,80,130,160,Red,0); return 1; } if(point[0]>190&&point[0]<270&&point[1]>80&&point[1]<160) { GUI_Rectangle(190,80,270,160,Red,0); return 2; } } }
/**************************************************************************** * 名称:GUI_SMenuDraw() * 功能:显示子菜单,加上边框。 * 入口参数:men 子菜单句柄 * 出口参数:返回0表示操作失败,返回1表示操作成功 ****************************************************************************/ uint8 GUI_SMenuDraw(SMENU *men) { WINDOWS *mwin; uint32 xx, yy; uint8 i; mwin = men->win; /* 判断是否可以显示主菜单 */ if( (mwin->hight)<50 ) return(0); if( (mwin->with)<50 ) return(0); /* 画菜子单项。下拉子菜单,以向左下拉为原则,若右边溢出则以右下拉显示 */ xx = mwin->x; xx += (men->mmenu_no)*MMENU_WIDTH; yy = mwin->y + 22; yy += (men->no) * 11 + 2; if( (xx+SMENU_WIDTH) <= (mwin->x + mwin->with - 1) ) { /* 以左下拉为原则显示子菜单 */ if( (men->mmenu_no) == 0 ) { GUI_RLine(xx+SMENU_WIDTH, mwin->y + 22, yy, disp_color); GUI_HLine(xx, yy, xx+SMENU_WIDTH, disp_color); } else { GUI_Rectangle(xx, mwin->y + 22, xx+SMENU_WIDTH, yy, disp_color); } GUI_HLine(xx+1, mwin->y + 22, xx+MMENU_WIDTH-1, back_color); } else { /* 以右下拉为原则 */ if( (xx+MMENU_WIDTH) == (mwin->x + mwin->with - 1) ) { GUI_RLine(xx-(SMENU_WIDTH-MMENU_WIDTH), mwin->y + 22, yy, disp_color); GUI_HLine(xx-(SMENU_WIDTH-MMENU_WIDTH), yy, xx+MMENU_WIDTH, disp_color); } else { GUI_Rectangle(xx-(SMENU_WIDTH-MMENU_WIDTH), mwin->y + 22, xx+MMENU_WIDTH, yy, disp_color); } GUI_HLine(xx+1, mwin->y + 22, xx+MMENU_WIDTH-1, back_color); xx = xx-(SMENU_WIDTH-MMENU_WIDTH); } /* 显示菜单文字 */ xx++; yy = mwin->y + 22 + 2; for(i=0; i<(men->no); i++) { if( i == (men->state) ) // 判断所选择的菜单项 { /* 显示背景色 */ GUI_RectangleFill(xx, yy, xx+SMENU_WIDTH-2, yy+10, disp_color); /* 显示菜单字符 */ GUI_ExchangeColor(); GUI_PutNoStr(xx+1, yy+1, men->str[i], 8); // 书写子菜单文字 GUI_ExchangeColor(); } else { /* 显示背景色 */ GUI_RectangleFill(xx, yy, xx+SMENU_WIDTH-2, yy+10, back_color); /* 显示菜单字符 */ GUI_PutNoStr(xx+1, yy+1, men->str[i], 8); // 书写子菜单文字 } yy += 11; } return(1); }
void UserGUI_Admin_Task(void) { if (currentTouchedLCD) // LCD is touched { if (TouchX >= 20 && TouchX <= 460 && TouchY >= 165 && TouchY <= 215) { GUI_SetDisplay(currentTouchedLCD); GUI_Rectangle(21, 161, 459, 216, GUI_COLOR_BORDER, 1); GUI_Rectangle(21, 161, 459, 216, GUI_COLOR_BUTTON, 0); GUI_Rectangle(20, 160, 460, 215, GUI_COLOR_BUTTON, 0); GUI_Text_Center(21, 165, 459, 215, "Tving Standard-mode", Arial28R, GUI_COLOR_BUTTON, GUI_COLOR_BORDER); while (LCD1_TOUCH_IRQ || LCD2_TOUCH_IRQ) vTaskDelay(10); GUI_Rectangle(21, 161, 459, 216, GUI_COLOR_BUTTON, 1); GUI_Rectangle(21, 161, 459, 216, GUI_COLOR_BORDER, 0); GUI_Rectangle(20, 160, 460, 215, GUI_COLOR_BORDER, 0); GUI_Text_Center(21, 165, 459, 215, "Tving Standard-mode", Arial28R, GUI_COLOR_TEXT, GUI_COLOR_BUTTON); GUI_SetDisplay(LCD_BOTH); UserGUI_Show(USERGUI_NONBLAST_MAIN); return; } if (TouchX >= 20 && TouchX <= 460 && TouchY >= 240 && TouchY <= 295) { GUI_SetDisplay(currentTouchedLCD); GUI_Rectangle(21, 241, 459, 296, GUI_COLOR_BORDER, 1); GUI_Rectangle(21, 241, 459, 296, GUI_COLOR_BUTTON, 0); GUI_Rectangle(20, 240, 460, 295, GUI_COLOR_BUTTON, 0); GUI_Text_Center(21, 245, 459, 245, "Frigiv bold", Arial28R, GUI_COLOR_BUTTON, GUI_COLOR_BORDER); while (LCD1_TOUCH_IRQ || LCD2_TOUCH_IRQ) vTaskDelay(10); GUI_Rectangle(21, 241, 459, 296, GUI_COLOR_BUTTON, 1); GUI_Rectangle(21, 241, 459, 296, GUI_COLOR_BORDER, 0); GUI_Rectangle(20, 240, 460, 295, GUI_COLOR_BORDER, 0); GUI_Text_Center(21, 245, 459, 245, "Frigiv bold", Arial28R, GUI_COLOR_TEXT, GUI_COLOR_BUTTON); BallControl_ServeBall(); currentTouchedLCD = 0; return; } if (TouchX >= 20 && TouchX <= 460 && TouchY >= 320 && TouchY <= 375) { GUI_SetDisplay(currentTouchedLCD); GUI_Rectangle(21, 320, 459, 376, GUI_COLOR_BORDER, 1); GUI_Rectangle(21, 321, 459, 376, GUI_COLOR_BUTTON, 0); GUI_Rectangle(20, 320, 460, 375, GUI_COLOR_BUTTON, 0); GUI_Text_Center(21, 325, 459, 325, "Reboot", Arial28R, GUI_COLOR_BUTTON, GUI_COLOR_BORDER); while (LCD1_TOUCH_IRQ || LCD2_TOUCH_IRQ) vTaskDelay(10); GUI_Rectangle(21, 320, 459, 376, GUI_COLOR_BUTTON, 1); GUI_Rectangle(21, 321, 459, 376, GUI_COLOR_BORDER, 0); GUI_Rectangle(20, 320, 460, 375, GUI_COLOR_BORDER, 0); GUI_Text_Center(21, 325, 459, 325, "Reboot", Arial28R, GUI_COLOR_TEXT, GUI_COLOR_BUTTON); NVIC_SystemReset(); return; } if (TouchX >= 20 && TouchX <= 460 && TouchY >= 710 && TouchY <= 765) { GUI_SetDisplay(currentTouchedLCD); GUI_Rectangle(21, 711, 459, 766, GUI_COLOR_BORDER, 1); GUI_Rectangle(21, 711, 459, 766, GUI_COLOR_BUTTON, 0); GUI_Rectangle(20, 710, 460, 765, GUI_COLOR_BUTTON, 0); GUI_Text_Center(21, 715, 459, 715, "Tilbage", Arial28R, GUI_COLOR_BUTTON, GUI_COLOR_BORDER); while (LCD1_TOUCH_IRQ || LCD2_TOUCH_IRQ) vTaskDelay(10); GUI_Rectangle(21, 711, 459, 766, GUI_COLOR_BUTTON, 1); GUI_Rectangle(21, 711, 459, 766, GUI_COLOR_BORDER, 0); GUI_Rectangle(20, 710, 460, 765, GUI_COLOR_BORDER, 0); GUI_Text_Center(21, 715, 459, 715, "Tilbage", Arial28R, GUI_COLOR_TEXT, GUI_COLOR_BUTTON); GUI_SetDisplay(LCD_BOTH); UserGUI_Show(USERGUI_MAIN); return; } } currentTouchedLCD = 0; }
void UserGUI_Admin_Show(void) { GUI_SetDisplay(LCD_BOTH); GUI_Clear(GUI_COLOR_BACKGROUND); GUI_DisplayRAW(368, 10, theblast); GUI_Text(20, 35, "Bordfodbold", Arial34R, GUI_COLOR_TEXT, GUI_COLOR_BACKGROUND); GUI_Text(20, 110, "Admin Menu", Arial34R, GUI_COLOR_TEXT, GUI_COLOR_BACKGROUND); GUI_Rectangle(21, 161, 459, 216, GUI_COLOR_BUTTON, 1); GUI_Rectangle(21, 161, 459, 216, GUI_COLOR_BORDER, 0); GUI_Rectangle(20, 160, 460, 215, GUI_COLOR_BORDER, 0); GUI_Text_Center(21, 165, 459, 215, "Tving Standard-mode", Arial28R, GUI_COLOR_TEXT, GUI_COLOR_BUTTON); GUI_Rectangle(21, 241, 459, 296, GUI_COLOR_BUTTON, 1); GUI_Rectangle(21, 241, 459, 296, GUI_COLOR_BORDER, 0); GUI_Rectangle(20, 240, 460, 295, GUI_COLOR_BORDER, 0); GUI_Text_Center(21, 245, 459, 245, "Frigiv bold", Arial28R, GUI_COLOR_TEXT, GUI_COLOR_BUTTON); GUI_Rectangle(21, 320, 459, 376, GUI_COLOR_BUTTON, 1); GUI_Rectangle(21, 321, 459, 376, GUI_COLOR_BORDER, 0); GUI_Rectangle(20, 320, 460, 375, GUI_COLOR_BORDER, 0); GUI_Text_Center(21, 325, 459, 325, "Reboot", Arial28R, GUI_COLOR_TEXT, GUI_COLOR_BUTTON); GUI_DisplayRAW(40, 520, tkj_logo); // Display TKJ Electronics logo GUI_Rectangle(21, 711, 459, 766, GUI_COLOR_BUTTON, 1); GUI_Rectangle(21, 711, 459, 766, GUI_COLOR_BORDER, 0); GUI_Rectangle(20, 710, 460, 765, GUI_COLOR_BORDER, 0); GUI_Text_Center(21, 715, 459, 715, "Tilbage", Arial28R, GUI_COLOR_TEXT, GUI_COLOR_BUTTON); }