aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
Diffstat (limited to 'demos')
-rw-r--r--demos/3rdparty/boing/gfxconf.h41
-rw-r--r--demos/3rdparty/boing/main.c109
-rw-r--r--demos/3rdparty/bubbles/gfxconf.h9
-rw-r--r--demos/3rdparty/notepad-2/gfxconf.h9
-rw-r--r--demos/3rdparty/tdisp_f4_discovery/gfxconf.h7
-rw-r--r--demos/applications/mandelbrot/gfxconf.h20
-rw-r--r--demos/applications/notepad/gfxconf.h14
-rw-r--r--demos/benchmarks/gfxconf.h21
-rw-r--r--demos/modules/gadc/gfxconf.h77
-rw-r--r--demos/modules/gaudin/gfxconf.h84
-rw-r--r--demos/modules/gdisp/basics/gfxconf.h6
-rw-r--r--demos/modules/gdisp/circles/gfxconf.h6
-rw-r--r--demos/modules/gdisp/fonts/gfxconf.h22
-rw-r--r--demos/modules/gdisp/fonts_cyrillic/gfxconf.h10
-rw-r--r--demos/modules/gdisp/images/gfxconf.h6
-rw-r--r--demos/modules/gdisp/images_animated/gfxconf.h6
-rw-r--r--demos/modules/gdisp/multiple_displays/gfxconf.h80
-rw-r--r--demos/modules/gdisp/multiple_displays/main.c122
-rw-r--r--demos/modules/gdisp/streaming/gfxconf.h31
-rw-r--r--demos/modules/gdisp/streaming/main.c142
-rw-r--r--demos/modules/ginput/touch_driver_test/gfxconf.h21
-rw-r--r--demos/modules/gtimer/gfxconf.h9
-rw-r--r--demos/modules/gwin/basic/gfxconf.h6
-rw-r--r--demos/modules/gwin/button/gfxconf.h6
-rw-r--r--demos/modules/gwin/checkbox/gfxconf.h6
-rw-r--r--demos/modules/gwin/console/gfxconf.h6
-rw-r--r--demos/modules/gwin/graph/gfxconf.h6
-rw-r--r--demos/modules/gwin/list/gfxconf.h6
-rw-r--r--demos/modules/gwin/radio/gfxconf.h6
-rw-r--r--demos/modules/gwin/slider/gfxconf.h6
-rw-r--r--demos/modules/gwin/widgets/gfxconf.h12
-rw-r--r--demos/modules/tdisp/gfxconf.h9
32 files changed, 487 insertions, 434 deletions
diff --git a/demos/3rdparty/boing/gfxconf.h b/demos/3rdparty/boing/gfxconf.h
deleted file mode 100644
index 0afcd45b..00000000
--- a/demos/3rdparty/boing/gfxconf.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * This file has a different license to the rest of the GFX system.
- * You can copy, modify and distribute this file as you see fit.
- * You do not need to publish your source modifications to this file.
- * The only thing you are not permitted to do is to relicense it
- * under a different license.
- */
-
-#ifndef _GFXCONF_H
-#define _GFXCONF_H
-
-/* The operating system to use - one of these must be defined */
-#define GFX_USE_OS_CHIBIOS TRUE
-#define GFX_USE_OS_WIN32 FALSE
-#define GFX_USE_OS_POSIX FALSE
-
-/* GFX sub-systems to turn on */
-#define GFX_USE_GDISP TRUE
-
-/* Features for the GDISP sub-system. */
-#define GDISP_NEED_VALIDATION FALSE
-#define GDISP_NEED_CLIP FALSE
-#define GDISP_NEED_TEXT FALSE
-#define GDISP_NEED_CIRCLE FALSE
-#define GDISP_NEED_ELLIPSE FALSE
-#define GDISP_NEED_ARC FALSE
-#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD FALSE
-#define GDISP_NEED_CONTROL FALSE
-#define GDISP_NEED_MULTITHREAD FALSE
-#define GDISP_NEED_ASYNC FALSE
-#define GDISP_NEED_MSGAPI FALSE
-
-/* Builtin Fonts */
-#define GDISP_INCLUDE_FONT_SMALL FALSE
-#define GDISP_INCLUDE_FONT_LARGER FALSE
-#define GDISP_INCLUDE_FONT_UI1 FALSE
-#define GDISP_INCLUDE_FONT_UI2 FALSE
-#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
-
-#endif /* _GFXCONF_H */
diff --git a/demos/3rdparty/boing/main.c b/demos/3rdparty/boing/main.c
deleted file mode 100644
index 96ba5c9d..00000000
--- a/demos/3rdparty/boing/main.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Derived from the 2011 IOCCC submission by peter.eastman@gmail.com
- * http://www.ioccc.org/2011/eastman/eastman.c
- * --
- * Public Domain -- but you're looking at this for ideas of techniques
- * and methods, not trying to cut&paste an entire application, anyway.
- * --
- * When you need to blit an entire screenfull of data to an LCD
- * display, the basic idea is to exploit the auto-increment feature of
- * the display controller when it writes to screen memory. You start
- * by resetting the 'cursor' to the 0,0 position, and then stream
- * width*height pixels out.
- * --
- * Chris Baird,, <cjb@brushtail.apana.org.au> April 2013
- *
- * Modified Andrew Hannam (inmarket) 2013-04-29 New GFX support
- */
-
-#include <math.h>
-#include "gfx.h"
-#include "ssd2119.h"
-
-#define Lightgrey (HTML2COLOR(0xC0C0C0))
-#define Midgrey (HTML2COLOR(0x606060))
-#define Darkgrey (HTML2COLOR(0x303030))
-
-
-/* ---------------------------------------------------------------------- */
-/* As of early April 2013, the /gfx extension tries to keep the low-level
- * stuff away from our filthy paws. So Code Duplication.
- * (Possibly to be replaced with gdispStartStream(), gdispWriteStream()
- * and gdispStopStream() in the future.)
- */
-
-#define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* DC = 0 */
-#define GDISP_RAM (*((volatile uint16_t *) 0x60100000)) /* DC = 1 */
-
-inline void write_index (uint16_t index) { GDISP_REG = index; }
-inline void write_data (uint16_t data) { GDISP_RAM = data; }
-
-#define write_reg(reg, data) { write_index(reg); write_data(data); }
-
-void reset_cursor (void)
-{
- write_reg (SSD2119_REG_X_RAM_ADDR, 0);
- write_reg (SSD2119_REG_Y_RAM_ADDR, 0);
-}
-
-#define StartStream() { write_index (SSD2119_REG_RAM_DATA); }
-#define WriteStream(x) { write_data (x); }
-#define StopStream() /* NOP */
-
-
-/* ---------------------------------------------------------------------- */
-
-void main (void)
-{
- uint16_t xx, yy, colour;
-
- gfxInit();
-
- uint16_t width = (uint16_t)gdispGetWidth();
- uint16_t height = (uint16_t)gdispGetHeight();
-
- float i=height/5+height%2+1, floorstart=height/5-1, spherespin=0.0,
- l=width/2, m=height/4, n=.01*width, o=0.0, rotspeed=0.1, h, f, g;
-
- while (TRUE)
- {
- reset_cursor ();
- StartStream ();
-
- for (xx=yy=0;
- h = (m-yy)/i, f=-.3*(g=(l-xx)/i)+.954*h, yy<height;
- yy += (xx = ++xx%width)==0 )
- {
- if (g*g < 1-h*h) /* if inside the ball */
- if (((int)(9-spherespin+(.954*g+.3*h)/sqrtf(1-f*f))+(int)(2+f*2))%2==0)
- colour = Red;
- else
- colour = White;
- else
- {
- if (xx<floorstart || xx>width-floorstart)
- colour = Darkgrey; /* side wall */
- else
- colour = Lightgrey; /* back wall */
-
- if (yy > height-floorstart)
- if (xx < height-yy || height-yy > width-xx) /* floor */
- colour = Darkgrey;
- else
- colour = Midgrey;
-
- if (g*(g+.6)+.09+h*h < 1)
- colour >>= 1; /* ball shadow; make it darker */
- }
-
- WriteStream (colour); /* pixel to the LCD */
- }
-
- StopStream();
- spherespin += rotspeed;
- m += o;
- o = m > height-1.75*floorstart ? -.04*height : o+.002*height;
- n = (l+=n)<i || l>width-i ? rotspeed=-rotspeed,-n : n;
- }
-}
-
-/* ---------------------------------------------------------------------- */
diff --git a/demos/3rdparty/bubbles/gfxconf.h b/demos/3rdparty/bubbles/gfxconf.h
index 344a986e..1ecfc544 100644
--- a/demos/3rdparty/bubbles/gfxconf.h
+++ b/demos/3rdparty/bubbles/gfxconf.h
@@ -9,10 +9,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use - one of these must be defined */
-#define GFX_USE_OS_CHIBIOS TRUE
-#define GFX_USE_OS_WIN32 FALSE
-#define GFX_USE_OS_POSIX FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/3rdparty/notepad-2/gfxconf.h b/demos/3rdparty/notepad-2/gfxconf.h
index 7f436596..869b2ab2 100644
--- a/demos/3rdparty/notepad-2/gfxconf.h
+++ b/demos/3rdparty/notepad-2/gfxconf.h
@@ -9,10 +9,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* GFX operating system to use */
-#define GFX_USE_OS_CHIBIOS TRUE
-//#define GFX_USE_OS_WIN32 TRUE
-//#define GFX_USE_OS_POSIX TRUE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/3rdparty/tdisp_f4_discovery/gfxconf.h b/demos/3rdparty/tdisp_f4_discovery/gfxconf.h
index 6d69b3c8..c00e3941 100644
--- a/demos/3rdparty/tdisp_f4_discovery/gfxconf.h
+++ b/demos/3rdparty/tdisp_f4_discovery/gfxconf.h
@@ -14,6 +14,12 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
+
/* GFX subsystems to turn on */
#define GFX_USE_GDISP FALSE
#define GFX_USE_TDISP TRUE
@@ -130,7 +136,6 @@
/* Optional Low Level Driver Definitions */
/*
- #define GDISP_USE_CUSTOM_BOARD FALSE
#define GDISP_SCREEN_WIDTH 320
#define GDISP_SCREEN_HEIGHT 240
#define GDISP_USE_FSMC
diff --git a/demos/applications/mandelbrot/gfxconf.h b/demos/applications/mandelbrot/gfxconf.h
index c2c56714..99a04b5c 100644
--- a/demos/applications/mandelbrot/gfxconf.h
+++ b/demos/applications/mandelbrot/gfxconf.h
@@ -30,26 +30,16 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use - one of these must be defined */
-#define GFX_USE_OS_CHIBIOS TRUE
-#define GFX_USE_OS_WIN32 FALSE
-#define GFX_USE_OS_POSIX FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
-#define GDISP_NEED_CLIP FALSE
-#define GDISP_NEED_TEXT FALSE
-#define GDISP_NEED_CIRCLE FALSE
-#define GDISP_NEED_ELLIPSE FALSE
-#define GDISP_NEED_ARC FALSE
-#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD FALSE
-#define GDISP_NEED_CONTROL FALSE
-#define GDISP_NEED_MULTITHREAD FALSE
-#define GDISP_NEED_ASYNC FALSE
-#define GDISP_NEED_MSGAPI FALSE
#endif /* _GFXCONF_H */
diff --git a/demos/applications/notepad/gfxconf.h b/demos/applications/notepad/gfxconf.h
index 95d5dc5e..7ffb22fa 100644
--- a/demos/applications/notepad/gfxconf.h
+++ b/demos/applications/notepad/gfxconf.h
@@ -30,14 +30,14 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use - one of these must be defined */
-//#define GFX_USE_OS_CHIBIOS TRUE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
-//#define GFX_USE_OS_POSIX FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
#define GFX_USE_GEVENT TRUE
#define GFX_USE_GTIMER TRUE
#define GFX_USE_GINPUT TRUE
@@ -47,14 +47,8 @@
#define GDISP_NEED_CLIP TRUE
#define GDISP_NEED_TEXT TRUE
#define GDISP_NEED_CIRCLE TRUE
-#define GDISP_NEED_ELLIPSE FALSE
-#define GDISP_NEED_ARC FALSE
-#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD FALSE
#define GDISP_NEED_CONTROL TRUE
#define GDISP_NEED_MULTITHREAD TRUE
-#define GDISP_NEED_ASYNC FALSE
-#define GDISP_NEED_MSGAPI FALSE
/* Builtin Fonts */
#define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA TRUE
diff --git a/demos/benchmarks/gfxconf.h b/demos/benchmarks/gfxconf.h
index 36a6c5b9..aaacd3a2 100644
--- a/demos/benchmarks/gfxconf.h
+++ b/demos/benchmarks/gfxconf.h
@@ -30,10 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use - one of these must be defined */
-#define GFX_USE_OS_CHIBIOS TRUE
-#define GFX_USE_OS_WIN32 FALSE
-#define GFX_USE_OS_POSIX FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
@@ -42,22 +43,10 @@
#define GDISP_NEED_VALIDATION FALSE
#define GDISP_NEED_CLIP FALSE
#define GDISP_NEED_TEXT TRUE
-#define GDISP_NEED_CIRCLE FALSE
-#define GDISP_NEED_ELLIPSE FALSE
-#define GDISP_NEED_ARC FALSE
-#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD FALSE
#define GDISP_NEED_CONTROL TRUE
-#define GDISP_NEED_MULTITHREAD FALSE
-#define GDISP_NEED_ASYNC FALSE
-#define GDISP_NEED_MSGAPI FALSE
/* Builtin Fonts */
-#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
#endif /* _GFXCONF_H */
diff --git a/demos/modules/gadc/gfxconf.h b/demos/modules/gadc/gfxconf.h
index ff306763..297265b5 100644
--- a/demos/modules/gadc/gfxconf.h
+++ b/demos/modules/gadc/gfxconf.h
@@ -35,96 +35,29 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use - one of these must be defined */
-#define GFX_USE_OS_CHIBIOS TRUE
-#define GFX_USE_OS_WIN32 FALSE
-#define GFX_USE_OS_POSIX FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_TDISP FALSE
#define GFX_USE_GWIN TRUE
-#define GFX_USE_GEVENT FALSE
#define GFX_USE_GTIMER TRUE
-#define GFX_USE_GINPUT FALSE
#define GFX_USE_GADC TRUE
-#define GFX_USE_GAUDIN FALSE
-#define GFX_USE_GAUDOUT FALSE
-#define GFX_USE_GMISC FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE
#define GDISP_NEED_TEXT TRUE
-#define GDISP_NEED_CIRCLE FALSE
-#define GDISP_NEED_ELLIPSE FALSE
-#define GDISP_NEED_ARC FALSE
-#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD FALSE
#define GDISP_NEED_CONTROL TRUE
#define GDISP_NEED_MULTITHREAD TRUE
-#define GDISP_NEED_ASYNC FALSE
-#define GDISP_NEED_MSGAPI FALSE
/* GDISP - builtin fonts */
-#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 TDISP subsystem. */
-#define TDISP_NEED_MULTITHREAD FALSE
/* Features for the GWIN sub-system. */
-#define GWIN_NEED_BUTTON FALSE
#define GWIN_NEED_CONSOLE TRUE
-#define GWIN_NEED_GRAPH FALSE
-
-/* Features for the GEVENT sub-system. */
-#define GEVENT_ASSERT_NO_RESOURCE FALSE
-
-/* Features for the GTIMER sub-system. */
-/* NONE */
-
-/* Features for the GINPUT sub-system. */
-#define GINPUT_NEED_MOUSE FALSE
-#define GINPUT_NEED_KEYBOARD FALSE
-#define GINPUT_NEED_TOGGLE FALSE
-#define GINPUT_NEED_DIAL FALSE
-
-/* Features for the GADC sub-system. */
-/* NONE */
-
-/* Features for the GAUDIN sub-system. */
-/* NONE */
-
-/* Features for the GAUDOUT sub-system. */
-/* NONE */
-
-/* Features for the GMISC sub-system. */
-#define GMISC_NEED_ARRAYOPS FALSE
-
-/* Optional Parameters for various sub-systems */
-/*
- #define GDISP_MAX_FONT_HEIGHT 16
- #define GEVENT_MAXIMUM_SIZE 32
- #define GEVENT_MAX_SOURCE_LISTENERS 32
- #define GTIMER_THREAD_WORKAREA_SIZE 512
- #define GADC_MAX_LOWSPEED_DEVICES 4
-*/
-
-/* Optional Low Level Driver Definitions */
-/*
- #define GDISP_USE_CUSTOM_BOARD FALSE
- #define GDISP_SCREEN_WIDTH 320
- #define GDISP_SCREEN_HEIGHT 240
- #define GDISP_USE_FSMC
- #define GDISP_USE_GPIO
- #define GDISP_VMT_NAME1(x) x##YourDriver1
- #define GDISP_VMT_NAME2(x) x##YourDriver2
- #define TDISP_COLUMNS 16
- #define TDISP_ROWS 2
-*/
#endif /* _GFXCONF_H */
diff --git a/demos/modules/gaudin/gfxconf.h b/demos/modules/gaudin/gfxconf.h
index a17e4fd9..9525a020 100644
--- a/demos/modules/gaudin/gfxconf.h
+++ b/demos/modules/gaudin/gfxconf.h
@@ -35,96 +35,22 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use - one of these must be defined */
-#define GFX_USE_OS_CHIBIOS TRUE
-#define GFX_USE_OS_WIN32 FALSE
-#define GFX_USE_OS_POSIX FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_TDISP FALSE
#define GFX_USE_GWIN TRUE
-#define GFX_USE_GEVENT FALSE
#define GFX_USE_GTIMER TRUE
-#define GFX_USE_GINPUT FALSE
#define GFX_USE_GADC TRUE
#define GFX_USE_GAUDIN TRUE
-#define GFX_USE_GAUDOUT FALSE
-#define GFX_USE_GMISC FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE
-#define GDISP_NEED_TEXT FALSE
-#define GDISP_NEED_CIRCLE FALSE
-#define GDISP_NEED_ELLIPSE FALSE
-#define GDISP_NEED_ARC FALSE
-#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD FALSE
-#define GDISP_NEED_CONTROL FALSE
#define GDISP_NEED_MULTITHREAD TRUE
-#define GDISP_NEED_ASYNC FALSE
-#define GDISP_NEED_MSGAPI FALSE
-
-/* GDISP - builtin fonts */
-#define GDISP_INCLUDE_FONT_SMALL FALSE
-#define GDISP_INCLUDE_FONT_LARGER FALSE
-#define GDISP_INCLUDE_FONT_UI1 FALSE
-#define GDISP_INCLUDE_FONT_UI2 FALSE
-#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
-
-/* Features for the TDISP subsystem. */
-#define TDISP_NEED_MULTITHREAD FALSE
-
-/* Features for the GWIN sub-system. */
-#define GWIN_NEED_BUTTON FALSE
-#define GWIN_NEED_CONSOLE FALSE
-#define GWIN_NEED_GRAPH FALSE
-
-/* Features for the GEVENT sub-system. */
-#define GEVENT_ASSERT_NO_RESOURCE FALSE
-
-/* Features for the GTIMER sub-system. */
-/* NONE */
-
-/* Features for the GINPUT sub-system. */
-#define GINPUT_NEED_MOUSE FALSE
-#define GINPUT_NEED_KEYBOARD FALSE
-#define GINPUT_NEED_TOGGLE FALSE
-#define GINPUT_NEED_DIAL FALSE
-
-/* Features for the GADC sub-system. */
-/* NONE */
-
-/* Features for the GAUDIN sub-system. */
-/* NONE */
-
-/* Features for the GAUDOUT sub-system. */
-/* NONE */
-
-/* Features for the GMISC sub-system. */
-#define GMISC_NEED_ARRAYOPS FALSE
-
-/* Optional Parameters for various sub-systems */
-/*
- #define GDISP_MAX_FONT_HEIGHT 16
- #define GEVENT_MAXIMUM_SIZE 32
- #define GEVENT_MAX_SOURCE_LISTENERS 32
- #define GTIMER_THREAD_WORKAREA_SIZE 512
- #define GADC_MAX_LOWSPEED_DEVICES 4
-*/
-
-/* Optional Low Level Driver Definitions */
-/*
- #define GDISP_USE_CUSTOM_BOARD FALSE
- #define GDISP_SCREEN_WIDTH 320
- #define GDISP_SCREEN_HEIGHT 240
- #define GDISP_USE_FSMC
- #define GDISP_USE_GPIO
- #define GDISP_VMT_NAME1(x) x##YourDriver1
- #define GDISP_VMT_NAME2(x) x##YourDriver2
- #define TDISP_COLUMNS 16
- #define TDISP_ROWS 2
-*/
#endif /* _GFXCONF_H */
diff --git a/demos/modules/gdisp/basics/gfxconf.h b/demos/modules/gdisp/basics/gfxconf.h
index 60b8888e..a37ef1e7 100644
--- a/demos/modules/gdisp/basics/gfxconf.h
+++ b/demos/modules/gdisp/basics/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gdisp/circles/gfxconf.h b/demos/modules/gdisp/circles/gfxconf.h
index 28311ccb..4bb605ac 100644
--- a/demos/modules/gdisp/circles/gfxconf.h
+++ b/demos/modules/gdisp/circles/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gdisp/fonts/gfxconf.h b/demos/modules/gdisp/fonts/gfxconf.h
index 9f569e37..64481774 100644
--- a/demos/modules/gdisp/fonts/gfxconf.h
+++ b/demos/modules/gdisp/fonts/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
@@ -43,18 +43,13 @@
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE
#define GDISP_NEED_TEXT TRUE
-#define GDISP_NEED_CIRCLE FALSE
-#define GDISP_NEED_ELLIPSE FALSE
-#define GDISP_NEED_ARC FALSE
-#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD FALSE
-#define GDISP_NEED_CONTROL FALSE
-#define GDISP_NEED_MULTITHREAD FALSE
-#define GDISP_NEED_ASYNC FALSE
-#define GDISP_NEED_MSGAPI FALSE
#define GDISP_NEED_ANTIALIAS TRUE
/* GDISP - fonts to include */
+#define GDISP_INCLUDE_USER_FONTS TRUE
+#define GDISP_INCLUDE_FONT_UI1 FALSE
+#define GDISP_INCLUDE_FONT_UI2 TRUE
+#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS10 TRUE
#define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
@@ -70,9 +65,6 @@
#define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE
-#define GDISP_INCLUDE_FONT_UI1 FALSE
-#define GDISP_INCLUDE_FONT_UI2 TRUE
-#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
#endif /* _GFXCONF_H */
diff --git a/demos/modules/gdisp/fonts_cyrillic/gfxconf.h b/demos/modules/gdisp/fonts_cyrillic/gfxconf.h
index 1bf1baeb..dab77ba1 100644
--- a/demos/modules/gdisp/fonts_cyrillic/gfxconf.h
+++ b/demos/modules/gdisp/fonts_cyrillic/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
-//#define GFX_USE_OS_WIN32 FALSE
-//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX subsystems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gdisp/images/gfxconf.h b/demos/modules/gdisp/images/gfxconf.h
index 0bf9f1fc..6cd78b37 100644
--- a/demos/modules/gdisp/images/gfxconf.h
+++ b/demos/modules/gdisp/images/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gdisp/images_animated/gfxconf.h b/demos/modules/gdisp/images_animated/gfxconf.h
index 8cf34e87..cc38ed36 100644
--- a/demos/modules/gdisp/images_animated/gfxconf.h
+++ b/demos/modules/gdisp/images_animated/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gdisp/multiple_displays/gfxconf.h b/demos/modules/gdisp/multiple_displays/gfxconf.h
new file mode 100644
index 00000000..60467f93
--- /dev/null
+++ b/demos/modules/gdisp/multiple_displays/gfxconf.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu <joel@unormal.org>
+ * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the <organization> nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _GFXCONF_H
+#define _GFXCONF_H
+
+//* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
+
+/* GFX sub-systems to turn on */
+#define GFX_USE_GDISP TRUE
+
+/* Features for the GDISP sub-system. */
+#define GDISP_NEED_VALIDATION TRUE
+#define GDISP_NEED_CLIP TRUE
+#define GDISP_NEED_TEXT TRUE
+
+#define GDISP_INCLUDE_FONT_UI2 TRUE
+
+#define GDISP_TOTAL_DISPLAYS 2
+
+/* Uncomment the following lines if you want to use multiple displays on
+ * different controllers.
+ *
+ * Change the definitions to suit your hardware.
+ * Currently all controllers must use the same pixel format.
+ *
+ * Remember that GDISP_TOTAL_DISPLAYS above must match the **Total**
+ * number of displays in your system across all controllers.
+ *
+ * Optionally, you can also specify hardware characteristics that are common to
+ * all your controllers. This significantly improves code and speed efficiency
+ * as the program doesn't have to detect the hardware method to use on each call.
+ *
+ * Hardware definitions can be set to:
+ * - TRUE - all controllers support this routine
+ * - FALSE - no controllers support this routine
+ * - if not specified then the code auto-detects the hardware.
+ *
+ * e.g
+ * #define GDISP_HARDWARE_STREAM_WRITE FALSE
+ * #define GDISP_HARDWARE_STREAM_READ FALSE
+ * #define GDISP_HARDWARE_DRAWPIXEL TRUE
+ * #define GDISP_HARDWARE_FILLS TRUE
+ */
+//#define GDISP_TOTAL_CONTROLLERS 2
+//#define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32
+//#define GDISP_CONTROLLER_DISPLAYS 1, 1
+//#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
+
+#endif /* _GFXCONF_H */
diff --git a/demos/modules/gdisp/multiple_displays/main.c b/demos/modules/gdisp/multiple_displays/main.c
new file mode 100644
index 00000000..443bee27
--- /dev/null
+++ b/demos/modules/gdisp/multiple_displays/main.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu <joel@unormal.org>
+ * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the <organization> nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gfx.h"
+
+#include <stdio.h>
+
+/*
+ * This demo demonstrates two ways to talk to multiple displays.
+ *
+ * Method 1 is the preferred way however Method 1 would be useful
+ * when quickly converting existing single display applications.
+ *
+ * Note you can combine the methods using method 2 for the first display
+ * and method 1 for any extra displays.
+ */
+
+#define USE_METHOD_1 FALSE
+
+#if USE_METHOD_1
+ int main(void) {
+ coord_t width, height;
+ coord_t display, i, j;
+ font_t f;
+ GDisplay *g;
+ char buf[16];
+
+ /* Initialize and clear the display */
+ gfxInit();
+
+ /* Get a font to write with */
+ f = gdispOpenFont("*");
+
+ /* Cycle through each display */
+ for(display = 0; display < GDISP_TOTAL_DISPLAYS; display++) {
+
+ // Get the specified display
+ g = gdispGetDisplay(display);
+
+ // Get the screen size
+ width = gdispGGetWidth(g);
+ height = gdispGGetHeight(g);
+
+ /* Draw draw draw */
+ gdispGDrawBox(g, 10, 10, width/2, height/2, Yellow);
+ sprintf(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);
+
+ for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20)
+ gdispGDrawPixel(g, i, j, White);
+ }
+
+ while(TRUE) {
+ gfxSleepMilliseconds(500);
+ }
+ }
+#else
+ int main(void) {
+ coord_t width, height;
+ coord_t display, i, j;
+ font_t f;
+ char buf[16];
+
+ /* Initialize and clear the display */
+ gfxInit();
+
+ /* Get a font to write with */
+ f = gdispOpenFont("*");
+
+ /* Cycle through each display */
+ for(display = 0; display < GDISP_TOTAL_DISPLAYS; display++) {
+
+ // Set the default display to the specified display
+ gdispSetDisplay(gdispGetDisplay(display));
+
+ // Get the screen size
+ width = gdispGetWidth();
+ height = gdispGetHeight();
+
+ /* Draw draw draw */
+ gdispDrawBox(10, 10, width/2, height/2, Yellow);
+ sprintf(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);
+
+ for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20)
+ gdispDrawPixel(i, j, White);
+ }
+
+ while(TRUE) {
+ gfxSleepMilliseconds(500);
+ }
+ }
+#endif
+
diff --git a/demos/modules/gdisp/streaming/gfxconf.h b/demos/modules/gdisp/streaming/gfxconf.h
new file mode 100644
index 00000000..82843184
--- /dev/null
+++ b/demos/modules/gdisp/streaming/gfxconf.h
@@ -0,0 +1,31 @@
+/**
+ * This file has a different license to the rest of the GFX system.
+ * You can copy, modify and distribute this file as you see fit.
+ * You do not need to publish your source modifications to this file.
+ * The only thing you are not permitted to do is to relicense it
+ * under a different license.
+ */
+
+#ifndef _GFXCONF_H
+#define _GFXCONF_H
+
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
+
+/* GFX sub-systems to turn on */
+#define GFX_USE_GDISP TRUE
+#define GFX_USE_GMISC TRUE
+
+/* Features for the GDISP sub-system. */
+#define GDISP_NEED_VALIDATION TRUE
+#define GDISP_NEED_STREAMING TRUE
+
+#define GFX_USE_GMISC TRUE
+#define GMISC_NEED_INVSQRT TRUE
+//#define GMISC_INVSQRT_MIXED_ENDIAN TRUE
+//#define GMISC_INVSQRT_REAL_SLOW TRUE
+
+#endif /* _GFXCONF_H */
diff --git a/demos/modules/gdisp/streaming/main.c b/demos/modules/gdisp/streaming/main.c
new file mode 100644
index 00000000..4ad48b6c
--- /dev/null
+++ b/demos/modules/gdisp/streaming/main.c
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu <joel@unormal.org>
+ * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket
+ * Derived from the 2011 IOCCC submission by peter.eastman@gmail.com
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the <organization> nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gfx.h"
+#include <math.h>
+
+/**
+ * NOTE:
+ *
+ * This demo uses floating point operations. Don't expect it to work with any
+ * speed unless your processor has an FPU.
+ *
+ * If you see garbage inside the ball as it is running rather than the red and yellow
+ * checkerboard pattern then the fast invsqrt() function in GMISC does not work on
+ * your processor.
+ *
+ * You can modify the implementation of invsqrt() by firstly defining
+ * #define GMISC_INVSQRT_MIXED_ENDIAN TRUE
+ * in your gfxconf.h file.
+ *
+ * If it still doesn't work then instead define
+ * #define GMISC_INVSQRT_REAL_SLOW TRUE
+ * in your gfxconf.h file. This should always work although it will probably be slow.
+ */
+#define BALLCOLOR1 Red
+#define BALLCOLOR2 Yellow
+#define WALLCOLOR HTML2COLOR(0x303030)
+#define BACKCOLOR HTML2COLOR(0xC0C0C0)
+#define FLOORCOLOR HTML2COLOR(0x606060)
+#define SHADOWALPHA (255-255*0.2)
+
+int main(void) {
+ coord_t width, height, x, y, radius, ballx, bally, dx, floor;
+ coord_t minx, miny, maxx, maxy;
+ coord_t ballcx, ballcy;
+ color_t colour;
+ float ii, spin, dy, spinspeed, h, f, g;
+
+ gfxInit();
+ #if GDISP_NEED_CONTROL
+ gdispSetOrientation(GDISP_ROTATE_90);
+ #endif
+
+ width = gdispGetWidth();
+ height = gdispGetHeight();
+
+ radius=height/5+height%2+1; // The ball radius
+ ii = 1.0/radius; // radius as easy math
+ floor=height/5-1; // floor position
+ spin=0.0; // current spin angle on the ball
+ spinspeed=0.1; // current spin speed of the ball
+ ballx=width/2; // ball x position (relative to the ball center)
+ bally=height/4; // ball y position (relative to the ball center)
+ dx=.01*width; // motion in the x axis
+ dy=0.0; // motion in the y axis
+ ballcx = 12*radius/5; // ball x diameter including the shadow
+ ballcy = 21*radius/10; // ball y diameter including the shadow
+
+
+ minx = miny = 0; maxx = width; maxy = height; // The clipping window for this frame.
+
+ while(1) {
+ // Draw one frame
+ gdispStreamStart(minx, miny, maxx-minx, maxy-miny);
+ for (y=miny; h = (bally-y)*ii, y<maxy; y++) {
+ for (x=minx; x < maxx; x++) {
+ g=(ballx-x)*ii;
+ f=-.3*g+.954*h;
+ if (g*g < 1-h*h) {
+ /* The inside of the ball */
+ if ((((int)(9-spin+(.954*g+.3*h)*invsqrt(1-f*f))+(int)(2+f*2))&1))
+ colour = BALLCOLOR1;
+ else
+ colour = BALLCOLOR2;
+ } else {
+ // The background (walls and floor)
+ if (y > height-floor) {
+ if (x < height-y || height-y > width-x)
+ colour = WALLCOLOR;
+ else
+ colour = FLOORCOLOR;
+ } else if (x<floor || x>width-floor)
+ colour = WALLCOLOR;
+ else
+ colour = BACKCOLOR;
+
+ // The ball shadow is darker
+ if (g*(g+.4)+h*(h+.1) < 1)
+ colour = gdispBlendColor(colour, Black, SHADOWALPHA);
+ }
+ gdispStreamColor(colour); /* pixel to the LCD */
+ }
+ }
+ gdispStreamStop();
+
+ // Force a display update if the controller supports it
+ gdispFlush();
+
+ // Calculate the new frame size (note this is a drawing optimisation only)
+ minx = ballx - radius; miny = bally - radius;
+ maxx = minx + ballcx; maxy = miny + ballcy;
+ if (dx > 0) maxx += dx; else minx += dx;
+ if (dy > 0) maxy += dy; else miny += dy;
+ if (minx < 0) minx = 0;
+ if (maxx > width) maxx = width;
+ if (miny < 0) miny = 0;
+ if (maxy > height) maxy = height;
+
+ // Motion
+ spin += spinspeed;
+ ballx += dx; bally += dy;
+ dx = ballx < radius || ballx > width-radius ? spinspeed=-spinspeed,-dx : dx;
+ dy = bally > height-1.75*floor ? -.04*height : dy+.002*height;
+ }
+}
diff --git a/demos/modules/ginput/touch_driver_test/gfxconf.h b/demos/modules/ginput/touch_driver_test/gfxconf.h
index 6e8cc8e1..9b2de86c 100644
--- a/demos/modules/ginput/touch_driver_test/gfxconf.h
+++ b/demos/modules/ginput/touch_driver_test/gfxconf.h
@@ -30,10 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use - one of these must be defined */
-#define GFX_USE_OS_CHIBIOS TRUE
-#define GFX_USE_OS_WIN32 FALSE
-#define GFX_USE_OS_POSIX FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
@@ -46,22 +47,10 @@
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE
#define GDISP_NEED_TEXT TRUE
-#define GDISP_NEED_CIRCLE FALSE
-#define GDISP_NEED_ELLIPSE FALSE
-#define GDISP_NEED_ARC FALSE
-#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD FALSE
-#define GDISP_NEED_CONTROL FALSE
#define GDISP_NEED_MULTITHREAD TRUE
-#define GDISP_NEED_ASYNC FALSE
-#define GDISP_NEED_MSGAPI FALSE
/* Builtin Fonts */
-#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
diff --git a/demos/modules/gtimer/gfxconf.h b/demos/modules/gtimer/gfxconf.h
index 1c4a31f8..8786fafe 100644
--- a/demos/modules/gtimer/gfxconf.h
+++ b/demos/modules/gtimer/gfxconf.h
@@ -30,10 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use - one of these must be defined */
-#define GFX_USE_OS_CHIBIOS TRUE
-#define GFX_USE_OS_WIN32 FALSE
-#define GFX_USE_OS_POSIX FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GTIMER TRUE
diff --git a/demos/modules/gwin/basic/gfxconf.h b/demos/modules/gwin/basic/gfxconf.h
index 411ad9cf..70149055 100644
--- a/demos/modules/gwin/basic/gfxconf.h
+++ b/demos/modules/gwin/basic/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gwin/button/gfxconf.h b/demos/modules/gwin/button/gfxconf.h
index 2199e891..5376bd52 100644
--- a/demos/modules/gwin/button/gfxconf.h
+++ b/demos/modules/gwin/button/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gwin/checkbox/gfxconf.h b/demos/modules/gwin/checkbox/gfxconf.h
index 9be70462..f9060599 100644
--- a/demos/modules/gwin/checkbox/gfxconf.h
+++ b/demos/modules/gwin/checkbox/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gwin/console/gfxconf.h b/demos/modules/gwin/console/gfxconf.h
index 42ad5e12..3ada3b89 100644
--- a/demos/modules/gwin/console/gfxconf.h
+++ b/demos/modules/gwin/console/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gwin/graph/gfxconf.h b/demos/modules/gwin/graph/gfxconf.h
index 684d0e7a..c09bfc6e 100644
--- a/demos/modules/gwin/graph/gfxconf.h
+++ b/demos/modules/gwin/graph/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gwin/list/gfxconf.h b/demos/modules/gwin/list/gfxconf.h
index ab9cc008..40b509ff 100644
--- a/demos/modules/gwin/list/gfxconf.h
+++ b/demos/modules/gwin/list/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gwin/radio/gfxconf.h b/demos/modules/gwin/radio/gfxconf.h
index 595042fb..7c3e441e 100644
--- a/demos/modules/gwin/radio/gfxconf.h
+++ b/demos/modules/gwin/radio/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gwin/slider/gfxconf.h b/demos/modules/gwin/slider/gfxconf.h
index 8a1be49d..fc8d356e 100644
--- a/demos/modules/gwin/slider/gfxconf.h
+++ b/demos/modules/gwin/slider/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h
index 0299f2ef..111979e3 100644
--- a/demos/modules/gwin/widgets/gfxconf.h
+++ b/demos/modules/gwin/widgets/gfxconf.h
@@ -30,11 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use. One of these must be defined - perferably in your Makefile */
-//#define GFX_USE_OS_CHIBIOS FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
@@ -49,6 +49,12 @@
#define GDISP_NEED_CIRCLE TRUE
#define GDISP_NEED_TEXT TRUE
#define GDISP_NEED_IMAGE TRUE
+#define GDISP_NEED_CONVEX_POLYGON TRUE
+#define GDISP_NEED_CONTROL TRUE
+#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE
+
+/* The following are optional depending on your hardware */
+//#define GDISP_NEED_SCROLL TRUE
/* GDISP fonts to include */
#define GDISP_INCLUDE_FONT_UI2 TRUE
diff --git a/demos/modules/tdisp/gfxconf.h b/demos/modules/tdisp/gfxconf.h
index 1f323be3..371a9f44 100644
--- a/demos/modules/tdisp/gfxconf.h
+++ b/demos/modules/tdisp/gfxconf.h
@@ -30,10 +30,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-/* The operating system to use - one of these must be defined */
-#define GFX_USE_OS_CHIBIOS TRUE
-#define GFX_USE_OS_WIN32 FALSE
-#define GFX_USE_OS_POSIX FALSE
+/* The operating system to use. One of these must be defined - preferably in your Makefile */
+//#define GFX_USE_OS_CHIBIOS FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
/* GFX sub-systems to turn on */
#define GFX_USE_TDISP TRUE