From 112852ffc3251390b44995690b156f6a942403e5 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 7 Feb 2015 21:59:43 +1000 Subject: Update multiple display demo to display better on very small displays. --- demos/modules/gdisp/multiple_displays/main.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'demos/modules/gdisp/multiple_displays') diff --git a/demos/modules/gdisp/multiple_displays/main.c b/demos/modules/gdisp/multiple_displays/main.c index 387ca690..0a474d0f 100644 --- a/demos/modules/gdisp/multiple_displays/main.c +++ b/demos/modules/gdisp/multiple_displays/main.c @@ -69,9 +69,14 @@ height = gdispGGetHeight(g); /* Draw draw draw */ - gdispGDrawBox(g, 10, 10, width/2, height/2, Yellow); sprintg(buf, "Display %u", display); - gdispGFillStringBox(g, width/2, height/2, width/2-10, height/2-10, buf, f, White, Blue, justifyCenter); + if (width < 128) { + gdispGDrawBox(g, 0, 0, width/2, height/2, Yellow); + gdispGFillStringBox(g, 0, height/2, width, height/2, buf, f, Black, Blue, justifyCenter); + } else { + gdispGDrawBox(g, 10, 10, width/2, height/2, Yellow); + 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) @@ -107,9 +112,14 @@ height = gdispGetHeight(); /* Draw draw draw */ - gdispDrawBox(10, 10, width/2, height/2, Yellow); sprintg(buf, "Display %u", display); - gdispFillStringBox(width/2, height/2, width/2-10, height/2-10, buf, f, White, Blue, justifyCenter); + if (width < 128) { + gdispDrawBox(0, 0, width/2, height/2, Yellow); + gdispFillStringBox(0, height/2, width, height/2, buf, f, Black, Blue, justifyCenter); + } else { + gdispDrawBox(10, 10, width/2, height/2, Yellow); + 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) -- cgit v1.2.3