44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
void draw(const uint32_t base_pattern,
|
|
const start_size_t& text)
|
|
{
|
|
static constexpr screen_cell_t top_left = { 0, 12};
|
|
static constexpr screen_cell_t bottom_right = {19, 17};
|
|
|
|
draw_box_border(base_pattern, top_left, bottom_right);
|
|
draw_box_background(base_pattern, top_left, bottom_right);
|
|
|
|
uint32_t ix = 0;
|
|
int32_t x = top_left.x + 1;
|
|
int32_t y = top_left.y + 2;
|
|
// ignore C-string null terminator
|
|
while (ix < (text.size - 1)) {
|
|
const uint8_t c = text.start[ix];
|
|
switch (c) {
|
|
case control_t::text: break;
|
|
case control_t::done: break;
|
|
case control_t::prompt: break;
|
|
case control_t::page: break;
|
|
|
|
case control_t::next: [[fallthrough]];
|
|
case control_t::line:
|
|
while (x < bottom_right.x) {
|
|
put_char(base_pattern, x, y, ascii_to_font(' '));
|
|
x++;
|
|
}
|
|
x = top_left.x + 1;
|
|
y += 2;
|
|
break;
|
|
case control_t::para: [[fallthrough]];
|
|
case control_t::cont:
|
|
// fixme:
|
|
ix = text.size;
|
|
break;
|
|
default:
|
|
put_char(base_pattern, x, y, ascii_to_font(c));
|
|
x += 1;
|
|
break;
|
|
}
|
|
ix++;
|
|
}
|
|
}
|