]> Shamusworld >> Repos - virtualjaguar/blob - src/gui.cpp
Minor change to allow inverse text
[virtualjaguar] / src / gui.cpp
1 //
2 // GUI.CPP
3 //
4 // Graphical User Interface support
5 // by James L. Hammons
6 //
7
8 #include <string.h>
9 #include "types.h"
10 #include "tom.h"
11 #include "font1.h"
12 #include "gui.h"
13
14 void InitGUI(void)
15 {
16 }
17
18 void GUIDone(void)
19 {
20 }
21
22 void DrawText(int16 * screen, uint32 x, uint32 y, bool invert, const char * text, ...)
23 {
24         char string[4096];
25         va_list arg;
26
27         va_start(arg, text);
28         vsprintf(string, text, arg);
29         va_end(arg);
30
31         uint32 pitch = TOMGetSDLScreenPitch() / 2;              // Returns pitch in bytes but we need words...
32         uint32 length = strlen(string), address = x + (y * pitch);
33
34         for(uint32 i=0; i<length; i++)
35         {
36                 uint32 fontAddr = (uint32)string[i] * 64;
37
38                 for(uint32 yy=0; yy<8; yy++)
39                 {
40                         for(uint32 xx=0; xx<8; xx++)
41                         {
42                                 if ((font1[fontAddr] && !invert) || (!font1[fontAddr] && invert))
43                                         *(screen + address + xx + (yy * pitch)) = 0xFE00;
44                                 fontAddr++;
45                         }
46                 }
47
48                 address += 8;
49         }
50 }