aboutsummaryrefslogtreecommitdiffstats
path: root/demos/modules/ginput_touch_driver_test/main.c
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2012-12-16 08:58:59 -0800
committerTectu <joel@unormal.org>2012-12-16 08:58:59 -0800
commit4743790cd40832205f701a280acd622cd003a9fd (patch)
tree088919aae5e2673621f6090dc79adac862c8c8a6 /demos/modules/ginput_touch_driver_test/main.c
parent09fc35864aa695cc46dcb95ed3951a365622b709 (diff)
parentf31a1f7f4aeb09bc09d49944daaf2f38fddd94e7 (diff)
downloaduGFX-4743790cd40832205f701a280acd622cd003a9fd.tar.gz
uGFX-4743790cd40832205f701a280acd622cd003a9fd.tar.bz2
uGFX-4743790cd40832205f701a280acd622cd003a9fd.zip
Merge pull request #26 from inmarket/master
Many tidyups and restructure.
Diffstat (limited to 'demos/modules/ginput_touch_driver_test/main.c')
-rw-r--r--demos/modules/ginput_touch_driver_test/main.c34
1 files changed, 8 insertions, 26 deletions
diff --git a/demos/modules/ginput_touch_driver_test/main.c b/demos/modules/ginput_touch_driver_test/main.c
index 78f29f86..a77e0b3f 100644
--- a/demos/modules/ginput_touch_driver_test/main.c
+++ b/demos/modules/ginput_touch_driver_test/main.c
@@ -18,30 +18,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/*
- * Make sure you have the following enabled in your halconf.h:
- *
- * #define GFX_USE_GDISP TRUE
- * #define GFX_USE_GINPUT TRUE
- * #define GFX_USE_GEVENT TRUE
- * #define GFX_USE_GTIMER TRUE
- * #define GFX_USE_GWIN TRUE
- *
- * #define GWIN_NEED_CONSOLE TRUE
- * #define GWIN_NEED_BUTTON TRUE
- *
- * #define GINPUT_NEED_MOUSE TRUE
- * #define GINPUT_NEED_TOUCH TRUE
- *
- * #define GDISP_NEED_CLIP TRUE
- */
-
#include "ch.h"
#include "hal.h"
#include "chprintf.h"
-#include "gdisp.h"
-#include "ginput.h"
-#include "gwin.h"
+#include "gfx.h"
static GConsoleObject gc;
static GButtonObject gNext;
@@ -60,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
@@ -71,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);
@@ -215,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);
@@ -246,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);