diff options
author | inmarket <andrewh@inmarket.com.au> | 2015-02-05 00:17:38 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2015-02-05 00:17:38 +1000 |
commit | 189bad3e6a4e6d38e34eee0abebd9986260e95ce (patch) | |
tree | 796d61110cce1e8f2d5b8aa2ade4f39ec20ea545 | |
parent | d8e46a098d1f7a0f1cf2eb3a45aca111fae037f8 (diff) | |
download | uGFX-189bad3e6a4e6d38e34eee0abebd9986260e95ce.tar.gz uGFX-189bad3e6a4e6d38e34eee0abebd9986260e95ce.tar.bz2 uGFX-189bad3e6a4e6d38e34eee0abebd9986260e95ce.zip |
Multiple Displays demo - use sprintg instead of sprintf.
Make multiple display settings set-able in the makefile.
-rw-r--r-- | demos/modules/gdisp/multiple_displays/gfxconf.h | 21 | ||||
-rw-r--r-- | demos/modules/gdisp/multiple_displays/main.c | 4 |
2 files changed, 19 insertions, 6 deletions
diff --git a/demos/modules/gdisp/multiple_displays/gfxconf.h b/demos/modules/gdisp/multiple_displays/gfxconf.h index 959f1d0b..42e0b5e8 100644 --- a/demos/modules/gdisp/multiple_displays/gfxconf.h +++ b/demos/modules/gdisp/multiple_displays/gfxconf.h @@ -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 */ diff --git a/demos/modules/gdisp/multiple_displays/main.c b/demos/modules/gdisp/multiple_displays/main.c index c4c37bed..387ca690 100644 --- a/demos/modules/gdisp/multiple_displays/main.c +++ b/demos/modules/gdisp/multiple_displays/main.c @@ -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); |