diff options
author | Joel Bodenmann <joel@unormal.org> | 2013-07-14 20:02:28 +0200 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2013-07-14 20:02:28 +0200 |
commit | 38a2a44b3d27ca29019cd0d75e60233ee9188c71 (patch) | |
tree | 6cd0e65ba5ce5b0884d5cd4085795e347b5fa509 /demos/modules/gwin/console | |
parent | b7e6967886a25277af53e04ce6942b715b538644 (diff) | |
parent | c5ec72027787c9cd5f5b36a46eb55f03fd95d894 (diff) | |
download | uGFX-38a2a44b3d27ca29019cd0d75e60233ee9188c71.tar.gz uGFX-38a2a44b3d27ca29019cd0d75e60233ee9188c71.tar.bz2 uGFX-38a2a44b3d27ca29019cd0d75e60233ee9188c71.zip |
Merge branch 'GWIN'
Diffstat (limited to 'demos/modules/gwin/console')
-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) { |