diff options
author | inmarket <andrewh@inmarket.com.au> | 2014-02-19 07:45:47 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2014-02-19 07:45:47 +1000 |
commit | 6d372f13528f44919ec193d03248d55a53484968 (patch) | |
tree | 66f6ba33c6bcfed2b5b3846cf1f309e9b7e715e6 /demos/modules/gwin/button/main.c | |
parent | 03914d2d2b438062d3062e2c3a588d53d3040cff (diff) | |
parent | 37966ff16d923bbca53c9464815cb49cbd7fc3be (diff) | |
download | uGFX-6d372f13528f44919ec193d03248d55a53484968.tar.gz uGFX-6d372f13528f44919ec193d03248d55a53484968.tar.bz2 uGFX-6d372f13528f44919ec193d03248d55a53484968.zip |
Merge branch 'master' into freertos
Diffstat (limited to 'demos/modules/gwin/button/main.c')
-rw-r--r-- | demos/modules/gwin/button/main.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/demos/modules/gwin/button/main.c b/demos/modules/gwin/button/main.c index 6ec8a287..6349ca09 100644 --- a/demos/modules/gwin/button/main.c +++ b/demos/modules/gwin/button/main.c @@ -54,10 +54,16 @@ static void createWidgets(void) { int main(void) { GEvent* pe; + static const orientation_t orients[] = { GDISP_ROTATE_0, GDISP_ROTATE_90, GDISP_ROTATE_180, GDISP_ROTATE_270 }; + unsigned which; // Initialize the display gfxInit(); + // We are currently at GDISP_ROTATE_0 + which = 0; + gdispSetOrientation(orients[which]); + // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); @@ -81,7 +87,15 @@ int main(void) { case GEVENT_GWIN_BUTTON: if (((GEventGWinButton*)pe)->button == ghButton1) { // Our button has been pressed - printf("Button clicked\r\n"); + if (++which >= sizeof(orients)/sizeof(orients[0])) + which = 0; + + // Setting the orientation during run-time is a bit naughty particularly with + // GWIN windows. In this case however we know that the button is in the top-left + // corner which should translate safely into any orientation. + gdispSetOrientation(orients[which]); + gdispClear(White); + gwinRedrawDisplay(GDISP, FALSE); } break; |