diff options
author | Andrew Hannam <andrewh@inmarket.com.au> | 2012-12-07 00:52:01 +1000 |
---|---|---|
committer | Andrew Hannam <andrewh@inmarket.com.au> | 2012-12-07 00:52:01 +1000 |
commit | 5873d87ca2185e825f1187eca3bc7f0de7437e69 (patch) | |
tree | da1a2f56b60d9495cafef79734082660f39abaf2 /demos/modules/ginput_touch_driver_test | |
parent | ec89b8e82d890066f60c48349da062add76db6cd (diff) | |
download | uGFX-5873d87ca2185e825f1187eca3bc7f0de7437e69.tar.gz uGFX-5873d87ca2185e825f1187eca3bc7f0de7437e69.tar.bz2 uGFX-5873d87ca2185e825f1187eca3bc7f0de7437e69.zip |
Add GDISP font routines. Fix demo bugs
Add GDISP font routines to Open and Close a font by name.
Allows wildcard searching for fonts.
Old global font variables are now only optionally included (soon to be
deprecated).
More demo fixing
Diffstat (limited to 'demos/modules/ginput_touch_driver_test')
-rw-r--r-- | demos/modules/ginput_touch_driver_test/gfxconf.h | 8 | ||||
-rw-r--r-- | demos/modules/ginput_touch_driver_test/main.c | 12 |
2 files changed, 15 insertions, 5 deletions
diff --git a/demos/modules/ginput_touch_driver_test/gfxconf.h b/demos/modules/ginput_touch_driver_test/gfxconf.h index a6d40f06..7be662b5 100644 --- a/demos/modules/ginput_touch_driver_test/gfxconf.h +++ b/demos/modules/ginput_touch_driver_test/gfxconf.h @@ -30,6 +30,14 @@ #define GDISP_NEED_ASYNC FALSE
#define GDISP_NEED_MSGAPI FALSE
+/* Builtin Fonts */
+#define GDISP_OLD_FONT_DEFINITIONS FALSE
+#define GDISP_INCLUDE_FONT_SMALL FALSE
+#define GDISP_INCLUDE_FONT_LARGER FALSE
+#define GDISP_INCLUDE_FONT_UI1 FALSE
+#define GDISP_INCLUDE_FONT_UI2 TRUE
+#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
+
/* Features for the GWIN sub-system. */
#define GWIN_NEED_BUTTON TRUE
#define GWIN_NEED_CONSOLE TRUE
diff --git a/demos/modules/ginput_touch_driver_test/main.c b/demos/modules/ginput_touch_driver_test/main.c index d8fe1739..a77e0b3f 100644 --- a/demos/modules/ginput_touch_driver_test/main.c +++ b/demos/modules/ginput_touch_driver_test/main.c @@ -40,6 +40,7 @@ int main(void) { GHandle ghc, ghNext, ghPrev;
BaseSequentialStream *gp;
GEventType deviceType;
+ font_t font;
halInit(); // Initialise the Hardware
chSysInit(); // Initialize the OS
@@ -51,10 +52,11 @@ int main(void) { ghNext = ghPrev = 0;
// Create our title
- gdispFillStringBox(0, 0, swidth, 20, "Touch Calibration", &fontUI2, Red, White, justifyLeft);
+ font = gdispOpenFont("UI2");
+ gdispFillStringBox(0, 0, swidth, 20, "Touch Calibration", font, Red, White, justifyLeft);
// Create our main display window
- ghc = gwinCreateConsole(&gc, 0, 20, swidth, sheight-20, &fontUI2);
+ ghc = gwinCreateConsole(&gc, 0, 20, swidth, sheight-20, font);
gwinClear(ghc);
gp = gwinGetConsoleStream(ghc);
@@ -195,13 +197,13 @@ StepCalibrate: /* From now on we can use Next and Previous Buttons */
if (!ghNext) {
- ghNext = gwinCreateButton(&gNext, swidth-50, 0, 50, 20, &fontUI2, GBTN_NORMAL);
+ ghNext = gwinCreateButton(&gNext, swidth-50, 0, 50, 20, font, GBTN_NORMAL);
gwinSetButtonText(ghNext, "Next", FALSE);
gsNext = gwinGetButtonSource(ghNext);
geventAttachSource(&gl, gsNext, 0);
gwinAttachButtonMouseSource(ghNext, gs);
- ghPrev = gwinCreateButton(&gPrev, swidth-100, 0, 50, 20, &fontUI2, GBTN_NORMAL);
+ ghPrev = gwinCreateButton(&gPrev, swidth-100, 0, 50, 20, font, GBTN_NORMAL);
gwinSetButtonText(ghPrev, "Back", FALSE);
gsPrev = gwinGetButtonSource(ghPrev);
geventAttachSource(&gl, gsPrev, 0);
@@ -226,7 +228,7 @@ StepCalibrate: }
// Calibration used the whole screen - re-establish our title
- gdispFillStringBox(0, 0, swidth, 20, "Touch Calibration", &fontUI2, Green, White, justifyLeft);
+ gdispFillStringBox(0, 0, swidth, 20, "Touch Calibration", font, Green, White, justifyLeft);
gwinButtonDraw(ghNext);
gwinButtonDraw(ghPrev);
|