From 0ffb4f8463e3e06e8d88b7be22f5cb7adb702361 Mon Sep 17 00:00:00 2001 From: pk33 Date: Sun, 3 Nov 2024 22:26:28 +0100 Subject: fonts, text and basic ui for on-screen log --- include/options.h | 6 +++--- include/strings33.h | 42 ++++++++++++++++++++++++++++++++++++++++++ include/ui33.h | 9 +++++++++ 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 include/strings33.h create mode 100644 include/ui33.h (limited to 'include') diff --git a/include/options.h b/include/options.h index 2ce1726..418a296 100644 --- a/include/options.h +++ b/include/options.h @@ -4,9 +4,9 @@ #define LOG_PATH "/dev/tty3" -#define DRM_DEVICE "/dev/dri/card1" -#define DRM_MODE "1366x768" -#define DRM_RATE 60 +#define DRM_DEVICE "/dev/dri/card0" +#define DRM_MODE "1024x768" +#define DRM_RATE 75 #endif /* __OPTIONS_H */ diff --git a/include/strings33.h b/include/strings33.h new file mode 100644 index 0000000..c987690 --- /dev/null +++ b/include/strings33.h @@ -0,0 +1,42 @@ +#ifndef __STRINGS_H__ +#define __STRINGS_H__ + +#include "types.h" +#include "display.h" +#include "system.h" + + +#define E33_MAX_GLYPH_PLOTS 256 +#define E33_MAX_FONT_GLYPHS 256 + +#define E33_FONT_DEFAULT 0 +#define E33_FONT_BIG 1 + +#define quprint( s, x, y, str ) e33_uprint( s, E33_FONT_DEFAULT, WHITE, x, y, str ); +#define quprintf( s, x, y, frm, ... ) e33_uprintf( s, E33_FONT_DEFAULT, WHITE, x, y, frm, ##__VA_ARGS__ ); +#define suprint( f, c, x, y, str ) e33_uprint( &__display.surface, f, c, x, y, str ); +#define suprintf( f, c, x, y, frm, ... ) e33_uprintf( &__display.surface, f, c, x, y, frm, ##__VA_ARGS__ ); +#define qsuprint( str, x, y ) e33_uprint( &__display.surface, E33_FONT_DEFAULT, WHITE, x, y, str ); +#define qsuprintf( x, y, frm, ... ) e33_uprintf( &__display.surface, E33_FONT_DEFAULT, WHITE, x, y, frm, ##__VA_ARGS__ ) + + +typedef struct { + Size num_plots; + Size width; + u16 plots[ E33_MAX_GLYPH_PLOTS ]; +} FontGlyph33; + +typedef struct { + Size xShift, yAnd; + Size height; + Size num_glyphs; + Size maxGlyphWidth; + FontGlyph33 glyphs[ E33_MAX_FONT_GLYPHS ]; +} Font33; + + +void e33_uprint( Surface *surf, Size font, u32 col, Size x, Size y, String str ); +void e33_uprintf( Surface *surf, Size font, u32 col, Size x, Size y, String fmt, ... ); + + +#endif /* __STRING_H__ */ diff --git a/include/ui33.h b/include/ui33.h new file mode 100644 index 0000000..7aa489c --- /dev/null +++ b/include/ui33.h @@ -0,0 +1,9 @@ +#ifndef __UI_H__ +#define __UI_H__ + + +void ui_add_message( String fmt, ... ); +void ui_draw_messages( void ); + + +#endif /** UI **/ -- cgit v1.2.3