| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- /*********************************************************************
- * SEGGER Microcontroller GmbH & Co. KG *
- * Solutions for real time microcontroller applications *
- **********************************************************************
- * *
- * (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG *
- * *
- * Internet: www.segger.com Support: support@segger.com *
- * *
- **********************************************************************
- ** emWin V5.32 - Graphical user interface for embedded applications **
- All Intellectual Property rights in the Software belongs to SEGGER.
- emWin is protected by international copyright laws. Knowledge of the
- source code may not be used to write a similar product. This file may
- only be used in accordance with the following terms:
- The software has been licensed to STMicroelectronics International
- N.V. a Dutch company with a Swiss branch and its headquarters in Plan-
- les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the
- purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_
- troller products commercialized by Licensee only, sublicensed and dis_
- tributed under the terms and conditions of the End User License Agree_
- ment supplied by STMicroelectronics International N.V.
- Full source code is available at: www.segger.com
- We appreciate your understanding and fairness.
- ----------------------------------------------------------------------
- Licensing information
- Licensor: SEGGER Software GmbH
- Licensed to: STMicroelectronics International NV
- Licensed SEGGER software: emWin
- License number: GUI-00429
- License model: Buyout SRC [Buyout Source Code License, signed November 29th 2012]
- Licensed product: -
- Licensed platform: STMs ARM Cortex-M based 32 BIT CPUs
- Licensed number of seats: -
- ----------------------------------------------------------------------
- File : GUIDEMO_VScreen.c
- Purpose : Virtual screen demo
- ----------------------------------------------------------------------
- */
- #include "GUIDEMO.h"
- #if (SHOW_GUIDEMO_VSCREEN)
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * _Loop
- */
- static int _Loop(int y, int d, int n, int Delay) {
- do {
- y += d;
- GUI_SetOrg(0, y);
- GUI_Delay(Delay);
- if (GUIDEMO_CheckCancel()) {
- return 1;
- }
- } while (--n);
- return 0;
- }
- /*********************************************************************
- *
- * _DemoVScreen
- */
- static void _DemoVScreen(void) {
- GUI_RECT Rect;
- unsigned j;
- int xSize;
- int ySize;
- int n;
- int aDelay[] = { 20, 5 };
- 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);
- }
- /*********************************************************************
- *
- * Public code
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * GUIDEMO_VScreen
- */
- void GUIDEMO_VScreen(void) {
- int vySize;
- int ySize;
- ySize = LCD_GetYSize();
- vySize = LCD_GetVYSize();
- if (vySize < (ySize * 2)) {
- GUIDEMO_ConfigureDemo("Virtual Screen", "Works only with a virtual screen with at least twice the ySize of the display.\nDemo will be skipped...", GUIDEMO_SHOW_CURSOR | GUIDEMO_SHOW_INFO | GUIDEMO_SHOW_CONTROL);
- return;
- }
- GUIDEMO_ConfigureDemo("Virtual Screen", "Demonstrates how to use\nvirtual screens", GUIDEMO_SHOW_CURSOR | GUIDEMO_SHOW_INFO | GUIDEMO_SHOW_CONTROL);
- GUIDEMO_DrawBk();
- _DemoVScreen();
- GUI_SetOrg(0, 0);
- }
- #else
- void GUIDEMO_VScreen_C(void);
- void GUIDEMO_VScreen_C(void) {}
- #endif // SHOW_GUIDEMO_VSCREEN
- /*************************** End of file ****************************/
|