?? guidemo_memdevb.c
字號:
/*************************************************************************************************************
uC/GUI
嵌入式通用圖形軟件
File : GUIDEMO_MemDevB.c
Purpose : Memory device demo
*************************************************************************************************************/
#include "GUI.H"
#include "GUIDEMO.H"
#include "WM.h"
#include "stdio.h"
#if GUI_SUPPORT_MEMDEV
/*************************************************************************************************************
* Static data
*************************************************************************************************************/
static const GUI_POINT _aArrow[] = {
{ 0, 0 +85},
{-40, -35 +85},
{-10, -25 +85},
{-10, -85 +85},
{ 10, -85 +85},
{ 10, -25 +85},
{ 40, -35 +85}
};
/* Define the callback structure. The structure should contain all the data
required by the callback drawing funtion
*/
typedef struct {
int Angle;
int DoClear;
} tDrawContext;
/*************************************************************************************************************
* Static functions
*************************************************************************************************************/
/* The user defined callback routine */
static void _Draw(void * p) {
int XSize = LCD_GetXSize();
int YSize = LCD_GetYSize();
tDrawContext * pContext = (tDrawContext *)p;
int i = pContext->Angle;
static int iLast = -1;
static GUI_POINT aPoint[7];
if (pContext->DoClear)
GUI_Clear();
GUI_SetFont(&GUI_FontD24x32);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetColor(GUI_GRAY);
GUI_SetFont(&GUI_FontComic18B_1);
GUI_DispStringHCenterAt("Below arrow", XSize / 2, YSize / 2 - 20);
if (iLast != i) {
float Angle = 0.02 * (float)i;
iLast = i;
GUI_RotatePolygon(aPoint, _aArrow, 7, Angle);
}
GUI_SetColor(GUI_WHITE);
GUI_FillPolygon(&aPoint[0], 7, XSize / 2, YSize / 2 + 30);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetColor(GUI_DARKGRAY);
GUI_SetFont(&GUI_FontComic18B_1);
GUI_DispStringHCenterAt("Above arrow", XSize / 2, YSize / 2);
}
/*************************************************************************************************************
* GUIDEMO_ShowMemoryDevice
*************************************************************************************************************/
void GUIDEMO_ShowMemoryDevice(void) {
int i, tDiff, t0;
tDrawContext DrawContext;
GUI_COLOR colorBack;
GUI_RECT rView, rPrev, rTemp;
GUIDEMO_ShowIntro("Memory devices",
"For flicker free animation"
"\nand other purposes");
GUIDEMO_NotifyStartNext();
GUI_SetBkColor(GUI_GREEN);
GUI_Clear();
/* Use banding memory device */
GUI_GetClientRect(&rView);
colorBack = GUI_ColorIsAvailable(GUI_RED) ? GUI_RED : GUI_BLACK;
GUI_SetBkColor(colorBack);
GUI_Clear();
t0 = GUI_GetTime();
for (i = 0; tDiff = GUI_GetTime() - t0, (tDiff < 8000) && !GUIDEMO_CheckCancel(); i++) {
DrawContext.Angle = 90 + tDiff / 50;
/* Calculate required size */
{
GUI_HMEM hMem = GUI_MEASDEV_Create();
GUI_MEASDEV_Select(hMem);
DrawContext.DoClear = 0;
_Draw(&DrawContext);
GUI_MEASDEV_GetRect(hMem, &rView);
GUI_MEASDEV_Delete(hMem);
rTemp = rView;
if (i)
GUI_MergeRect(&rView, &rView, &rPrev);
rPrev = rTemp;
}
DrawContext.DoClear = 1;
GUI_MEMDEV_Draw(&rView, _Draw, &DrawContext, 0, GUI_MEMDEV_NOTRANS);
}
GUI_SetFont(&GUI_FontComic24B_ASCII);
GUI_SetColor(GUI_WHITE);
GUI_DispStringAt("ms/Update: ", 10 , 200);
if (i) {
GUI_DispDecMin(tDiff / i);
}
GUIDEMO_Delay(1000);
GUI_Clear();
}
#else
void GUIDEMO_ShowMemoryDevice(void) {}
#endif /* GUI_SUPPORT_MEMDEV */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -