kimeera/src/disp/display.c

36 lines
775 B
C

#include "disp.h"
#include <gint/display.h>
#include <gint/keyboard.h>
static void draw_line(int x, int y, char *buffer, int len);
void
disp_display(void)
{
static int line_height = 0;
const int x = 2;
int y = 2;
char *buffer_cursor = disp_buffer;
int line_length = 0;
if (!line_height)
line_height = dfont_default()->line_height;
while (buffer_cursor[line_length] != '\0') {
if (buffer_cursor[line_length] == '\n') {
draw_line(x, y, buffer_cursor, line_length);
buffer_cursor += line_length + 1;
line_length = 0;
y += line_height;
} else
line_length += 1;
}
draw_line(x, y, buffer_cursor, line_length);
}
static void
draw_line(int x, int y, char *buffer, int len)
{
dtext_opt(x, y, C_BLACK, C_NONE, DTEXT_LEFT, DTEXT_TOP, buffer, len);
}