Multiple Displays demo - use sprintg instead of sprintf.

Make multiple display settings set-able in the makefile.
ugfx_release_2.6
inmarket 2015-02-05 00:17:38 +10:00
parent d8e46a098d
commit 189bad3e6a
2 changed files with 19 additions and 6 deletions

View File

@ -59,7 +59,7 @@
*
* You must specify a GDISP_PIXELFORMAT that the application will work in. This
* is translated into each drivers internal pixel format by the driver. You the
* pixel format that is most common accross your drivers (for efficiency).
* pixel format that is most common across your drivers (for efficiency).
*
* Optionally, you can also specify hardware characteristics that are common to
* all your controllers. This significantly improves code and speed efficiency
@ -76,9 +76,22 @@
* #define GDISP_HARDWARE_DRAWPIXEL TRUE
* #define GDISP_HARDWARE_FILLS TRUE
*/
#define GDISP_TOTAL_DISPLAYS 2
#if GFX_USE_OS_WIN32 || GFX_USE_OS_LINUX || GFX_USE_OS_OSX
// Emulator
#define GDISP_TOTAL_DISPLAYS 2
//#define GDISP_DRIVER_LIST GDISPVMT_Win32, GDISPVMT_Win32
//#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
//#define GDISP_DRIVER_LIST GDISPVMT_Win32, GDISPVMT_Win32
//#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
#elif !defined(GDISP_TOTAL_DISPLAYS) && (!defined(GDISP_PIXELFORMAT) || !defined(GDISP_DRIVER_LIST))
#error "gfxconf.h: You have not defined multiple displays properly. Try defining GDISP_TOTAL_DISPLAY or, GDISP_PIXELFORMAT and GDISP_DRIVER_LIST in your makefile"
#endif
/*
* The following are needed only for the sprintg() call
*/
#define GFX_USE_GFILE TRUE
#define GFILE_NEED_PRINTG TRUE
#define GFILE_NEED_STRINGS TRUE
#endif /* _GFXCONF_H */

View File

@ -70,7 +70,7 @@
/* Draw draw draw */
gdispGDrawBox(g, 10, 10, width/2, height/2, Yellow);
sprintf(buf, "Display %u", display);
sprintg(buf, "Display %u", display);
gdispGFillStringBox(g, width/2, height/2, width/2-10, height/2-10, buf, f, White, Blue, justifyCenter);
gdispGDrawLine(g, 5, 30, width-50, height-40, Red);
@ -108,7 +108,7 @@
/* Draw draw draw */
gdispDrawBox(10, 10, width/2, height/2, Yellow);
sprintf(buf, "Display %u", display);
sprintg(buf, "Display %u", display);
gdispFillStringBox(width/2, height/2, width/2-10, height/2-10, buf, f, White, Blue, justifyCenter);
gdispDrawLine(5, 30, width-50, height-40, Red);