diff options
Diffstat (limited to 'src/ui33.c')
-rw-r--r-- | src/ui33.c | 54 |
1 files changed, 35 insertions, 19 deletions
@@ -1,42 +1,58 @@ -#include "string.h" #include "stdarg.h" #include "stdio.h" +#include "string.h" -#include "types.h" +#include "types33.h" +#include "ui33.h" #include "strings33.h" -#include "logger.h" +#include "logger33.h" + + +#define _MBOX_SIZE 9 +#define _PADDING 4 +#define _SPACING 2 -#define MB_MAX 6 +static char messageBox[ _MBOX_SIZE ][ _STRING_MAX ] = { 0, }; +static Size head = 0; +static Size tail = 0; -static char messageBox[MB_MAX][256] = { 0, }; -static Size A = 0; -static Size P = 0; +Mouse33 __mouse = {0,}; -void ui_add_message( String fmt, ... ) +void ui33_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; + vsnprintf( messageBox[tail++], _STRING_MAX, fmt, args ); + if( tail == _MBOX_SIZE ) tail = 0; + if( tail == head ) ++head; + if( head == _MBOX_SIZE ) head = 0; va_end(args); } -void ui_draw_messages( void ) +void ui33_draw_messages( void ) { - Size start = __display.surface.h - 5 - 8; - Size i = P-1; + Size fontHeight = defFont.h; + Size stringCoord = __display.surface.h - _PADDING - fontHeight; + Size i = tail-1; do { - if( i < 0 ) i = MB_MAX-1; - qsuprint( messageBox[i], 5, start ); - start -= 18; - } while( (i--) != A ); + if( i < 0 ) i = _MBOX_SIZE-1; + QPRINT( messageBox[i], _PADDING, stringCoord ); + stringCoord -= (_SPACING + fontHeight); + } while( (i--) != head ); +} + +void ui33_draw_mouse( void ) +{ + Size x = __mouse.x; + Size y = __mouse.y; + Size w = __display.surface.w; + + __display.surface.data[ x + y * w ] = YELLOW; } |