aboutsummaryrefslogtreecommitdiff
path: root/src/ui33.c
diff options
context:
space:
mode:
authorpk33 <pk33@pk33.space>2024-11-03 22:26:28 +0100
committerpk33 <pk33@pk33.space>2024-11-03 22:26:28 +0100
commit0ffb4f8463e3e06e8d88b7be22f5cb7adb702361 (patch)
tree05e626d6ce4e0d8e544a40f8a14965cf4fdd5780 /src/ui33.c
parent6c69ea8da9d306e4e6d21d0feee5213fea15f49e (diff)
downloadengine33-0ffb4f8463e3e06e8d88b7be22f5cb7adb702361.tar.gz
fonts, text and basic ui for on-screen log
Diffstat (limited to 'src/ui33.c')
-rw-r--r--src/ui33.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/ui33.c b/src/ui33.c
new file mode 100644
index 0000000..4139a5e
--- /dev/null
+++ b/src/ui33.c
@@ -0,0 +1,44 @@
+#include "string.h"
+#include "stdarg.h"
+#include "stdio.h"
+
+#include "types.h"
+#include "strings33.h"
+#include "logger.h"
+
+
+#define MB_MAX 6
+
+
+static char messageBox[MB_MAX][256] = { 0, };
+static Size A = 0;
+static Size P = 0;
+
+
+void ui_add_message( String fmt, ... )
+{
+ va_list args;
+ va_start(args, fmt);
+
+ vsnprintf( messageBox[P++], 256, fmt, args );
+ if( P == MB_MAX ) P = 0;
+ if( P == A ) ++A;
+ if( A == MB_MAX ) A = 0;
+
+ va_end(args);
+}
+
+void ui_draw_messages( void )
+{
+ Size start = __display.surface.h - 5 - 8;
+ Size i = P-1;
+
+ qsuprintf( 300, 40, "A(%d), P(%d)", A, P );
+
+ do {
+ if( i < 0 ) i = MB_MAX-1;
+ qsuprint( messageBox[i], 5, start );
+ start -= 18;
+ } while( (i--) != A );
+}
+