>_<" 这节主要是获取鼠标的位置和把窗口设置为可以移动。其中设置窗口可以移动用FRAMEWIN_SetMoveable(hFrameWin, 1)就行了。而获得鼠标位置则是利用WM_TOUCH消息的state结构体所传送过来的位置信息(见56、57两行)
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAzAAAAIICAIAAAA+NJw4AAAe3klEQVR4nO3dS3AV56Hg8bOeFRWX95kKyVRlP1Wz14aaCVpcBDW5FvbNtS0eNoiHeNgsBpxgXjZG9q08nDgI7FQ5MokhE2NjYhswbwsESDwsiTdGCJPHHbKZqZnSLI50dB7fgZbU3R9Wfl/9ijpqdX9fn9Ms/nV01CrM/pfn/2YYhmEYhmHEG4VZTy0qlI2ZhmEYhmEYRi5jrMBm/2hJKcUaGxtf29bedebSjdt/BQAgI/1Xbu7es6exsXEky/77s23FGnvyyadOnDr/2al+AABycKn/+pNPPjVz5szC3IUvFgqFxsbGE6fOf3Z6AACA3Fzqv97Y2Fh4eumamTNnvvzy5gOnBwAAyNm7775XWLh6zcyZM7vOXDrYfRkAgJwN3btfWLJmzcyZM4fu3T945goAADkbune/sGI0yA6duQIAQM6G7t0vrB4Nss/PXgUAIGdD9+4XXhwNssPnrgEAkLOhe/cLa0aD7EjP9aD/OP17Q4nHB4dO15sHAJjCPj564d+2f/Djre+m69+2f/Dx0QtTaYlaiYJsaGjoQOIxbdq06P8hAID8bfnp+/sPnzvb/1W69h8+t+Wn70+lJWpVBNnR3htBxSDr6OjYPTpu3bo1NNRbUtp+5MiRadOm1ZsHAJjCfrz13e4vb33yRV+6ur+89eOt706lJWpVBNmx8zeDikG2e/fuAwcO/P3vf//+9wuPP15h2rRp06ZNKwVZvXkYj1Mb5zUt68xruQPbn2hcvPHARA/v3NAwb/sfxnfU3mWNG96K/zoDkJqfvPbbs31ffdrVn66zfV/95LXfRlzik66+T7r6Rh/3f9rV/+kXlbr6P+3q+/SL0r/9n3SNfeuTrv5PKpeoVRFkxy/cCioPsuHh3scfLxQKC4s+++w/9PY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iE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJEJMgCAyAQZAEBkggwAIDJBBgAQmSADAIhMkAEARCbIAAAiE2QAAJGFg+xFQQYAkJdwkL0gyAAA8hIOstWCDAAgL+EgWyXIAADyIsgAACITZAAAkQkyAIDIBBkAQGSCDAAgMre9AACITJABAEQmyAAAIhNkAACRCTIAgMgEGQBAZIIMACAyQQYAEJkgAwCIbNx36gcAIGtD9+4XVgoyAIB4hu7dL7QJMgCAeIbu3S8sE2QAAPEM3btfWCLIAADiGbp3v7DoBUEGABDN0L37hYUrRoIMAIAoCvOWrfmBYRiGYRiGEW8Unl2yZubMmUP37n9+9ioAU8DQvfszZ858zzCMb874/yxbMFR8gxVBAAAAAElFTkSuQmCC" alt="" width="583" height="371" />
#define FACTOR 5
#define EYE_X1 18
#define EYE_X2 54
#define EYE_Y 26
#define EYE_RX 16
#define EYE_RY 24
#define MIN_VISIBILITY 50 /* Make sure at least this many pixels stay visible when moved */ static int _Min(int a, int b) {
return (a < b) ? a : b;
}
//画眼睛的函数
static void _DrawEye(int x0, int y0, int rx, int ry, int x1, int y1) {
int dx, dy, x, y;
float Hyp;
GUI_SetColor(GUI_WHITE);
GUI_FillEllipse(x0, y0, rx, ry);
GUI_SetColor(GUI_BLACK);
GUI_DrawEllipse(x0, y0, rx, ry);
/* Calculate the coordinates */
dx = x1 - x0 + ;
dy = y1 - y0 + ;
Hyp = sqrt(dx * dx + dy * dy);
x = (dx * _Min(rx - , abs(dx)) * FACTOR / Hyp) + x0 * FACTOR;
y = (dy * _Min(ry - , abs(dy)) * FACTOR / Hyp) + y0 * FACTOR;
/* Draw the pupil */
GUI_AA_SetFactor(FACTOR);
GUI_AA_EnableHiRes();
GUI_SetColor(0xD00000);
GUI_AA_FillCircle(x, y, 5.75 * FACTOR);
GUI_SetColor(GUI_BLACK);
GUI_AA_FillCircle(x, y, 3.75 * FACTOR);
GUI_SetColor(GUI_GRAY);
GUI_AA_FillCircle(x - 1.25 * FACTOR, y - 1.25 * FACTOR, 1.25 * FACTOR);
GUI_AA_DisableHiRes();
}
//窗口消息回调函数
static void _cbTransWindow(WM_MESSAGE* pMsg) {
WM_HWIN hWin = pMsg->hWin;
GUI_PID_STATE State;
GUI_PID_GetState(&State);
switch (pMsg->MsgId) {
case WM_PAINT:
State.x -= WM_GetWindowOrgX(hWin);//分别返回指定窗口的原点在桌面坐标中的X或Y位置
State.y -= WM_GetWindowOrgY(hWin);
_DrawEye(EYE_X1, EYE_Y, EYE_RX, EYE_RY, State.x, State.y);
_DrawEye(EYE_X2, EYE_Y, EYE_RX, EYE_RY, State.x, State.y);
break;
case WM_TOUCH:
if (pMsg->Data.p) {
GUI_PID_STATE* pState = (GUI_PID_STATE*)pMsg->Data.p;
if (pState->Pressed) {
int mx, my, x;
I32 Sum, SumY;
I32 OutConst = EYE_RX * EYE_RX * EYE_RY * EYE_RY + (EYE_RX * EYE_RX * EYE_RY >> );
mx = pState->x;
my = (pState->y < EYE_Y) ? (EYE_Y - pState->y) : (pState->y - EYE_Y);
if (my >= && my <= EYE_RY) {
int y;
x = EYE_RX;
for (y = ; y <= my; y++) {
SumY =((I32)(EYE_RX * EYE_RX)) * ((I32)(y * y));
while (Sum = SumY + ((I32)(EYE_RY * EYE_RY)) * ((I32)(x * x)), (x > ) && (Sum > OutConst)) {
x--;
}
}
} else {
x = -EYE_RX;
}
if (((mx >= EYE_X1 - x) && (mx <= EYE_X1 + x)) ||
((mx >= EYE_X2 - x) && (mx <= EYE_X2 + x)) || WM_HasCaptured(hWin))
{
WM_SetCaptureMove(hWin, pState, MIN_VISIBILITY);
} else {
/* Transfer the message to the underlying window, since the transparent area has been clicked. */
WM_HWIN hBelow = WM_Screen2hWinEx(hWin, State.x, State.y);
if (hBelow) {
pState->x = State.x - WM_GetWindowOrgX(hBelow);
pState->y = State.y - WM_GetWindowOrgY(hBelow);
WM_SendMessage(hBelow, pMsg);
}
}
}
}
break;
default:
WM_DefaultProc(pMsg);
}
}
//界面创建函数
static void _DemoTransWindow(void) {
WM_HWIN hTransWin, hFrameWin;
WM_SetCreateFlags(WM_CF_MEMDEV);
WM_EnableMemdev(WM_HBKWIN);
WM_SetDesktopColor(GUI_RED);
hTransWin = WM_CreateWindow(, , , , WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_STAYONTOP,
&_cbTransWindow, );
hFrameWin = FRAMEWIN_Create("Framewin", , WM_CF_SHOW, , , , ); //创建一个FRAMEWIN小工具。(弃用)
FRAMEWIN_SetActive(hFrameWin, ); //设置框架窗口的状态。(弃用)
FRAMEWIN_SetMoveable(hFrameWin, ); //窗口可移动函数
GUI_CURSOR_Show();
while () {
WM_InvalidateWindow(hTransWin); //使窗口无效。
GUI_Delay();
}
}
//主函数
void MainTask_eye(void) {
GUI_Init();
_DemoTransWindow();
}