本文整理汇总了C++中GUI_SetFont函数的典型用法代码示例。如果您正苦于以下问题:C++ GUI_SetFont函数的具体用法?C++ GUI_SetFont怎么用?C++ GUI_SetFont使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GUI_SetFont函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _DemoVScreen
/*********************************************************************
*
* _DemoVScreen
*/
static void _DemoVScreen(void) {
int xSize, ySize, j, n;
int _aDelay[] = { 20, 5};
GUI_RECT Rect;
xSize = LCD_GetXSize();
ySize = LCD_GetYSize();
GUI_SetFont(&GUI_FontComic24B_ASCII);
GUI_SetTextMode(GUI_TM_TRANS);
Rect.x0 = 0;
Rect.y0 = 0;
Rect.x1 = xSize - 1;
Rect.y1 = ySize - 1;
GUI_SetColor(GUI_WHITE);
GUI_DispStringInRect("Default screen", &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER);
GUI_Delay(250);
Rect.y0 += ySize;
Rect.y1 += ySize;
GUI_DrawGradientV(Rect.x0, Rect.y0, Rect.x1, Rect.y1, 0xFFFFFF, 0x000000);
Rect.y1 -= ySize / 3;
GUI_SetColor(GUI_DARKGREEN);
GUI_DispStringInRect("Here is the virtual screen", &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER);
n = ySize / 5;
for (j = 0; j < GUI_COUNTOF(_aDelay); j++) {
if (_Loop(0, 5, n, _aDelay[j]) == 1) {
return;
}
GUI_SetOrg(0, ySize);
GUI_Delay(250);
if (_Loop(ySize, -5, n, _aDelay[j]) == 1) {
return;
}
GUI_SetOrg(0, 0);
GUI_Delay(250);
if (GUIDEMO_CheckCancel()) {
return;
}
}
for (j = 0; j < 5; j++) {
GUI_SetOrg(0, ySize);
GUI_Delay(200);
GUI_SetOrg(0, 0);
GUI_Delay(200);
if (GUIDEMO_CheckCancel()) {
return;
}
}
GUIDEMO_Delay(1000);
}
示例2: _cbDemoCallback2
/*******************************************************************
*
* _cbDemoCallback2
*/
static void _cbDemoCallback2(WM_MESSAGE* pMsg) {
int x, y;
switch (pMsg->MsgId) {
case WM_PAINT:
GUI_SetBkColor(GUI_MAGENTA);
GUI_Clear();
GUI_SetColor(GUI_YELLOW);
GUI_SetFont(&GUI_FontComic18B_1);
x = WM_GetWindowSizeX(pMsg->hWin);
y = WM_GetWindowSizeY(pMsg->hWin);
GUI_DispStringHCenterAt("Window 2\nanother Callback", x / 2, (y / 4) - 18);
break;
default:
WM_DefaultProc(pMsg);
}
}
示例3: _cbBk
/*********************************************************************
*
* _cbBk
*
* Purpose:
* Callback routine of desktop window
*/
static void _cbBk(WM_MESSAGE * pMsg) {
WM_HWIN hWin;
int xSize;
hWin = pMsg->hWin;
switch (pMsg->MsgId) {
case WM_PAINT:
xSize = LCD_GetXSize();
GUI_SetBkColor(GUI_DARKBLUE);
GUI_Clear();
GUI_SetFont(GUI_FONT_20_ASCII);
GUI_DispStringHCenterAt("Sample shows usage of", xSize / 2, 5);
GUI_DispStringHCenterAt("GUI_MEMDEV_GetDataPtr()", xSize / 2, 25);
break;
}
}
示例4: MainTask
void MainTask(void) {
/*GUI_Init();*/
WIDGET_SetDefaultEffect(&WIDGET_Effect_Simple);
GUI_SetBkColor(0xF9F9F9);
GUI_Clear();
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_FontComic24B_ASCII);
GUI_DispStringHCenterAt("Smart Wardrobe", 120, 6);
while (1) {
GUI_Exec();
GUI_Delay(100);
}
/*GUI_BMP_Draw(&bmpfile, 0, 0);*/
}
示例5: Table
//.........这里部分代码省略.........
#include "bsp.h"
extern "C" {
#include "GUI.h"
#include "WM.h" // emWin Windows Manager
#include "DIALOG.h"
#include "SIM.h"
}
Q_DEFINE_THIS_FILE
// Active object class -------------------------------------------------------
class Table : public QActive {
private:
uint8_t m_fork[N_PHILO];
uint8_t m_isHungry[N_PHILO];
public:
Table();
private:
static QState initial(Table *me, QEvt const *e);
static QState ready (Table *me, QEvt const *e);
static QState serving(Table *me, QEvt const *e);
static QState paused (Table *me, QEvt const *e);
};
#define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1)) % N_PHILO))
#define LEFT(n_) ((uint8_t)(((n_) + 1) % N_PHILO))
enum m_forkState { FREE, USED };
// Local objects -------------------------------------------------------------
static Table l_table; // local Table object
#ifdef Q_SPY
enum QSUserRecords {
PHILO_STAT = QS_USER,
TABLE_STAT
};
static uint8_t const l_onDialogGUI = 0U;
#endif
// Public-scope objects ------------------------------------------------------
QActive * const AO_Table = &l_table; // "opaque" AO pointer
// GUI definition ============================================================
static WM_HWIN l_hDlg;
static WM_CALLBACK *l_cb_WM_HBKWIN;
static const GUI_WIDGET_CREATE_INFO l_dialog[] = {
{ &FRAMEWIN_CreateIndirect, "Dining Philosopher Problem",
0, 30, 30, 260, 180, FRAMEWIN_CF_MOVEABLE },
{ &TEXT_CreateIndirect, "Philosopher 0",
GUI_ID_TEXT9, 50, 10, 0, 0, TEXT_CF_LEFT },
{ &TEXT_CreateIndirect, "Philosopher 1",
GUI_ID_TEXT9, 50, 30, 0, 0, TEXT_CF_LEFT },
{ &TEXT_CreateIndirect, "Philosopher 2",
GUI_ID_TEXT9, 50, 50, 0, 0, TEXT_CF_LEFT },
{ &TEXT_CreateIndirect, "Philosopher 3",
GUI_ID_TEXT9, 50, 70, 0, 0, TEXT_CF_LEFT },
{ &TEXT_CreateIndirect, "Philosopher 4",
GUI_ID_TEXT9, 50, 90, 0, 0, TEXT_CF_LEFT },
{ &TEXT_CreateIndirect, "Table",
GUI_ID_TEXT9, 50, 110, 0, 0, TEXT_CF_LEFT },
{ &TEXT_CreateIndirect, "thinking",
GUI_ID_TEXT0, 130, 10, 0, 0, TEXT_CF_LEFT },
{ &TEXT_CreateIndirect, "thinking",
GUI_ID_TEXT1, 130, 30, 0, 0, TEXT_CF_LEFT },
{ &TEXT_CreateIndirect, "thinking",
GUI_ID_TEXT2, 130, 50, 0, 0, TEXT_CF_LEFT },
{ &TEXT_CreateIndirect, "thinking",
GUI_ID_TEXT3, 130, 70, 0, 0, TEXT_CF_LEFT },
{ &TEXT_CreateIndirect, "thinking",
GUI_ID_TEXT4, 130, 90, 0, 0, TEXT_CF_LEFT },
{ &TEXT_CreateIndirect, "serving",
GUI_ID_TEXT5, 130, 110, 0, 0, TEXT_CF_LEFT },
{ &BUTTON_CreateIndirect,"PAUSE",
GUI_ID_BUTTON0, 160, 130, 80, 30 }
};
//..........................................................................*/
static void onMainWndGUI(WM_MESSAGE* pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT: {
GUI_SetBkColor(GUI_GRAY);
GUI_Clear();
GUI_SetColor(GUI_BLACK);
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringHCenterAt("Dining Philosophers - Demo", 160, 5);
break;
}
default: {
WM_DefaultProc(pMsg);
break;
}
}
}
示例6: _cbChild
/*******************************************************************
*
* _cbChild
*/
static void _cbChild(WM_MESSAGE* pMsg) {
int x, y;
switch (pMsg->MsgId) {
case WM_PAINT:
GUI_SetBkColor(_ChildColor);
GUI_Clear();
GUI_SetColor(GUI_RED);
GUI_SetFont(&GUI_Font24_ASCII);
x = WM_GetWindowSizeX(pMsg->hWin);
y = WM_GetWindowSizeY(pMsg->hWin);
GUI_DispStringHCenterAt("Child window", x / 2, (y / 2) - 12);
break;
default:
WM_DefaultProc(pMsg);
}
}
示例7: _cbBkWindow
/*********************************************************************
*
* _cbBkWindow
*/
static void _cbBkWindow(WM_MESSAGE * pMsg) {
int xPos, yPos;
xPos = LCD_GetXSize() / 2 - bmSeggerLogoBlue.XSize/2;
yPos = LCD_GetYSize() / 2 - bmSeggerLogoBlue.YSize/2 ;
switch (pMsg->MsgId) {
case WM_PAINT:
GUI_SetBkColor(GUI_BLUE);
GUI_Clear();
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringHCenterAt("DIALOG_SliderColor - Sample", 160, 5);
GUI_DrawBitmap(&bmSeggerLogoBlue, xPos, yPos );
default:
WM_DefaultProc(pMsg);
}
}
示例8: _cbBkWindow
/*********************************************************************
*
* _cbBkWindow
*/
static void _cbBkWindow(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
GUI_SetBkColor(GUI_WHITE);
GUI_Clear();
GUI_SetColor(GUI_BLACK);
GUI_SetFont(&GUI_Font24_ASCII);
default:
WM_DefaultProc(pMsg);
}
}
示例9: GUIDEMO_Touch
void GUIDEMO_Touch(void) {
#define ID_KEYBOARD 1
#define ID_TESTCAL 2
#define ID_CALIBRATE 3
int i, r;
int XSize = LCD_GetXSize();
int YSize = LCD_GetYSize();
int XMid = XSize / 2;
int YMid = YSize / 2;
GUIDEMO_NotifyStartNext();
GUIDEMO_HideInfoWin();
do {
GUI_RECT rText;/*= {0, 80, XSize, 120};*/
BUTTON_Handle ahButton[3];
rText.x0=0;
rText.y0=80;
rText.x1=XSize;
rText.y1=120;
GUI_SetBkColor(GUI_BLUE);
GUI_Clear();
GUI_DrawBitmap(&bmSeggerLogoBlue, (XSize - 1 - bmSeggerLogoBlue.XSize) / 2, 15);
GUI_SetFont(&GUI_FontComic18B_ASCII);
GUI_DispStringInRect("emWin Touch screen demo", &rText, GUI_TA_HCENTER | GUI_TA_VCENTER);
ahButton[0] = BUTTON_Create( XMid - 50, YMid - 20, 100, 50, ID_CALIBRATE,BUTTON_CF_SHOW );
ahButton[1] = BUTTON_Create( XMid - 90, YMid + 40, 80, 30, ID_KEYBOARD, BUTTON_CF_SHOW );
ahButton[2] = BUTTON_Create( XMid + 10, YMid + 40, 80, 30, ID_TESTCAL,BUTTON_CF_SHOW );
BUTTON_SetText (ahButton[0], "Calibrate");
BUTTON_SetBkColor(ahButton[0], 0, GUI_RED);
BUTTON_SetText (ahButton[1], "Keyboard");
BUTTON_SetText (ahButton[2], "Test calibration");
BUTTON_SetFont(ahButton[0], &GUI_FontComic18B_ASCII);
r = GUIDEMO_WaitKey();
if (r==0) {
r = ID_KEYBOARD;
BUTTON_SetState(ahButton[1], BUTTON_STATE_PRESSED);
GUIDEMO_Delay(500);
}
for (i=0; i< countof(ahButton); i++) {
BUTTON_Delete(ahButton[i]);
}
switch (r) {
case ID_KEYBOARD: r= _ExecKeyboard(); break;
case ID_CALIBRATE: _ExecCalibration(); break;
case ID_TESTCAL: _TestCalibration(); break;
}
} while (r && (r!='n') && (r!='N'));
}
示例10: _cbWindow
/*******************************************************************
*
* _cbWindow
*/
static void _cbWindow(WM_MESSAGE* pMsg) {
GUI_RECT Rect;
switch (pMsg->MsgId) {
case WM_PAINT:
WM_GetInsideRect(&Rect);
GUI_SetBkColor(GUI_RED);
GUI_SetColor(GUI_YELLOW);
GUI_ClearRectEx(&Rect);
GUI_DrawRectEx(&Rect);
GUI_SetColor(GUI_BLACK);
GUI_SetFont(&GUI_Font8x16);
GUI_DispStringHCenterAt("Foreground window", 75, 40);
break;
default:
WM_DefaultProc(pMsg);
}
}
示例11: _UserDraw
static void _UserDraw(WM_HWIN hWin, int Stage) {
if (Stage == GRAPH_DRAW_LAST)
{
char acText[] = "Flow Rate L/s";
GUI_RECT Rect;
GUI_RECT RectInvalid;
int FontSizeY;
GUI_SetFont(&GUI_Font13_ASCII);
FontSizeY = GUI_GetFontSizeY();
WM_GetInsideRect(&Rect);
WM_GetInvalidRect(hWin, &RectInvalid);
Rect.x1 = Rect.x0 + FontSizeY;
GUI_SetColor(GUI_RED);
GUI_DispStringInRectEx(acText, &Rect, GUI_TA_HCENTER, strlen(acText), GUI_ROTATE_CCW);
}
}
示例12: test_gui
/*******************************************************************************
* Function Name : testgui
* Description : GUI测试函数,初化后,显示数据
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void test_gui(void)
{
int i;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE);
GUI_Init();
GUI_Initialized = 1;
GUI_DispChars('/', 53);
for( i= 0; i < 240; i += 8)
{
GUI_DispCharAt('/', 312, i);
GUI_DispCharAt('/', 1, i);
}
GUI_DispChars('/', 52);
GUI_SetFont(&GUI_Font24B_ASCII);
GUI_SetColor(GUI_RED);
GUI_DispStringAt("This is a test program!",10,110);
}
示例13: _cbBk
/*********************************************************************
*
* _cbBk
*/
static void _cbBk(WM_MESSAGE * pMsg) {
int xSize, ySize;
switch (pMsg->MsgId) {
case WM_PAINT:
xSize = LCD_GetXSize();
ySize = LCD_GetYSize();
GUI_DrawGradientV(0, 0, xSize, ySize, GUI_BLUE, GUI_BLACK);
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_Font24_ASCII);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_DispStringHCenterAt("WIDGET_Spinbox - Sample", 160, 5);
break;
default:
WM_DefaultProc(pMsg);
}
}
示例14: main
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_CRC_Init();
MX_USART1_UART_Init();
// MX_RTC_Init(); /**< 重新用cube生成工程时 注释掉此函数 再下载 */
/* USER CODE BEGIN 2 */
rtc_init(); /**< 使用改造后的初始化函数实现备份掉电时的数据 */
GUI_Init();
GUI_UC_SetEncodeUTF8();
GUI_SetFont(&GUI_Font24B_1);
GUI_SetBkColor(GUI_BLACK);
GUI_SetColor(GUI_GREEN);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
RTC_display_current_time(20, 170);
RTC_display_current_date(120, 170);
}
/* USER CODE END 3 */
}
示例15: main
int main(void)
{
GUI_MEMDEV_Handle hMem0,hMem1;
SysTick_Config(180000);
SDRAM_Init();
LCD_Config();
GUI_Init();
GUI_SetFont(&GUI_Font32B_ASCII);
GUI_SetBkColor(GUI_BLUE);
GUI_SetColor(GUI_YELLOW);
GUI_Clear();
// GUI_DispStringAt("blacklight",0,100);
// GUIDEMO_Main();
hMem0 = GUI_MEMDEV_CreateFixed(0,0,100,50,GUI_MEMDEV_NOTRANS,GUI_MEMDEV_APILIST_32,GUI_COLOR_CONV_888);
hMem1 = GUI_MEMDEV_CreateFixed(0,0,100,50,GUI_MEMDEV_NOTRANS,GUI_MEMDEV_APILIST_32,GUI_COLOR_CONV_888);
GUI_MEMDEV_Select(hMem0);
GUI_Clear();
GUI_DispString("Text");
GUI_MEMDEV_CopyToLCDAt(hMem0,0,0);
while(1)
{
GUI_MEMDEV_Select(hMem1);
GUI_MEMDEV_DrawPerspectiveX(hMem0,0,0,50,50-50*i/100,100-100*i/100,25*i/100);
GUI_MEMDEV_CopyToLCDAt(hMem1,i,50+i);
GUI_Delay(10);
GUI_MEMDEV_Select(hMem1);
GUI_Clear();
GUI_MEMDEV_CopyToLCDAt(hMem1,i,50+i);
i+=1;
if(i>100)
{
i=0;
}
}
while(1);
}