编写了一个显示字体的程序,但无论在vxsim上还是目标机上都显示不出来,附上代码,
请各位帮忙指点指点……
搞了好长时间了,编译下载都没有问题,但显示的仍就是一如既往的漆黑……现在搞的
我眼圈也要黑了……
百思不得其解啊,之前有大侠告知的前后景色设置的问题,改了好几种组合仍是不见起
色……
忘各位大侠给在黑暗中的小弟我以指点!不胜感激!
UGL_DEVICE_ID devId;
UGL_GC_ID gc;
void progstart(void)
{
UGL_FONT_DRIVER_ID fontDrvId;
UGL_FONT_DEF fontDef;
UGL_FONT_ID fontBanner;
UGL_LOCAL UGL_CHAR *text = "WindML text example.";
if (uglInitialize() == UGL_STATUS_ERROR)
{
printf("error when initializing!\n");
exit (1);
}
gc = uglGcCreate(devId);
uglDriverFind(UGL_DISPLAY_TYPE, 0, (UGL_UINT32 *)&devId);
uglDriverFind(UGL_FONT_ENGINE_TYPE, 0, (UGL_UINT32*)&fontDrvId);
if(uglFontFindString(fontDrvId, "familyName=Courier", &fontDef) ==
UGL_STATUS_ERROR)
printf("\nBanner's uglFontFindString failed.\n");
if ((fontBanner = uglFontCreate(fontDrvId, &fontDef)) == UGL_NULL)
{
printf("Font not found. Exiting.\n");
exit (1);
}
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[LIGHTRED].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);
printf("after color!\n");
uglBatchStart(gc);
uglBackgroundColorSet(gc, colorTable[BLACK].uglColor);
uglForegroundColorSet(gc, colorTable[WHITE].uglColor);
uglLine(gc, 200,0,200,200);
uglBatchEnd(gc);
printf("after line!\n");
uglBatchStart(gc);
uglBackgroundColorSet(gc, colorTable[BLUE].uglColor);
uglForegroundColorSet(gc, colorTable[WHITE].uglColor);
uglFontSet(gc, fontBanner);
uglTextDraw(gc, 0, 0, -1, text);
uglBatchEnd(gc);
printf("after textdraw!\n");
}