本文整理汇总了C++中GUI_DispStringHCenterAt函数的典型用法代码示例。如果您正苦于以下问题:C++ GUI_DispStringHCenterAt函数的具体用法?C++ GUI_DispStringHCenterAt怎么用?C++ GUI_DispStringHCenterAt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GUI_DispStringHCenterAt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _DrawScreen
/*********************************************************************
*
* _DrawScreen
*/
static void _DrawScreen(void) {
GUI_RECT Rect;
int yd;
GUI_DrawBitmap(&_bmSeggerLogo_50x25, 10, 10);
GUI_SetFont(GUI_FONT_20B_ASCII);
GUI_DispStringHCenterAt("Antialiased text sample", 190, 5);
GUI_SetFont(GUI_FONT_13_ASCII);
GUI_DispStringHCenterAt("Shows antialiased text on different backgrounds.", 190, 25);
Rect.x0 = 0;
Rect.y0 = 43;
Rect.x1 = 59;
Rect.y1 = Rect.y0 + 95;
yd = (Rect.y1 - Rect.y0) / 3;
//
// 4 bit antialiasing sample
//
_DrawText("Antialiased text\n (4 bpp)", &Rect);
GUI_SetFont(&_FontAA4_32);
_DrawSample(&Rect, yd);
//
// 2 bit antialiasing sample
//
GUI_MoveRect(&Rect, 0, 101);
_DrawText("Antialiased text\n (2 bpp)", &Rect);
GUI_SetFont(&_FontAA2_32);
_DrawSample(&Rect, yd);
}
示例2: GUIDEMO_ShowIntro
/*********************************************************************
*
* GUIDEMO_ShowIntro
*
* This function has to be called by every sample
*/
void GUIDEMO_ShowIntro(const char * acTitle, const char * acDescription) {
int xSize, ySize, xCenter, yCenter, FontDistY, TimeWait, i;
xSize = LCD_GetXSize();
ySize = LCD_GetYSize();
xCenter = xSize >> 1;
yCenter = ySize >> 1;
GUIDEMO_HideInfoWin();
GUIDEMO_ShowControlWin();
GUI_Exec();
GUIDEMO_DrawBk(1);
GUI_SetColor(GUI_WHITE);
//
// Title
//
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetFont(&GUI_FontRounded22);
GUI_DispStringHCenterAt(acTitle, xCenter, 60);
//
// Description
//
GUI_SetFont(&GUI_FontSouvenir18);
FontDistY = GUI_GetFontDistY();
GUI_DispStringHCenterAt(acDescription, xCenter, yCenter - FontDistY + 10);
//
// Determine time to wait
//
i = 0;
while (acDescription[i]) {
i++;
}
TimeWait = i * 80;
GUIDEMO_Wait(TimeWait);
}
示例3: _DemoHardkey
/*******************************************************************
*
* _DemoHardkey
*
* Function description
* Demonstrates HARDKEY simulation with a listbox
*/
static void _DemoHardkey(void) {
LISTBOX_Handle hListBox;
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
GUI_SetColor(GUI_WHITE);
GUI_SetTextAlign(GUI_TA_HCENTER);
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringAt("Hardkey - Sample", 160, 5);
GUI_SetFont(&GUI_Font8x8);
GUI_DispStringHCenterAt("Exit", 65, 230);
GUI_DispStringHCenterAt("Up", 160, 230);
GUI_DispStringHCenterAt("Down", 255, 230);
/* Create the listbox */
hListBox = LISTBOX_Create(_aListBox, 100, 100, 120, 75, WM_CF_SHOW);
WM_SetFocus(hListBox);
LISTBOX_SetFont(hListBox, &GUI_Font13B_1);
SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
/* Handle the listbox */
while (!_Ready) {
GUI_Delay(10);
}
/* Delete listbox widget */
LISTBOX_Delete(hListBox);
GUI_Clear();
}
示例4: GUIDEMO_ShowIntro
void GUIDEMO_ShowIntro(const char * s, const char * sExp) {
GUI_CONTEXT ContextOld;
GUI_SaveContext(&ContextOld);
_sInfo = s;
_sExplain = sExp;
GUI_SetDefault();
GUIDEMO_HideInfoWin();
GUI_SetBkColor(GUI_BLUE);
GUI_SetColor(GUI_WHITE);
GUI_Clear();
//GUI_SetFont(&GUI_FontComic18B_ASCII);
GUI_SetFont(&GUI_FontHZ12);
GUI_DispStringHCenterAt(s, LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() / 3 - 10);
if (_sExplain) {
GUI_SetFont(&GUI_Font8_ASCII);
GUI_DispStringHCenterAt(_sExplain, LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() / 2 - 10);
}
GUIDEMO_Delay(_sExplain ? 2000 : 4000);
#if GUI_WINSUPPORT
_UpdateInfoWin();
_UpdateCmdWin();
#endif
GUI_RestoreContext(&ContextOld);
#if GUI_WINSUPPORT
WM_ExecIdle();
#endif
GUIDEMO_NotifyStartNext();
GUI_SetBkColor(GUI_RED);
GUI_Clear();
}
示例5: _DemoAntialiasing
/*******************************************************************
*
* _DemoAntialiasing
Draws lines with different antialiasing factors
*/
static void _DemoAntialiasing(void) {
int i, x1, x2, y1, y2;
const GUI_FONT *font_old;
y1 = 65;
y2 = 5;
/* Set drawing attributes */
GUI_SetColor(GUI_WHITE);
GUI_SetBkColor(GUI_BLACK);
GUI_SetPenShape(GUI_PS_FLAT);
GUI_Clear();
/* draw headline */
font_old = GUI_SetFont(&GUI_Font24_ASCII);
GUI_SetTextAlign(GUI_TA_HCENTER);
GUI_DispStringAt("AA_Lines - Sample", 160, 5);
/* Draw lines without antialiased */
GUI_Delay(1000);
GUI_SetFont(&GUI_Font8x16);
GUI_SetTextAlign(GUI_TA_LEFT);
GUI_DispStringAtCEOL("draw normal lines using", 5, 40);
GUI_DispStringAtCEOL("GUI_DrawLine", 5, 55);
GUI_Delay(2500);
x1 = 20;
x2 = 100;
GUI_SetFont(font_old);
GUI_DispStringHCenterAt("Normal", (x1 + x2) / 2, 30 + y1);
for (i = 1; i < 8; i++) {
GUI_SetPenSize(i);
GUI_DrawLine(x1, 40 + i * 15 + y1, x2, 40 + i * 15 + y1 + y2);
}
/* Draw lines with antialiasing quality factor 2 */
GUI_Delay(3000);
GUI_SetFont(&GUI_Font8x16);
GUI_DispStringAtCEOL("", 5, 40);
GUI_DispStringAtCEOL("", 5, 55);
GUI_Delay(200);
GUI_DispStringAtCEOL("draw antialiased lines using", 5, 40);
GUI_DispStringAtCEOL("GUI_AA_DrawLine", 5, 55);
GUI_Delay(3500);
x1 = 120;
x2 = 200;
GUI_AA_SetFactor(2);
GUI_SetFont(font_old);
GUI_DispStringHCenterAt("Antialiased\nusing factor 2", (x1 + x2) / 2, 30 + y1);
for (i = 1; i < 8; i++) {
GUI_SetPenSize(i);
GUI_AA_DrawLine(x1, 40 + i * 15 + y1, x2, 40 + i * 15 + y1 + y2);
}
/* Draw lines with antialiasing quality factor 6 */
GUI_Delay(1500);
x1 = 220;
x2 = 300;
GUI_AA_SetFactor(6);
GUI_SetFont(font_old);
GUI_DispStringHCenterAt("Antialiased\nusing factor 6", (x1 + x2) / 2, 30 + y1);
for (i = 1; i < 8; i++) {
GUI_SetPenSize(i);
GUI_AA_DrawLine(x1, 40 + i * 15 + y1, x2, 40 + i * 15 + y1 + y2);
}
GUI_Delay(7500);
}
示例6: _DrawJPEGS
/*******************************************************************
*
* _DrawJPEGS
*
* Iterates over all JPEG files of a directory
*/
static void _DrawJPEGS(void) {
WIN32_FIND_DATA Context;
static char acPath[_MAX_PATH];
HANDLE hFind;
char acMask[_MAX_PATH];
char acFile[_MAX_PATH];
char acBuffer[_MAX_PATH];
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringHCenterAt("Drawing scaled JPEGs - Sample", 160, 5);
GetWindowsDirectory(acBuffer, sizeof(acBuffer));
_GetFirstBitmapDirectory(acBuffer, acPath);
GUI_SetFont(&GUI_Font8x16);
sprintf(acMask, "%s*.jp*", acPath);
hFind = FindFirstFile(acMask, &Context);
if (hFind != INVALID_HANDLE_VALUE) {
do {
sprintf(acFile, "%s%s", acPath, Context.cFileName);
GUI_DispStringAtCEOL(acFile, 5, 40);
_DrawJPEG(acFile);
} while (FindNextFile(hFind, &Context));
} else {
GUI_DispStringHCenterAt("No JPEG files found!", 160, 60);
GUI_Delay(2000);
}
}
示例7: _ShowComments
/*******************************************************************
*
* _ShowComments
*
* Shows all comments of a GIF file
*/
static void _ShowComments(const char * pFile, int FileSize) {
GUI_RECT Rect = {80, 100, 239, 199};
char acBuffer[256] = {0};
int CommentCnt;
/* Display sample information */
GUI_SetFont(&GUI_Font8x16);
GUI_ClearRect(0, 40, 319, 59);
GUI_DispStringHCenterAt("Show all comments of a GIF file", 160, 40);
/* Show all comments */
GUI_ClearRect(0, 60, 319, 239); /* Clear the image area */
CommentCnt = 0;
while (!GUI_GIF_GetComment(pFile, FileSize, (unsigned char *)acBuffer, sizeof(acBuffer), CommentCnt)) {
char acNumber[12] = "Comment #0:";
acNumber[9] = '0' + CommentCnt;
GUI_DispStringHCenterAt(acNumber, 160, 80);
GUI_SetBkColor(GUI_BLACK);
GUI_SetColor(GUI_WHITE);
GUI_ClearRectEx(&Rect);
GUI_DispStringInRectWrap(acBuffer, &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER, GUI_WRAPMODE_WORD);
GUI_SetBkColor(GUI_WHITE);
GUI_SetColor(GUI_BLACK);
GUI_Delay(4000); /* Wait a while */
CommentCnt++;
}
}
示例8: GUIDEMO_Intro
void GUIDEMO_Intro(void) {
int xCenter = LCD_GET_XSIZE() / 2;
int y;
char acText[50] = "Version of µC/GUI: ";
strcat(acText, GUI_GetVersionString());
GUI_SetBkColor(GUI_BLUE);
GUI_SetColor(GUI_YELLOW);
GUI_Clear();
GUI_SetFont(&GUI_Font13B_1);
GUI_DispStringHCenterAt("µC/GUI", xCenter, y= 10);
GUI_SetFont(&GUI_Font10_ASCII);
GUI_SetColor(GUI_WHITE);
GUI_DispStringHCenterAt("Universal graphic software"
"\nfor embedded applications"
, xCenter, y += 20);
GUI_SetFont(&GUI_Font10S_ASCII);
GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, y += 25);
GUI_DispStringHCenterAt(acText, xCenter, y += 16);
GUIDEMO_Delay(5000);
GUI_Clear();
GUI_DrawBitmap(&bmMicriumLogo, (LCD_GET_XSIZE() - bmMicriumLogo.XSize) / 2, 6);
GUI_SetFont(&GUI_Font13B_1);
GUI_DispStringHCenterAt("www.micrium.com", LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() - 50);
GUIDEMO_Delay(5000);
}
示例9: DemoShiftJIS
void DemoShiftJIS(void) {
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringHCenterAt("FONT_ShiftJIS - Sample", 160, 5);
/* Set ShiftJIS font */
GUI_SetFont(&GUI_FontSJIS13);
/* Display string */
GUI_DispStringHCenterAt(aSJIS, 160, 80);
}
示例10: MainTask
/*********************************************************************
*
* MainTask
*/
void MainTask(void) {
GUI_Init();
while(1) {
GUI_DispStringHCenterAt("WIDGET_Window sample\nshows how to use a WINDOW widget", 160, 5);
GUI_ExecDialogBox(_aDialog, GUI_COUNTOF(_aDialog), _cbDialog, WM_HBKWIN, 30, 30);
GUI_Clear();
GUI_DispStringHCenterAt("Dialog has been closed", 160, 5);
GUI_Delay(1000);
GUI_Clear();
}
}
示例11: _DemoShiftJIS
/*******************************************************************
*
* Demonstrates output of ShiftJIS characters
*
********************************************************************
*/
static void _DemoShiftJIS(void) {
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringHCenterAt("FONT_ShiftJIS - Sample", 160, 5);
//
// Set ShiftJIS font
//
GUI_SetFont(&GUI_FontSJIS13);
//
// Display string
//
GUI_DispStringHCenterAt(aSJIS, 160, 80);
}
示例12: _cbBkWin
/*********************************************************************
*
* _cbBkWin
*
* Function description
* Callback routine of desktop window
*/
static void _cbBkWin(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
GUI_Clear();
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringHCenterAt("WIDGET_SortedListview - Sample", 160, 5);
GUI_SetFont(&GUI_Font10_ASCII);
GUI_DispStringHCenterAt("Please touch the header of the LISTVIEW for sorting...", 160, 35);
break;
default:
WM_DefaultProc(pMsg);
}
}
示例13: _cbBkWin
/*********************************************************************
*
* _cbBkWin
*/
static void _cbBkWin(WM_MESSAGE * pMsg) {
const WM_KEY_INFO * pKeyInfo;
int NCode;
int Id;
switch (pMsg->MsgId) {
case WM_KEY:
pKeyInfo = (const WM_KEY_INFO*)pMsg->Data.p;
if (pKeyInfo->PressedCnt > 0) {
switch (pKeyInfo->Key) {
case GUI_KEY_TAB:
WM_SetFocusOnNextChild(pMsg->hWin);
break;
case GUI_KEY_BACKTAB:
WM_SetFocusOnPrevChild(pMsg->hWin);
break;
case GUI_KEY_ESCAPE:
_Break = 1;
break;
}
}
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc); // Id of widget
NCode = pMsg->Data.v; // Notification code
switch (NCode) {
case WM_NOTIFICATION_RELEASED: // React only if released
switch (Id) {
case GUI_ID_BUTTON0:
_AppSelection = APP_DASHBOARD;
break;
case GUI_ID_BUTTON1:
_AppSelection = APP_CASHTERMINAL;
break;
}
break;
}
break;
case WM_PAINT:
GUI_DrawGradientV(0, 0, 639, 479, GUI_BLUE, GUI_BLACK);
GUI_SetFont(&GUI_FontAA2_32);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetColor(GUI_WHITE);
GUI_DispStringHCenterAt("emWin VGA Demonstration\n", 400, 44);
GUI_SetFont(&GUI_FontAA2_21);
GUI_DispStringHCenterAt("Press the 'Dashboard' or the 'Cash Terminal'\nbutton to start one of the applications\n", 320, 150);
GUI_DrawBitmap(&bmSeggerLogo, 30, 30);
break;
}
}
示例14: MainTask
/*******************************************************************
*
* MainTask
*/
void MainTask(void) {
int xSizeH;
GUI_Init();
xSizeH = LCD_GetXSize() / 2;
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringHCenterAt("Fading sample", xSizeH, 5);
GUI_SetFont(&GUI_Font16B_ASCII);
GUI_DispStringHCenterAt("Shows how to use memory devices\nfor a fading effect", xSizeH, 40);
_DemoFade();
while (1) {
GUI_Delay(100);
}
}
示例15: _DispCursor
/*********************************************************************
*
* _DispCursor
*/
static void _DispCursor(void) {
int i, x, y;
GUI_DispStringHCenterAt("Available cursors:", 160, 80);
for (i = 0; i < 12; i++) {
x = 160 - (_apCursor[i]->pBitmap->XSize / 2);
y = 120 - (_apCursor[i]->pBitmap->YSize / 2);
GUI_DrawBitmap(_apCursor[i]->pBitmap, x, y);
GUI_DispStringHCenterAt(_aacCursorName[i], 160,145);
GUI_Delay(750);
GUI_ClearRect(0, 100, 319, 165);
}
GUI_ClearRect(0, 80, 319, 100);
GUI_Delay(500);
}