码迷,mamicode.com
首页 > 其他好文 > 详细

[ucgui] 对话框6——触屏位置简单例子

时间:2014-08-24 23:34:13      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   io   ar   art   div   log   

>_<:直接调用函数获得触屏位置:

  • xPhys = GUI_TOUCH_GetxPhys(); /* Get the A/D mesurement result in x */
  • yPhys = GUI_TOUCH_GetyPhys(); /* Get the A/D mesurement result in y */

bubuko.com,布布扣

 1 void MainTask_touch(void) {
 2   GUI_Init();
 3   GUI_CURSOR_Show();
 4   GUI_CURSOR_Select(&GUI_CursorCrossL);
 5   GUI_SetBkColor(GUI_WHITE);
 6   GUI_SetColor(GUI_BLACK);
 7   GUI_Clear();
 8   GUI_DispString("Measurement of\nA/D converter values");
 9   while (1) {
10     GUI_PID_STATE TouchState;
11     int xPhys, yPhys;
12     GUI_TOUCH_GetState(&TouchState);  /* Get the touch position in pixel */
13     xPhys = GUI_TOUCH_GetxPhys();     /* Get the A/D mesurement result in x */
14     yPhys = GUI_TOUCH_GetyPhys();     /* Get the A/D mesurement result in y */
15     /* Display the measurement result */
16     GUI_SetColor(GUI_BLUE);
17     GUI_DispStringAt("Analog input:\n", 0, 20);
18     GUI_GotoY(GUI_GetDispPosY() + 2);
19     GUI_DispString("x:");
20     GUI_DispDec(xPhys, 4);
21     GUI_DispString(", y:");
22     GUI_DispDec(yPhys, 4);
23     /* Display the according position */
24     GUI_SetColor(GUI_RED);
25     GUI_GotoY(GUI_GetDispPosY() + 4);
26     GUI_DispString("\nPosition:\n");
27     GUI_GotoY(GUI_GetDispPosY() + 2);
28     GUI_DispString("x:");
29     GUI_DispDec(TouchState.x,4);
30     GUI_DispString(", y:");
31     GUI_DispDec(TouchState.y,4);
32     /* Wait a while */
33     GUI_Delay(100);
34   };
35 }

 

[ucgui] 对话框6——触屏位置简单例子

标签:style   blog   color   os   io   ar   art   div   log   

原文地址:http://www.cnblogs.com/zjutlitao/p/3933639.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!