diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-11-19 11:43:18 -0600 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-11-19 11:43:18 -0600 |
| commit | 331aa6e59fd36b52afb4119068d0baa99c85ea3c (patch) | |
| tree | 9780a8e4cc22ac19f84731d6b771d9f692a49841 /supervisor | |
| parent | 9a642fc0490c22b60460bcca8dec3b0b93344d81 (diff) | |
displayio: When the display is tall, move blinka above the text
This makes a more useful display on the portrait magtag, allowing 21
characters across instead of just 18. There are 20 full rows of text,
instead of 21. The total number of characters increases slightly from 378
to 420.
For comparison, the Commodore VIC 20 had 22 rows of 23 characters for a
total of 506 characters. :-P
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/display.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index afb3f3a9a..a9ae25884 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -60,18 +60,21 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { #if CIRCUITPY_TERMINALIO displayio_tilegrid_t* grid = &supervisor_terminal_text_grid; - uint16_t width_in_tiles = (width_px - blinka_bitmap.width) / grid->tile_width; + bool tall = height_px > width_px; + uint16_t terminal_width_px = tall ? width_px : width_px - blinka_bitmap.width; + uint16_t terminal_height_px = tall ? height_px - blinka_bitmap.height : height_px ; + uint16_t width_in_tiles = terminal_width_px / grid->tile_width; // determine scale based on h if (width_in_tiles < 80) { scale = 1; } - width_in_tiles = (width_px - blinka_bitmap.width * scale) / (grid->tile_width * scale); + width_in_tiles = terminal_width_px / (grid->tile_width * scale); if (width_in_tiles < 1) { width_in_tiles = 1; } - uint16_t height_in_tiles = height_px / (grid->tile_height * scale); - uint16_t remaining_pixels = height_px % (grid->tile_height * scale); + uint16_t height_in_tiles = terminal_height_px / (grid->tile_height * scale); + uint16_t remaining_pixels = tall ? 0 : terminal_height_px % (grid->tile_height * scale); if (height_in_tiles < 1 || remaining_pixels > 0) { height_in_tiles += 1; } @@ -91,7 +94,8 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { if (tiles == NULL) { return; } - grid->y = 0; + grid->y = tall ? blinka_bitmap.height : 0; + grid->x = tall ? 0 : blinka_bitmap.width; grid->top_left_y = 0; if (remaining_pixels > 0) { grid->y -= (grid->tile_height - remaining_pixels); |
