本文整理汇总了C++中GrStringDraw函数的典型用法代码示例。如果您正苦于以下问题:C++ GrStringDraw函数的具体用法?C++ GrStringDraw怎么用?C++ GrStringDraw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GrStringDraw函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintReminder
void PrintReminder(tContext *context, y_menus f_menuChoice){
char outString[32] = "";
unsigned char text_start = 18;
// Draw top and bottom banner and buttons
LoadLeftButton( context , "BACK");
LoadMiddleButton( context , "SEL");
//LoadRightButton("");
// Menu options
GrStringDraw( context, "Create Reminder", AUTO_STRING_LENGTH, 5, 18, OPAQUE_TEXT);
GrStringDraw( context, "Remove Reminder", AUTO_STRING_LENGTH, 5, 31, OPAQUE_TEXT);
// Highlight selected item
switch (f_menuChoice) {
case Reminder_Create:
text_start = 18;
strcpy(outString, "Create Reminder");
break;
case Reminder_Remove:
text_start = 31;
strcpy(outString, "Remove Reminder");
break;
default: break;
}
GrContextForegroundSet(context, ClrWhite); //ClrBlack this affects the highlight color
GrContextBackgroundSet(context, ClrBlack); //ClrWhite this affects the text color in the highlight
GrStringDraw(context, outString, AUTO_STRING_LENGTH, 5, text_start, OPAQUE_TEXT);
GrContextForegroundSet(context, ClrBlack);
GrContextBackgroundSet(context, ClrWhite);
}
示例2: window_drawtime
void window_drawtime(tContext *pContext, long y, uint8_t times[3], uint8_t selected)
{
char data[3];
data[0] = data[1] = '0';
data[2] = ':';
#define SPACING 3
uint8_t height = GrStringHeightGet(pContext);
uint8_t width_all = GrStringWidthGet(pContext, data, 3) + 10;
uint8_t width_digit = GrStringWidthGet(pContext, data, 2) + 4;
long startx = (LCD_WIDTH - width_all - width_all - width_digit) / 2;
if (startx < 0) startx = 0;
for(int i = 0; i < 3; i++)
{
data[0] = '0' + times[i] / 10;
data[1] = '0' + times[i] % 10;
GrContextForegroundSet(pContext, ClrWhite);
GrContextBackgroundSet(pContext, ClrBlack);
if (selected & (1 << i))
window_selecttext(pContext, data, 2, startx + SPACING + i * width_all, y);
else
GrStringDraw(pContext, data, 2, startx + SPACING + i * width_all, y, 0);
if (i != 2)
{
GrContextForegroundSet(pContext, ClrWhite);
GrContextBackgroundSet(pContext, ClrBlack);
GrStringDraw(pContext, ":", 1, startx + SPACING + width_digit + i * width_all, y, 0);
}
}
}
示例3: DisplayIntStatus
//*****************************************************************************
//
// Display the interrupt state on the CSTN. 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';
GrStringDraw(&g_sContext, pcBuffer, -1, 48, 32, 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' : ' ';
GrStringDraw(&g_sContext, pcBuffer, -1, 48, 44, 1);
//
// Flush the display.
//
GrFlush(&g_sContext);
}
示例4: 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;
}
}
示例5: UpdateWindow
//*****************************************************************************
//
// This function updates the contents of the directory text window.
//
// \param None.
//
// This function is will update the state of the directory window. This can
// be the result of a DirUpdate() call which completely changed the contents
// of the window, or a selection changed and the screen needs to be updated.
//
// \return None.
//
//*****************************************************************************
void
UpdateWindow(void)
{
int iIdx;
int iLine;
//
// Set the first line of the directory text window.
//
iLine = TOP_HEIGHT;
//
// Clear out the text area for the entries.
//
ClearTextBox();
//
// Display all valid values.
//
for(iIdx = 0; iIdx < g_DirData.ulValidValues; iIdx++)
{
//
// Change the backgound for the selected item.
//
if(g_DirData.ulSelectIndex == iIdx)
{
GrContextBackgroundSet(&g_sContext, ClrGray);
}
else
{
GrContextBackgroundSet(&g_sContext, ClrBlack);
}
//
// Change the color for directories.
//
if (g_DirData.FileInfo[iIdx].fattrib & AM_DIR)
{
GrContextForegroundSet(&g_sContext, DIR_COLOR);
GrStringDraw(&g_sContext, g_DirData.FileInfo[iIdx].fname,
100, 0, iLine, 1);
}
//
// Change the color for files.
//
else
{
GrContextForegroundSet(&g_sContext, FILE_COLOR);
GrStringDraw(&g_sContext, g_DirData.FileInfo[iIdx].fname,
100, 0, iLine, 1);
}
//
// Move down by the height of the characters used.
//
iLine += g_sFontFixed6x8.ucHeight;
}
}
示例6: test_motor
uint8_t test_motor(uint8_t ev, uint16_t lparam, void* rparam)
{
switch(ev)
{
case EVENT_WINDOW_CREATED:
data = 0;
break;
case EVENT_KEY_PRESSED:
{
switch(lparam)
{
case KEY_UP:
data++;
if (data > 16) data = 1;
break;
case KEY_DOWN:
data--;
if (data == 0) data = 16;
break;
case KEY_ENTER:
data = 0;
break;
}
motor_on(data, 0);
window_invalid(NULL);
break;
}
case EVENT_WINDOW_PAINT:
{
char buf[32];
tContext *pContext = (tContext*)rparam;
GrContextForegroundSet(pContext, ClrBlack);
GrRectFill(pContext, &client_clip);
GrContextForegroundSet(pContext, ClrWhite);
GrContextFontSet(pContext, (tFont*)&g_sFontGothic18);
GrStringDraw(pContext, "Test Motor", -1, 32, 50, 0);
sprintf(buf, "Motor Level: %d", data);
GrStringDraw(pContext, buf, -1, 5, 70, 0);
window_button(pContext, KEY_UP, "+");
window_button(pContext, KEY_DOWN, "-");
window_button(pContext, KEY_ENTER, "Reset");
break;
}
case EVENT_EXIT_PRESSED:
motor_on(0, 0);
return 0; // return 0 to close the window
default:
return 0;
}
return 1;
}
示例7: ScrollText
//*****************************************************************************
//
// Handles scrolling the text on the screen.
//
//*****************************************************************************
static void
ScrollText(void)
{
int32_t i32Idx;
uint32_t ui32Line, ui32Start;
ui32Line = 0;
//
// Skip the oldest entry in the circular list.
//
if(g_ui32CurrentLine == (MAX_LINES - 1)) {
//
// If at the end of the list wrap to entry 1.
//
ui32Start = 1;
} else {
//
// The oldest is 1 in front of the most recent.
//
ui32Start = g_ui32CurrentLine + 2;
}
//
// Print lines from the current position down first.
//
for(i32Idx = ui32Start; i32Idx < MAX_LINES; i32Idx++) {
GrStringDraw(&g_sContext, g_ppcLines[i32Idx],
strlen(g_ppcLines[i32Idx]), DISPLAY_TEXT_BORDER_H,
DISPLAY_BANNER_HEIGHT + DISPLAY_TEXT_BORDER +
(ui32Line * GrFontHeightGet(g_psFontFixed6x8)), 1);
ui32Line++;
}
//
// If not the special case of the last line where everything has already
// printed, print the remaining lines.
//
if(g_ui32CurrentLine != (MAX_LINES - 1)) {
for(i32Idx = 0; i32Idx <= g_ui32CurrentLine; i32Idx++) {
GrStringDraw(&g_sContext, g_ppcLines[i32Idx],
strlen(g_ppcLines[i32Idx]),
DISPLAY_TEXT_BORDER_H,
DISPLAY_BANNER_HEIGHT + DISPLAY_TEXT_BORDER +
(ui32Line * GrFontHeightGet(g_psFontFixed6x8)), 1);
ui32Line++;
}
}
//
// Reset the column to zero.
//
g_ui32Column = 0;
}
示例8: MainLoopRun
//*****************************************************************************
//
// The main loop of the application. This implementation is specific to the
// EK-LM4F232 board and merely displays the current timer count value and the
// number of interrupts taken. It contains nothing directly relevant to the
// timer configuration or operation.
//
//*****************************************************************************
void
MainLoopRun(void)
{
uint32_t ui32Count, ui32LastCount;
//
// Set up for the main loop.
//
ui32LastCount = 10;
//
// Loop forever while the timer runs.
//
while(1)
{
//
// Get the current timer count.
//
ui32Count = ROM_TimerValueGet(TIMER4_BASE, TIMER_A);
//
// Has it changed?
//
if(ui32Count != ui32LastCount)
{
//
// Yes - update the display.
//
usnprintf(g_pcPrintBuff, PRINT_BUFF_SIZE, "%d ", ui32Count);
GrStringDraw(&g_sContext, g_pcPrintBuff, -1, 80, 26, true);
//
// Remember the new count value.
//
ui32LastCount = ui32Count;
}
//
// Has there been an interrupt since last we checked?
//
if(HWREGBITW(&g_ui32Flags, 0))
{
//
// Clear the bit.
//
HWREGBITW(&g_ui32Flags, 0) = 0;
//
// Update the interrupt count.
//
usnprintf(g_pcPrintBuff, PRINT_BUFF_SIZE, "%d ", g_ui32IntCount);
GrStringDraw(&g_sContext, g_pcPrintBuff, -1, 80, 36, true);
}
}
}
示例9: OnIntroPaint
//*****************************************************************************
//
// Handles paint requests for the introduction canvas widget.
//
//*****************************************************************************
void
OnIntroPaint(tWidget *psWidget, tContext *psContext)
{
//
// Display the introduction text in the canvas.
//
GrContextFontSet(psContext, g_psFontCm16);
GrContextForegroundSet(psContext, ClrSilver);
GrStringDraw(psContext, "This application demonstrates the ", -1,
10, 30, 0);
GrStringDraw(psContext, "TivaWare Graphics Library.", -1,
10, (30+16), 0);
GrStringDraw(psContext, "Each panel shows a different feature of", -1,
10, (30+(16*2)), 0);
GrStringDraw(psContext, "the graphics library. Widgets on the panels", -1,
10, (30+(16*3)), 0);
GrStringDraw(psContext, "are fully operational; pressing them will", -1,
10, (30+(16*4)), 0);
GrStringDraw(psContext, "result in visible feedback of some kind.", -1,
10, (30+(16*5)), 0);
GrStringDraw(psContext, "Press the + and - buttons at the bottom", -1,
10, (30+(16*6)), 0);
GrStringDraw(psContext, "of the screen to move between the panels.", -1,
10, (30+(16*7)), 0);
}
示例10: main
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);
Kentec320x240x16_SSD2119Init();
GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);
ClrScreen();
GrImageDraw(&sContext, g_pui8Image, 0, 0);
GrFlush(&sContext);
SysCtlDelay(SysCtlClockGet());
// Later lab steps go between here
ClrScreen();
sRect.i16XMin = 1;
sRect.i16YMin = 1;
sRect.i16XMax = 318;
sRect.i16YMax = 238;
GrContextForegroundSet(&sContext, ClrRed);
GrContextFontSet(&sContext, &g_sFontCmss30b);
GrStringDraw(&sContext, "Texas", -1, 110, 2, 0);
GrStringDraw(&sContext, "Instruments", -1, 80, 32, 0);
GrStringDraw(&sContext, "Graphics", -1, 100, 62, 0);
GrStringDraw(&sContext, "Lab", -1, 135, 92, 0);
GrContextForegroundSet(&sContext, ClrWhite);
GrRectDraw(&sContext, &sRect);
GrFlush(&sContext);
SysCtlDelay(SysCtlClockGet());
GrContextForegroundSet(&sContext, ClrYellow);
GrCircleFill(&sContext, 80, 182, 50);
sRect.i16XMin = 160;
sRect.i16YMin = 132;
sRect.i16XMax = 312;
sRect.i16YMax = 232;
GrContextForegroundSet(&sContext, ClrGreen);
GrRectDraw(&sContext, &sRect);
SysCtlDelay(SysCtlClockGet());
// and here
ClrScreen();
while(1)
{
}
}
示例11: drawItem
static void drawItem(tContext *pContext, uint8_t n, char icon, const char* text, const char* value)
{
if (icon)
{
GrContextFontSet(pContext, (tFont*)&g_sFontExIcon16);
GrStringDraw(pContext, &icon, 1, 3, 12 + n * LINEMARGIN, 0);
}
// draw text
GrContextFontSet(pContext, &g_sFontGothic24b);
GrStringDraw(pContext, text, -1, 20, 10 + n * LINEMARGIN, 0);
uint8_t width = GrStringWidthGet(pContext, value, -1);
GrStringDraw(pContext, value, -1, LCD_WIDTH - width - 4, 10 + n * LINEMARGIN, 0);
}
示例12: OnFirmwarePaint
//*****************************************************************************
//
// Handles paint requests for the firmware update canvas widget.
//
//*****************************************************************************
void
OnFirmwarePaint(tWidget *pWidget, tContext *pContext)
{
unsigned long ulLines;
long lLineHeight, lOffset;
lLineHeight = GrFontHeightGet(FONT_14PT);
lOffset = 32;
//
// Display the firmware update instruction text in the canvas.
//
GrContextFontSet(pContext, FONT_14PT);
GrContextForegroundSet(pContext, ClrSilver);
GrStringGet(STR_UPDATE_TEXT, g_pcBuffer, SCOMP_MAX_STRLEN);
ulLines = DrawStringWrapped(pContext, g_pcBuffer, lLineHeight, 1, lOffset,
g_pLanguageTable[g_ulLangIdx].bBreakOnSpace );
//
// Move down by 1/4 of a line.
//
lOffset += lLineHeight/4;
//
// Format the UART setting information string
//
GrStringGet(STR_UART, g_pcBuffer, SCOMP_MAX_STRLEN);
GrStringDraw(pContext, g_pcBuffer, -1, 1,
lOffset + (ulLines * lLineHeight), 0);
}
示例13: devpkLcdText
/*******************************************************************************
* @fn devpkLcdText
*
* @brief Write a text string to a specific line/column of the display
*
* @param str - text to apply
* @param line - line index (0 .. 11)
* @param col - column index (0 .. 15)
*
* @return true if success
*/
bool devpkLcdText(const char *str, uint8_t line, uint8_t col)
{
if (hLcdPin != NULL)
{
uint8_t xp, yp;
Semaphore_pend(hSemLCD, BIOS_WAIT_FOREVER);
xp = col * CHAR_WIDTH + 1;
yp = line * CHAR_HEIGHT + 0;
// Draw a text on the display
GrStringDraw(&g_sContext,
str,
AUTO_STRING_LENGTH,
xp,
yp,
OPAQUE_TEXT);
GrFlush(&g_sContext);
Semaphore_post(hSemLCD);
}
return hLcdPin != NULL;
}
示例14: output
void output(int n,int (*drawArray)[10]){
static char pcCanvasText[5];
int i,j,color;
for ( i = 0; i < 4; ++i){
for ( j = 0; j < 4; ++j){
sRect.i16XMin = 64+i*48 +1;//16
sRect.i16YMin = 24+j*48 +1;//64
sRect.i16XMax = 112+i*48 -1;
sRect.i16YMax = 72+j*48 -1;
color = drawArray[i][j]%5;
GrContextForegroundSet(&context, DrawColor[color]);
GrRectFill(&context, &sRect);
usprintf(pcCanvasText, "%3d", drawArray[i][j]);
GrContextForegroundSet(&context, ClrBlack);
GrContextFontSet(&context, &g_sFontCm20);
GrStringDraw(&context, pcCanvasText, -1, 64+i*48 +1, 24+j*48 +16, 0);
}
}
}
示例15: lcdPutChar
void lcdPutChar(char_t c)
{
if(c == '\r')
{
lcdColumn = 0;
}
else if(c == '\n')
{
lcdColumn = 0;
lcdLine++;
}
else if(lcdLine < 26 && lcdColumn < 40)
{
char_t buffer[2];
buffer[0] = c;
buffer[1] = '\0';
//Display current character
GrStringDraw(&grContext, buffer, 1, lcdColumn * 6, lcdLine * 12, TRUE);
//Advance the cursor position
if(++lcdColumn >= 40)
{
lcdColumn = 0;
lcdLine++;
}
}
}