本文整理汇总了C++中GrStringDrawCentered函数的典型用法代码示例。如果您正苦于以下问题:C++ GrStringDrawCentered函数的具体用法?C++ GrStringDrawCentered怎么用?C++ GrStringDrawCentered使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GrStringDrawCentered函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DisplayIntStatus
//*****************************************************************************
//
// Display the interrupt state on the display. The currently active and pending
// interrupts are displayed.
//
//*****************************************************************************
void
DisplayIntStatus(void)
{
uint32_t ui32Temp;
char pcBuffer[6];
//
// Display the currently active interrupts.
//
ui32Temp = HWREG(NVIC_ACTIVE0);
pcBuffer[0] = ' ';
pcBuffer[1] = (ui32Temp & 1) ? '1' : ' ';
pcBuffer[2] = (ui32Temp & 2) ? '2' : ' ';
pcBuffer[3] = (ui32Temp & 4) ? '3' : ' ';
pcBuffer[4] = ' ';
pcBuffer[5] = '\0';
GrStringDrawCentered(&g_sContext, pcBuffer, -1, 130, 150, 1);
//
// Display the currently pending interrupts.
//
ui32Temp = HWREG(NVIC_PEND0);
pcBuffer[1] = (ui32Temp & 1) ? '1' : ' ';
pcBuffer[2] = (ui32Temp & 2) ? '2' : ' ';
pcBuffer[3] = (ui32Temp & 4) ? '3' : ' ';
GrStringDrawCentered(&g_sContext, pcBuffer, -1, 270, 150, 1);
//
// Flush the display.
//
GrFlush(&g_sContext);
}
示例2: WatchdogTouchCallback
//*****************************************************************************
//
// The touch screen driver calls this function to report all state changes.
//
//*****************************************************************************
static long
WatchdogTouchCallback(unsigned long ulMessage, long lX, long lY)
{
//
// If the screen is tapped, we will receive a PTR_DOWN then a PTR_UP
// message. We pick one (pretty much at random) to use as the trigger to
// stop feeding the watchdog.
//
if(ulMessage == WIDGET_MSG_PTR_UP)
{
//
// Let the user know that the tap has been registered and that the
// watchdog is being starved.
//
GrContextFontSet(&g_sContext, g_pFontCmss20);
GrStringDrawCentered(&g_sContext, "Watchdog is not being fed!", -1,
GrContextDpyWidthGet(&g_sContext) / 2 ,
(GrContextDpyHeightGet(&g_sContext) / 2), 1);
GrContextFontSet(&g_sContext, g_pFontCmss14);
GrStringDrawCentered(&g_sContext,
" System will reset shortly. ",
-1, GrContextDpyWidthGet(&g_sContext) / 2 ,
(GrContextDpyHeightGet(&g_sContext) / 2) + 20, 1);
//
// Set the flag that tells the interrupt handler not to clear the
// watchdog interrupt.
//
g_bFeedWatchdog = false;
}
return(0);
}
示例3: drawGridTime
static void drawGridTime(tContext *pContext)
{
char buf[20];
uint8_t time[3];
time[0] = workout_time % 60;
time[1] = (workout_time / 60 ) % 60;
time[2] = workout_time / 3600;
GrContextForegroundSet(pContext, ClrBlack);
switch(window_readconfig()->sports_grid)
{
case GRID_3:
GrContextFontSet(pContext, (tFont*)&g_sFontExIcon16);
GrStringDraw(pContext, "i", 1, 10, 15, 0);
GrContextFontSet(pContext, &g_sFontGothic18);
GrStringDraw(pContext, datapoints[0].name, -1, 28, 15, 0);
GrContextFontSet(pContext, &g_sFontGothic28b);
sprintf(buf, "%02d:%02d:%02d", time[2], time[1], time[0]);
GrStringDrawCentered(pContext, buf, -1, LCD_WIDTH/2, 50, 0);
break;
case GRID_4:
case GRID_5:
GrContextFontSet(pContext, &g_sFontGothic28b);
sprintf(buf, "%02d:%02d:%02d", time[2], time[1], time[0]);
GrStringDrawCentered(pContext, buf, -1, LCD_WIDTH/2, 18, 0);
break;
}
}
示例4: SelectButtonPressed
//*****************************************************************************
//
// This function is called when the select button is pressed.
//
//*****************************************************************************
static int32_t
SelectButtonPressed(void)
{
//
// Find the X center of the display
//
int32_t i32CenterX = GrContextDpyWidthGet(&g_sContext) / 2;
//
// Let the user know that the button has been pressed and that the
// watchdog is being starved.
//
GrStringDrawCentered(&g_sContext, "Starving", -1, i32CenterX, 14, 1);
GrStringDrawCentered(&g_sContext, "Watchdog", -1, i32CenterX, 24, 1);
GrStringDrawCentered(&g_sContext, "System", -1, i32CenterX, 36, 1);
GrStringDrawCentered(&g_sContext, " will ", -1, i32CenterX, 46, 1);
GrStringDrawCentered(&g_sContext, "reset ...", -1, i32CenterX, 56, 1);
//
// Set the flag that tells the interrupt handler not to clear the
// watchdog interrupt.
//
g_bFeedWatchdog = false;
return(0);
}
示例5: Timer1IntHandler
void Timer1IntHandler(void)
{
//debugled(10);
ROM_TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT);
//debugled(3);
int angle=0;
if(max2>0 && max1>0 && abs(maxi1-maxi2)<PULSE_SAMPLE)
{
//float dt=abs(maxi1-maxi2)/SAMPLING_FREQUENCY;
//angle=asin(dt*lambda/distance)*180/3.1412;
angle=abs(maxi1-maxi2);
}
//debugled(3);
acount++;
//rcount=0;
//ROM_IntMasterDisable();
snprintf(text,sizeof(text),"%3ld,%3ld",rcount,g_ulADCCount);
GrContextForegroundSet(&sDisplayContext, ClrDarkBlue);
GrRectFill(&sDisplayContext, &sRect1);
GrContextForegroundSet(&sDisplayContext, ClrWhite);
//GrRectDraw(&sDisplayContext, &sRect1);
GrContextFontSet(&sDisplayContext, g_pFontCm12);
GrStringDrawCentered(&sDisplayContext,text, -1,
GrContextDpyWidthGet(&sDisplayContext) / 2, 10, 0);
GrContextForegroundSet(&sDisplayContext, ClrDarkBlue);
GrRectFill(&sDisplayContext, &sRect2);
GrContextForegroundSet(&sDisplayContext, ClrWhite);
sprintf(text,"%4d,%4d",buffer_increment,rem);
GrContextFontSet(&sDisplayContext, g_pFontCm12/*g_pFontFixed6x8*/);
GrStringDrawCentered(&sDisplayContext, text, -1,
GrContextDpyWidthGet(&sDisplayContext) / 2,
((GrContextDpyHeightGet(&sDisplayContext) - 24) / 2) + 24,
0);
// GrFlush(&sDisplayContext);
max1=0;
max2=0;
res=0;
res1=0;
maxi1=0;
maxi2=0;
buffer_index=0;
for(i=0;i<buffer_size;i++)
{
buffer[0][i]=0;
buffer[1][i]=0;
}
i=0;
j=0;
ind2=buffer_index-buffer_increment+1;
}
示例6: PrintSettings_DateTime_NotAllowed
void PrintSettings_DateTime_NotAllowed(tContext *context) {
GrStringDrawCentered(context, "Cannot edit", AUTO_STRING_LENGTH, 47, 27, OPAQUE_TEXT);
GrStringDrawCentered(context, "while insulin", AUTO_STRING_LENGTH, 47, 38, OPAQUE_TEXT);
GrStringDrawCentered(context, "delivery is", AUTO_STRING_LENGTH, 47, 49, OPAQUE_TEXT);
GrStringDrawCentered(context, "in progress", AUTO_STRING_LENGTH, 47, 60, OPAQUE_TEXT);
LoadMiddleButton( context , "OK");
}
示例7: DrawToggle
//*****************************************************************************
//
// Draws a toggle button.
//
//*****************************************************************************
void
DrawToggle(const tButtonToggle *psButton, bool bOn)
{
tRectangle sRect;
int16_t i16X, i16Y;
//
// Copy the data out of the bounds of the button.
//
sRect = psButton->sRectButton;
GrContextForegroundSet(&g_sContext, ClrLightGrey);
GrRectFill(&g_sContext, &psButton->sRectContainer);
//
// Copy the data out of the bounds of the button.
//
sRect = psButton->sRectButton;
GrContextForegroundSet(&g_sContext, ClrDarkGray);
GrRectFill(&g_sContext, &psButton->sRectButton);
if(bOn) {
sRect.i16XMin += 2;
sRect.i16YMin += 2;
sRect.i16XMax -= 15;
sRect.i16YMax -= 2;
} else {
sRect.i16XMin += 15;
sRect.i16YMin += 2;
sRect.i16XMax -= 2;
sRect.i16YMax -= 2;
}
GrContextForegroundSet(&g_sContext, ClrLightGrey);
GrRectFill(&g_sContext, &sRect);
GrContextFontSet(&g_sContext, &g_sFontCm16);
GrContextForegroundSet(&g_sContext, ClrBlack);
GrContextBackgroundSet(&g_sContext, ClrLightGrey);
i16X = sRect.i16XMin + ((sRect.i16XMax - sRect.i16XMin) / 2);
i16Y = sRect.i16YMin + ((sRect.i16YMax - sRect.i16YMin) / 2);
if(bOn) {
GrStringDrawCentered(&g_sContext, psButton->pcOn, -1, i16X, i16Y,
true);
} else {
GrStringDrawCentered(&g_sContext, psButton->pcOff, -1, i16X, i16Y,
true);
}
if(psButton->pcLabel) {
GrStringDraw(&g_sContext, psButton->pcLabel, -1,
psButton->sRectButton.i16XMax + 2,
psButton->sRectButton.i16YMin + 6,
true);
}
}
示例8: WatchdogTouchCallback
//*****************************************************************************
//
// The touch screen driver calls this function to report all state changes.
//
//*****************************************************************************
static int32_t
WatchdogTouchCallback(uint32_t ui32Message, int32_t i32X, int32_t i32Y)
{
//
// If the screen is tapped, we will receive a PTR_DOWN then a PTR_UP
// message. Use PTR_UP as the trigger to stop feeding the watchdog.
//
if(ui32Message == WIDGET_MSG_PTR_UP)
{
//
// See if the left or right side of the screen was touched.
//
if(i32X <= (GrContextDpyWidthGet(&g_sContext) / 2))
{
//
// Let the user know that the tap has been registered and that the
// watchdog0 is being starved.
//
GrContextFontSet(&g_sContext, g_psFontCmss20);
GrContextForegroundSet(&g_sContext, ClrRed);
GrStringDrawCentered(&g_sContext,
"Watchdog 0 starved, reset shortly", -1,
GrContextDpyWidthGet(&g_sContext) / 2 ,
(GrContextDpyHeightGet(&g_sContext) / 2) + 40,
1);
GrContextForegroundSet(&g_sContext, ClrWhite);
//
// Set the flag that tells the interrupt handler not to clear the
// watchdog0 interrupt.
//
g_bFeedWatchdog0 = false;
}
else
{
//
// Let the user know that the tap has been registered and that the
// watchdog1 is being starved.
//
GrContextFontSet(&g_sContext, g_psFontCmss20);
GrContextForegroundSet(&g_sContext, ClrRed);
GrStringDrawCentered(&g_sContext,
"Watchdog 1 starved, reset shortly", -1,
GrContextDpyWidthGet(&g_sContext) / 2 ,
(GrContextDpyHeightGet(&g_sContext) / 2) + 60,
1);
GrContextForegroundSet(&g_sContext, ClrWhite);
//
// Set the flag that tells the interrupt handler not to clear the
// watchdog1 interrupt.
//
g_bFeedWatchdog1 = false;
}
}
return(0);
}
示例9: CenteredStringWithShadow
//*****************************************************************************
//
// Draw a string with a white drop shadow at a give position on the display.
//
//*****************************************************************************
void
CenteredStringWithShadow(const tFont *pFont, char *pcString, short sX, short sY,
tBoolean bOpaque)
{
GrContextFontSet(&g_sScreenContext, pFont);
GrContextForegroundSet(&g_sScreenContext, SHADOW_COLOR);
GrStringDrawCentered(&g_sScreenContext, pcString, -1, sX+1, sY+1, bOpaque);
GrContextForegroundSet(&g_sScreenContext, HIGHLIGHT_COLOR);
GrStringDrawCentered(&g_sScreenContext, pcString, -1, sX, sY, false);
}
示例10: PrintBolusCreateNotAllowed
void PrintBolusCreateNotAllowed( tContext *context ){
// Draw top and bottom banner and buttons
LoadLeftButton( context , "BACK");
// Menu options
GrStringDrawCentered(context, "Bolus Preset", AUTO_STRING_LENGTH, 47, 31, OPAQUE_TEXT);
GrStringDrawCentered(context, "Creation", AUTO_STRING_LENGTH, 47, 44, OPAQUE_TEXT);
GrStringDrawCentered(context, "not Allowed", AUTO_STRING_LENGTH, 47, 57, OPAQUE_TEXT);
}
示例11: PrintNoBasProf
void PrintNoBasProf(tContext *context){
// Draw top and bottom banner and buttons
LoadLeftButton( context , "BACK");
//LoadMiddleButton("SEL");
//LoadRightButton("");
// Menu options
GrStringDrawCentered(context, "No Basal", AUTO_STRING_LENGTH, 47, 31, OPAQUE_TEXT);
GrStringDrawCentered(context, "Profile", AUTO_STRING_LENGTH, 47, 44, OPAQUE_TEXT);
GrStringDrawCentered(context, "Available", AUTO_STRING_LENGTH, 47, 57, OPAQUE_TEXT);
}
示例12: fs_init
//*****************************************************************************
//
// Initialize the file system.
//
//*****************************************************************************
void
fs_init(void)
{
FRESULT fresult;
DIR g_sDirObject;
//
// Initialze the flag to indicate that we are disabled.
//
g_bFatFsEnabled = false;
//
// Initialize and mount the Fat File System.
//
fresult = f_mount(0, &g_sFatFs);
if(fresult != FR_OK)
{
return;
}
//
// Open the root directory for access.
//
fresult = f_opendir(&g_sDirObject, "/");
//
// Flag and display which file system we are using.
//
GrStringDrawCentered(&g_sContext, "Web Server Using", -1,
GrContextDpyWidthGet(&g_sContext) / 2, 180, false);
if(fresult == FR_OK)
{
//
// Indicate and display that we are using the SD file system.
//
g_bFatFsEnabled = true;
GrStringDrawCentered(&g_sContext, "SDCard File System", -1,
GrContextDpyWidthGet(&g_sContext) / 2, 200,
false);
}
else
{
//
// Indicate and display that we are using the internal file system.
//
g_bFatFsEnabled = false;
GrStringDrawCentered(&g_sContext, "Internal File System", -1,
GrContextDpyWidthGet(&g_sContext) / 2, 200,
false);
}
}
示例13: SafeRTOSErrorHook
//*****************************************************************************
//
// This hook is called by SafeRTOS when an error is detected.
//
//*****************************************************************************
static void
SafeRTOSErrorHook(xTaskHandle xHandleOfTaskWithError,
signed portCHAR *pcNameOfTaskWithError,
portBASE_TYPE xErrorCode)
{
tContext sContext;
//
// A fatal SafeRTOS error was detected, so display an error message.
//
GrContextInit(&sContext, &g_sKitronix320x240x16_SSD2119);
GrContextForegroundSet(&sContext, ClrRed);
GrContextBackgroundSet(&sContext, ClrBlack);
GrContextFontSet(&sContext, g_pFontCm20);
GrStringDrawCentered(&sContext, "Fatal SafeRTOS error!", -1,
GrContextDpyWidthGet(&sContext) / 2,
(((GrContextDpyHeightGet(&sContext) - 24) / 2) +
24), 1);
//
// This function can not return, so loop forever. Interrupts are disabled
// on entry to this function, so no processor interrupts will interrupt
// this loop.
//
while(1)
{
}
}
示例14: DisplayStatus
/******************************************************************************
* *
* \brief Shows the status string on the color STN display. *
* *
* \param psContext is a pointer to the graphics context representing the *
* display. *
* *
* \param pcStatus is a pointer to the string to be shown. *
* *
* \return none. *
* *
******************************************************************************/
void DisplayStatus(tContext *psContext, char *pcStatus)
{
tRectangle rectLine;
int lY;
/* Calculate the Y coordinate of the top left of the character cell
for our line of text.
*/
lY = (GrContextDpyHeightGet(psContext) / 8) -
(GrFontHeightGet(TEXT_FONT) / 2);
/* Determine the bounding rectangle for this line of text. We add 4 pixels
to the height just to ensure that we clear a couple of pixels above and
below the line of text.
*/
rectLine.sXMin = 0;
rectLine.sXMax = GrContextDpyWidthGet(psContext) - 1;
rectLine.sYMin = lY;
rectLine.sYMax = lY + GrFontHeightGet(TEXT_FONT) + 3;
/* Clear the line with black. */
GrContextForegroundSet(&g_sContext, ClrBlack);
GrRectFill(psContext, &rectLine);
/* Draw the new status string */
GrContextForegroundSet(&g_sContext, ClrWhite);
GrStringDrawCentered(psContext, pcStatus, -1,
GrContextDpyWidthGet(psContext) / 2,
GrContextDpyHeightGet(psContext) / 8 , false);
}
示例15: vApplicationStackOverflowHook
//*****************************************************************************
//
// This hook is called by FreeRTOS when an stack overflow error is detected.
//
//*****************************************************************************
void
vApplicationStackOverflowHook(xTaskHandle *pxTask, signed char *pcTaskName)
{
tContext sContext;
//
// A fatal FreeRTOS error was detected, so display an error message.
//
GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);
GrContextForegroundSet(&sContext, ClrRed);
GrContextBackgroundSet(&sContext, ClrBlack);
GrContextFontSet(&sContext, g_psFontCm20);
GrStringDrawCentered(&sContext, "Fatal FreeRTOS error!", -1,
GrContextDpyWidthGet(&sContext) / 2,
(((GrContextDpyHeightGet(&sContext) - 24) / 2) +
24), 1);
//
// This function can not return, so loop forever. Interrupts are disabled
// on entry to this function, so no processor interrupts will interrupt
// this loop.
//
while(1)
{
}
}