⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wexdbuf.c

📁 2410/vxworks/tornado下的基本实验包括 serial,ramdrv,interrupt,multi-FTP,TCP,UDP-Under the basic experimental
💻 C
📖 第 1 页 / 共 2 页
字号:
/* wexdbuf.c - WindML double buffering example program *//* Copyright 2000 - 2003 Wind River Systems, Inc. All Rights Reserved *//*modification history--------------------01m,08may03,jlb  Remove UGL_LOCAL on function prototype01l,16apr03,jlb  Improved comments and program documentation01k,01apr03,sts  [SPR 86504] Use uglRegistryFind() safely.01j,22feb02,msr  Backward compatibility for input API.01i,05nov01,gav  Fixed misnamed devIds01h,05nov01,gav  Change to new registry01g,05nov01,gav  Change to new registry01f,09oct01,msr  Ported to new UGL_Q_EVENT architecture.01e,30nov00,gav  Made message to fit on small screens.01d,16nov00,msr  Fixed SPR #6205101c,27oct00,rfm  Added stdio usage01b,26oct00,rfm  Modified entry point01a,25oct00,rfm  Fixed restart problem*//*DESCRIPTION This example program demonstrates how to perform simple double buffering. To start the example: -> ld < wexdbuf_ugl.o -> wexdbuf  Press a key or mouse button to cause the test to toggle  between double buffering on or double buffering off. To shut down the double buffering test program, type the  following: -> wexdbufStop**************************************************************//* This is included for VxWorks taskDelay and taskSpawn. */#include <vxWorks.h>#include <sysLib.h>/* This is included for a printf prototype. */#include <stdio.h>/* Include the UGL header file to use UGL functions, etc.  *//* The DIB header has defines specific to the use of DIBs. */#include <ugl/ugl.h>#include <ugl/uglos.h>#include <ugl/uglMsg.h>#include <ugl/uglfont.h>#include <ugl/uglinput.h>/* A forward declaration for this program. */void windMLExampleDBuf ();/* Global variables *//* Control variable to signal when to stop program */UGL_LOCAL volatile UGL_BOOL stopWex;/* Some graphics environment information */UGL_LOCAL int displayHeight, displayWidth;UGL_LOCAL UGL_GC_ID gc;UGL_LOCAL UGL_FONT_ID font;UGL_LOCAL UGL_INPUT_SERVICE_ID inputServiceId;/** The color table is where we define the colors we want* to have available.  The format is an array of* ARGB values paired with their allocated uglColor.  As* of this writing, we don't need to worry about Alpha* ("A") values unless we are using video.*/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)/**************************************************************************** getInput - get input from keyboard/pointer** This routine reads input from the keyboard/pointer. ** RETURNS: 1 when a keyboard key was depressed or a pointer button clicked;*          otherwise 0** ERRNO: N/A** SEE ALSO:  ** NOMANUAL**/UGL_LOCAL int getInput(void)    {    UGL_MSG msg;    UGL_STATUS status;    int retVal = 0;    status = uglInputMsgGet (inputServiceId, &msg, UGL_NO_WAIT);    while (status != UGL_STATUS_Q_EMPTY)	{        if ((msg.type == MSG_KEYBOARD &&              (msg.data.keyboard.modifiers & UGL_KBD_KEYDOWN)) ||            (msg.type == MSG_POINTER &&             (msg.data.pointer.buttonChange &              msg.data.pointer.buttonState)))	    retVal = 1;	status = uglInputMsgGet (inputServiceId, &msg, UGL_NO_WAIT);	}    return(retVal);    }/**************************************************************************** wexdbuf - demonstrate double buffering ** This routine demonstrates the methods to use double buffering to minimize* flicker when a WindML application has a display that is animated.** This example program demonstrates how to:**\ml *\m Initialize WindML*\m Identify the graphics and input devices*\m Create fonts*\m Create a graphics context and allocate colors that are to be used*\m Query the graphics device to determine if the driver supports double buffering*\m Create an offscreen page to draw*\m Drawing to the off screen page*\m Switching the off screen an on screen page*\m Release resources and terminate the WindML application.*\me*** The program accepts input from both the keyboard and the pointer.  Whenever a key* is depressed or a pointer button is clicked the double buffering is toggled between* enabled and disabled to illustrate the effects of double buffering on the updates* to an animated display.** RETURNS: ** ERRNO: N/A** SEE ALSO: wexdbufStop() **/void wexdbuf (void)    {    stopWex = UGL_FALSE;    printf("To stop wexdbuf, type 'wexdbufStop'\n");    uglOSTaskCreate("tWindMLDBuf", (UGL_FPTR)windMLExampleDBuf, 110, 		    0, 10240, 0,0,0,0,0);    }/**************************************************************************** wexdbufStop - stop the double buffering example program** This routine causes the double buffering example program to terminate.** RETURNS: ** ERRNO: N/A** SEE ALSO:  wexdbuf()**/void wexdbufStop (void)    {    stopWex = UGL_TRUE;    }/**************************************************************************** windMLExampleDBuf - set up demo program for double buffering** This routine initializes the graphics device and input device.  The * graphics device is queried to determine if double buffering is supported* and if it is supported a bouncing ball is drawn to the display with and* without double buffering to demonstrate the process to use double buffering.* Double buffering is enabled/disabled by entering a key or clicking a* pointer button.** RETURNS: ** ERRNO: N/A** SEE ALSO:  ** NOMANUAL**/void windMLExampleDBuf (void)    {    UGL_REG_DATA *pRegistryData;    UGL_FONT_DRIVER_ID fontDrvId;    UGL_FONT_DEF fontDef;    UGL_PAGE_ID page[2];    UGL_FB_INFO fbInfo;    int textWidth, textHeight;    char * message0 = "Double Buffering ON. Press any key or mouse button to turn off.";    char * message1 = "Double Buffering Off. Press any key or mouse button to turn on.";    char * errorMessage0 = "Double Buffering not supported by this";    char * errorMessage1 = "driver. Press any key or mouse button.";    /*     * This structure is filled in with data about the frame buffer    * by the uglInfo() function.    */        UGL_MODE_INFO modeInfo;    /*    * The device ID is critical to the operation of UGL.  It    * identifies individual "devices" (display adapter, keyboard,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -