diff options
author | inmarket <andrewh@inmarket.com.au> | 2013-07-07 19:43:34 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2013-07-07 19:43:34 +1000 |
commit | ba264ef1add20e8ede39fde1ceae1d57687498d1 (patch) | |
tree | e7257e96275c5a5d164dc49ee6f8a736bbed7446 /demos/modules/gwin/console/main.c | |
parent | 8681e85ba6028287bf202d8b8a86a7d0a0d49101 (diff) | |
download | uGFX-ba264ef1add20e8ede39fde1ceae1d57687498d1.tar.gz uGFX-ba264ef1add20e8ede39fde1ceae1d57687498d1.tar.bz2 uGFX-ba264ef1add20e8ede39fde1ceae1d57687498d1.zip |
Update GWIN demos
Diffstat (limited to 'demos/modules/gwin/console/main.c')
-rw-r--r-- | demos/modules/gwin/console/main.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/demos/modules/gwin/console/main.c b/demos/modules/gwin/console/main.c index aa3de40d..197a8ad6 100644 --- a/demos/modules/gwin/console/main.c +++ b/demos/modules/gwin/console/main.c @@ -28,27 +28,37 @@ */ #include "gfx.h" -#include "chprintf.h" /* The handles for our three consoles */ GHandle GW1, GW2, GW3; -/* The streams for our three consoles */ -BaseSequentialStream *S1, *S2, *S3; - int main(void) { uint8_t i; font_t font1, font2; /* initialize and clear the display */ gfxInit(); - font1 = gdispOpenFont("UI2 Double"); - font2 = gdispOpenFont("Small"); - /* create the three console windows and set a font for each */ - GW1 = gwinCreateConsole(NULL, 0, 0, gdispGetWidth(), gdispGetHeight()/2, font1); - GW2 = gwinCreateConsole(NULL, 0, gdispGetHeight()/2, gdispGetWidth()/2, gdispGetHeight(), font2); - GW3 = gwinCreateConsole(NULL, gdispGetWidth()/2, gdispGetHeight()/2, gdispGetWidth(), gdispGetHeight(), font2); + /* Set some fonts */ + font1 = gdispOpenFont("Small"); + font2 = gdispOpenFont("UI2 Double"); + gwinSetDefaultFont(font1); + + /* create the three console windows */ + { + GWindowInit wi; + + wi.show = TRUE; + wi.x = 0; wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight()/2; + GW1 = gwinConsoleCreate(NULL, &wi); + wi.y = gdispGetHeight()/2; wi.width = gdispGetWidth()/2; wi.height = gdispGetHeight(); + GW2 = gwinConsoleCreate(NULL, &wi); + wi.x = gdispGetWidth()/2; wi.height = gdispGetHeight(); + GW3 = gwinConsoleCreate(NULL, &wi); + } + + /* Use a special font for GW1 */ + gwinSetFont(GW1, font2); /* Set the fore- and background colors for each console */ gwinSetColor(GW1, Green); @@ -63,24 +73,19 @@ int main(void) { gwinClear(GW2); gwinClear(GW3); - /* receive the stream pointers of each console */ - S1 = gwinGetConsoleStream(GW1); - S2 = gwinGetConsoleStream(GW2); - S3 = gwinGetConsoleStream(GW3); - /* Output some data on the first console */ for(i = 0; i < 10; i++) { - chprintf(S1, "Hello ChibiOS/GFX!\r\n"); + gwinPrintf(GW1, "Hello ChibiOS/GFX!\r\n"); } /* Output some data on the second console */ for(i = 0; i < 16; i++) { - chprintf(S2, "Message Nr.: %d\r\n", i+1); + gwinPrintf(GW2, "Message Nr.: %d\r\n", i+1); } /* Output some data on the third console */ for(i = 0; i < 18; i++) { - chprintf(S3, "Message Nr.: %d\r\n", i+1); + gwinPrintf(GW3, "Message Nr.: %d\r\n", i+1); } while(TRUE) { |