// by James L. Hammons
//
+#include <string.h>
#include "types.h"
#include "tom.h"
+#include "font1.h"
#include "gui.h"
void InitGUI(void)
{
}
-void DrawText(uint16 * screen, uint32 x, uint32 y, const char * string)
+void DrawText(int16 * screen, uint32 x, uint32 y, const char * text, ...)
{
- uint32 pitch = TOMGetSDLScreenPitch();
+ char string[4096];
+ va_list arg;
+
+ va_start(arg, text);
+ vsprintf(string, text, arg);
+ va_end(arg);
+
+ uint32 pitch = TOMGetSDLScreenPitch() / 2; // Returns pitch in bytes but we need words...
+ uint32 length = strlen(string), address = x + (y * pitch);
+
+ for(uint32 i=0; i<length; i++)
+ {
+ uint32 fontAddr = (uint32)string[i] * 64;
+
+ for(uint32 yy=0; yy<8; yy++)
+ {
+ for(uint32 xx=0; xx<8; xx++)
+ {
+ if (font1[fontAddr++])
+ *(screen + address + xx + (yy * pitch)) = 0xFE00;
+ }
+ }
+
+ address += 8;
+ }
}