aboutsummaryrefslogtreecommitdiffstats
path: root/src/ginput
diff options
context:
space:
mode:
authorAndrew Hannam <andrewh@inmarket.com.au>2012-12-07 00:52:01 +1000
committerAndrew Hannam <andrewh@inmarket.com.au>2012-12-07 00:52:01 +1000
commit5873d87ca2185e825f1187eca3bc7f0de7437e69 (patch)
treeda1a2f56b60d9495cafef79734082660f39abaf2 /src/ginput
parentec89b8e82d890066f60c48349da062add76db6cd (diff)
downloaduGFX-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 'src/ginput')
-rw-r--r--src/ginput/mouse.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ginput/mouse.c b/src/ginput/mouse.c
index 67ee5667..5e762ef9 100644
--- a/src/ginput/mouse.c
+++ b/src/ginput/mouse.c
@@ -38,8 +38,8 @@
#error "GINPUT: GFX_USE_GDISP must be defined when mouse or touch calibration is required"
#endif
- #define GINPUT_MOUSE_CALIBRATION_FONT &fontUI2Double
- #define GINPUT_MOUSE_CALIBRATION_FONT2 &fontUI2Narrow
+ #define GINPUT_MOUSE_CALIBRATION_FONT "* Double"
+ #define GINPUT_MOUSE_CALIBRATION_FONT2 "* Narrow"
#define GINPUT_MOUSE_CALIBRATION_TEXT "Calibration"
#define GINPUT_MOUSE_CALIBRATION_ERROR_TEXT "Failed - Please try again!"
#define GINPUT_MOUSE_CALIBRATION_SAME_TEXT "Error: Same Reading - Check Driver!"
@@ -422,6 +422,7 @@ bool_t ginputCalibrateMouse(uint16_t instance) {
MousePoint *pt;
int32_t px, py;
unsigned i, j;
+ font_t font1, font2;
#if GINPUT_MOUSE_MAX_CALIBRATION_ERROR >= 0
unsigned err;
#endif
@@ -429,6 +430,9 @@ bool_t ginputCalibrateMouse(uint16_t instance) {
if (instance || (MouseConfig.flags & FLG_IN_CAL))
return FALSE;
+ font1 = gdispOpenFont(GINPUT_MOUSE_CALIBRATION_FONT);
+ font2 = gdispOpenFont(GINPUT_MOUSE_CALIBRATION_FONT2);
+
MouseConfig.flags |= FLG_IN_CAL;
gtimerStop(&MouseTimer);
MouseConfig.flags &= ~(FLG_CAL_OK|FLG_CAL_SAVED);
@@ -446,7 +450,7 @@ bool_t ginputCalibrateMouse(uint16_t instance) {
#endif
gdispClear(Blue);
- gdispFillStringBox(0, 5, width, 30, GINPUT_MOUSE_CALIBRATION_TEXT, GINPUT_MOUSE_CALIBRATION_FONT, White, Blue, justifyCenter);
+ gdispFillStringBox(0, 5, width, 30, GINPUT_MOUSE_CALIBRATION_TEXT, font1, White, Blue, justifyCenter);
for(i = 0, pt = points, pc = cross; i < GINPUT_MOUSE_CALIBRATION_POINTS; i++, pt++, pc++) {
_tsDrawCross(pc);
@@ -475,7 +479,7 @@ bool_t ginputCalibrateMouse(uint16_t instance) {
_tsClearCross(pc);
if (i >= 1 && pt->x == (pt-1)->x && pt->y == (pt-1)->y) {
- gdispFillStringBox(0, 35, width, 40, GINPUT_MOUSE_CALIBRATION_SAME_TEXT, GINPUT_MOUSE_CALIBRATION_FONT2, Red, Yellow, justifyCenter);
+ gdispFillStringBox(0, 35, width, 40, GINPUT_MOUSE_CALIBRATION_SAME_TEXT, font2, Red, Yellow, justifyCenter);
chThdSleepMilliseconds(5000);
gdispFillArea(0, 35, width, 40, Blue);
}
@@ -503,12 +507,14 @@ bool_t ginputCalibrateMouse(uint16_t instance) {
if (err <= GINPUT_MOUSE_MAX_CALIBRATION_ERROR * GINPUT_MOUSE_MAX_CALIBRATION_ERROR)
break;
- gdispFillStringBox(0, 35, width, 40, GINPUT_MOUSE_CALIBRATION_ERROR_TEXT, GINPUT_MOUSE_CALIBRATION_FONT2, Red, Yellow, justifyCenter);
+ gdispFillStringBox(0, 35, width, 40, GINPUT_MOUSE_CALIBRATION_ERROR_TEXT, font2, Red, Yellow, justifyCenter);
chThdSleepMilliseconds(5000);
}
#endif
// Restart everything
+ gdispCloseFont(font1);
+ gdispCloseFont(font2);
MouseConfig.flags |= FLG_CAL_OK;
MouseConfig.last_buttons = 0;
get_calibrated_reading(&MouseConfig.t);