|
发表于 2014-3-3 11:59:52
|
显示全部楼层
我这跑了下面两个简单的DEMO,没问题啊。
- /*
- *********************************************************************************************************
- *
- * 模块名称 : GUI界面主函数
- * 文件名称 : MainTask.c
- * 版 本 : V1.0
- * 说 明 : 本实验主要是演示填充的多边形的绘制,比较简单,不过多的讲解了
- *
- * 修改记录 :
- * 版本号 日期 作者 说明
- * v1.0 2013-04-17 Eric2013 ST固件库版本 V1.0.2版本。
- *
- *********************************************************************************************************
- */
- #include "includes.h"
- #include "MainTask.h"
- /*******************************************************************
- *
- * Static variables
- *
- ********************************************************************
- */
- static const GUI_POINT _aPointArrow[] = {
- { 0, 0},
- {-40, -30},
- {-10, -20},
- {-10, -70},
- { 10, -70},
- { 10, -20},
- { 40, -30},
- };
- static const GUI_POINT _aPointStar[] = {
- { 0, -36},
- { 8, -8},
- { 36, 0},
- { 8, 8},
- { 0, 36},
- { -8, 8},
- {-36, 0},
- { -8, -8}
- };
- static const GUI_POINT _aPointHexagon[] = {
- { 0, -30},
- { 26, -15},
- { 26, 15},
- { 0, 30},
- {-26, 15},
- {-26, -15},
- };
- /*******************************************************************
- *
- * Static code
- *
- ********************************************************************
- */
- /*******************************************************************
- *
- * _DrawPolygons
- Draws polygons of different shapes and colors
- */
- static void _DrawPolygons(void) {
- int y = 90;
- /* clear display */
- /* 设置了颜色以后需要加清屏指令才有效 */
- GUI_SetBkColor(GUI_BLACK);
- GUI_Clear();
- /* display text */
- GUI_SetColor(GUI_WHITE);
- GUI_SetFont(&GUI_Font24_ASCII);
- GUI_SetTextAlign(GUI_TA_HCENTER);
- GUI_DispStringAt("DrawPolygon - Sample", 160, 5);
- GUI_SetFont(&GUI_Font8x16);
- GUI_DispStringAt("using", 5, 40);
- GUI_DispStringAt("GUI_FillPolygon", 5, 55);
- GUI_SetTextAlign(GUI_TA_HCENTER);
- GUI_DispStringAt("Polygons of arbitrary shape\\nin any color", 160, y + 90);
- GUI_Delay(500);
- /* draw filled polygons */
- while (1) {
- GUI_ClearRect(100, y, 220, y + 85);
- GUI_SetColor(GUI_BLUE);
- GUI_FillPolygon (&_aPointArrow[0], 7, 160, y + 80);
- GUI_Delay(1000);
- GUI_ClearRect(100, y, 220, y + 85);
- GUI_SetColor(GUI_RED);
- GUI_FillPolygon (&_aPointStar[0], 8, 160, y + 45);
- GUI_Delay(1000);
- GUI_ClearRect(100, y, 220, y + 85);
- GUI_SetColor(GUI_GREEN);
- GUI_FillPolygon(&_aPointHexagon[0], 6, 160, y + 45);
- GUI_Delay(1000);
- }
- }
- /*********************************************************************
- *
- * Public code
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * MainTask
- */
- void MainTask(void) {
- GUI_Init();
- _DrawPolygons();
- while (1);
- }
复制代码 |
|