这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » [求助]WindML中的文本显示

共2条 1/1 1 跳转至

[求助]WindML中的文本显示

菜鸟
2006-04-29 01:50:38     打赏

各位蝈蝈,小弟自己编了一段小程序,但Build后总报错:

ccsimpc -g -mpentium -ansi -fno-builtin -fno-defer-pop -I. -IF:\tornado2.2\target\h\ -DCPU
=SIMNT -DTOOL_FAMILY=gnu -DTOOL=gnu -c ..\1.c
..\1.c: In function `DrawDashBoard':
..\1.c:88: parse error before `char'
..\1.c:102: warning: `return' with a value, in function returning void
..\1.c:147: `keyText' undeclared (first use in this function)
..\1.c:147: (Each undeclared identifier is reported only once
..\1.c:147: for each function it appears in.)
..\1.c:147: `px' undeclared (first use in this function)
..\1.c:148: `textWidth' undeclared (first use in this function)
..\1.c:148: `textHeight' undeclared (first use in this function)
..\1.c:151: `py' undeclared (first use in this function)
make: *** [1.o] Error 0x1

Done.
下面是源程序,请蝈蝈们指点一下是怎么回事哈

#include <stdio.h>
#include <ugl/ugl.h>
#include <ugl/uglos.h>
#include <ugl/uglinput.h>
#include <ugl/uglucode.h>
#include <ugl/uglfont.h>
#include <ugl/uglMsg.h>
#include <math.h>


UGL_LOCAL UGL_INPUT_SERVICE_ID inputServiceId;
UGL_LOCAL int displayHeight, displayWidth;

UGL_GC_ID gc;
UGL_FONT_DRIVER_ID fontDrvId;
UGL_FONT_ID fontBanner;
UGL_FONT_DEF fontDef;
UGL_ORD textOrigin;
UGL_MODE_INFO modeInfo;
UGL_DEVICE_ID devId;

UGL_LOCAL struct _colorStruct
{
UGL_ARGB rgbColor;
UGL_COLOR uglColor;
}
colorTable[] =
{
{ UGL_MAKE_ARGB(0xff, 0, 0, 0), 0}, /* The color table uses ARGB's */
{ UGL_MAKE_ARGB(0xff, 0, 0, 168), 0}, /* (see uglColorAlloc). */
{ UGL_MAKE_ARGB(0xff, 0, 168, 0), 0}, /* Initialize alpha to 255 for */
{ UGL_MAKE_ARGB(0xff, 0, 168, 168), 0},/* now (opaque). */

{ UGL_MAKE_RGB(168, 0, 0), 0}, /* UGL_MAKE_RGB takes care of */
{ UGL_MAKE_RGB(168, 0, 168), 0}, /* the alpha for us. */
{ UGL_MAKE_RGB(168, 84, 0), 0},
{ UGL_MAKE_RGB(168, 168, 168), 0},

{ UGL_MAKE_RGB(84, 84, 84), 0},
{ UGL_MAKE_RGB(84, 84, 255), 0},
{ UGL_MAKE_RGB(84, 255, 84), 0},
{ UGL_MAKE_RGB(84, 255, 255), 0},

{ UGL_MAKE_RGB(255, 84, 84), 0},
{ UGL_MAKE_RGB(255, 84, 255), 0},
{ UGL_MAKE_RGB(255, 255, 84), 0},
{ UGL_MAKE_RGB(255, 255, 255), 0}
};


#define BLACK (0)
#define BLUE (1)
#define GREEN (2)
#define CYAN (3)
#define RED (4)
#define MAGENTA (5)
#define BROWN (6)
#define LIGHTGRAY (7)
#define DARKGRAY (8)
#define LIGHTBLUE (9)
#define LIGHTGREEN (10)
#define LIGHTCYAN (11)
#define LIGHTRED (12)
#define LIGHTMAGENTA (13)
#define YELLOW (14)
#define WHITE (15)

#define PI 3.1415926


/*
*DrawDashBoard() Draw the background, it includes the prompt for the keyboard input,
* the status of the TCAS and the background of the appearance rings.
*/

void DrawDashBoard(int TCASStadus)
{
/*Initializing UGL.*/
uglInitialize();
devId = (UGL_DEVICE_ID)uglRegistryFind (UGL_DISPLAY_TYPE, 0, 0,0)->id;
inputServiceId = (UGL_INPUT_SERVICE_ID)uglRegistryFind (UGL_INPUT_SERVICE_TYPE, 0, 0,0)->id;
fontDrvId = (UGL_FONT_DRIVER_ID)uglRegistryFind (UGL_FONT_ENGINE_TYPE, 0, 0,0)->id;
uglInfo(devId, UGL_MODE_INFO_REQ, &modeInfo);
displayWidth = modeInfo.width;
displayHeight = modeInfo.height;
gc = uglGcCreate(devId);

char keyText[10];
UGL_SIZE textWidth, textHeight;
int px=10;
int py=10;


/*Initializing the font*/
textOrigin = UGL_FONT_TEXT_UPPER_LEFT;
uglFontDriverInfo(fontDrvId, UGL_FONT_TEXT_ORIGIN, &textOrigin);

uglFontFindString(fontDrvId, "familyName=Lucida;pixelSize=14", &fontDef);
if ((fontBanner = uglFontCreate(fontDrvId, &fontDef)) == UGL_NULL)
{
printf("Font not found. Exiting.\n");
return(0);
}


/*Initializating the color */
uglColorAlloc(devId, &colorTable[BLACK].rgbColor, UGL_NULL,
&colorTable[BLACK].uglColor, 1);
uglColorAlloc(devId, &colorTable[BLUE].rgbColor, UGL_NULL,
&colorTable[BLUE].uglColor, 1);
uglColorAlloc(devId, &colorTable[GREEN].rgbColor, UGL_NULL,
&colorTable[GREEN].uglColor, 1);
uglColorAlloc(devId, &colorTable[CYAN].rgbColor, UGL_NULL,
&colorTable[CYAN].uglColor, 1);

uglColorAlloc(devId, &colorTable[RED].rgbColor, UGL_NULL,
&colorTable[RED].uglColor, 1);
uglColorAlloc(devId, &colorTable[MAGENTA].rgbColor, UGL_NULL,
&colorTable[MAGENTA].uglColor, 1);
uglColorAlloc(devId, &colorTable[BROWN].rgbColor, UGL_NULL,
&colorTable[BROWN].uglColor, 1);
uglColorAlloc(devId, &colorTable[LIGHTGRAY].rgbColor, UGL_NULL,
&colorTable[LIGHTGRAY].uglColor, 1);

uglColorAlloc(devId, &colorTable[DARKGRAY].rgbColor, UGL_NULL,
&colorTable[DARKGRAY].uglColor, 1);
uglColorAlloc(devId, &colorTable[LIGHTBLUE].rgbColor, UGL_NULL,
&colorTable[LIGHTBLUE].uglColor, 1);
uglColorAlloc(devId, &colorTable[LIGHTGREEN].rgbColor, UGL_NULL,
&colorTable[LIGHTGREEN].uglColor, 1);
uglColorAlloc(devId, &colorTable[LIGHTCYAN].rgbColor, UGL_NULL,
&colorTable[LIGHTCYAN].uglColor, 1);

uglColorAlloc(devId, &colorTable[RED].rgbColor, UGL_NULL,
&colorTable[LIGHTRED].uglColor, 1);
uglColorAlloc(devId, &colorTable[LIGHTMAGENTA].rgbColor, UGL_NULL,
&colorTable[LIGHTMAGENTA].uglColor, 1);
uglColorAlloc(devId, &colorTable[YELLOW].rgbColor, UGL_NULL,
&colorTable[YELLOW].uglColor, 1);
uglColorAlloc(devId, &colorTable[WHITE].rgbColor, UGL_NULL,
&colorTable[WHITE].uglColor, 1);



uglBatchEnd(gc);
uglFontSet(gc, fontBanner);

sprintf(keyText,"%d",px);
uglTextSizeGet(fontBanner,&textWidth, &textHeight, -1, keyText);
uglBackgroundColorSet(gc, colorTable[BLACK].uglColor);
uglForegroundColorSet(gc, colorTable[GREEN].uglColor);
uglTextDraw(gc, px-5, py+23, -1, keyText);
uglBatchEnd(gc);
}




关键词: 求助     WindML     中的     文本     显示     devId         

菜鸟
2006-04-29 18:04:00     打赏
2楼
各位蝈蝈,怎么没有人回啊,小弟在这儿等了

共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]