custom font for monochrome targets

<3 Kenney
This commit is contained in:
KikooDX 2021-05-26 15:45:03 +02:00
parent d730844f65
commit 1cce3bbeaf
4 changed files with 25 additions and 4 deletions

View File

@ -24,6 +24,7 @@ set(ASSETS
)
set(ASSETS_fx
assets-fx/kenney_mini.png
)
set(ASSETS_cg

View File

@ -0,0 +1,6 @@
kenney_mini.png:
name: font_kenney_mini
type: font
charset: print
grid.size: 6x9
proportional: true

BIN
assets-fx/kenney_mini.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

View File

@ -1,27 +1,41 @@
#include "disp.h"
#include <gint/display.h>
#include <gint/keyboard.h>
#ifdef FX9860G
extern font_t font_kenney_mini;
#endif
static int line_height = 0;
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;
#ifdef FX9860G
int y = -2;
#else
int y = 2;
#endif
char *buffer_cursor = disp_buffer;
int line_length = 0;
if (!line_height)
if (!line_height) {
#ifdef FX9860G
dfont(&font_kenney_mini);
line_height = 6;
#else
line_height = dfont_default()->line_height;
#endif
}
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;
y += line_height + 1;
} else
line_length += 1;
}