aboutsummaryrefslogtreecommitdiff
path: root/src/ui33.c
blob: 4139a5edb63329b87d8f2c762603c7f0956bdc57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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 );
}