]> Shamusworld >> Repos - apple2/blob - src/gui/text.cpp
cd65a6ac60b0a8751329509caef282d07e231872
[apple2] / src / gui / text.cpp
1 //
2 // Static text class
3 //
4 // by James L. Hammons
5 //
6
7 #include "text.h"
8
9 #include "guimisc.h"
10
11 Text::Text(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/, Element * parent/*= NULL*/):
12         Element(x, y, w, h, parent)
13 {
14         fgColor = 0xFF8484FF, bgColor = 0xFF84FF4D;
15 }
16
17 Text::Text(uint32 x, uint32 y, std::string s, uint32 fg/*= 0xFF8484FF*/, uint32 bg/*= 0xFF84FF4D*/, Element * parent/*= NULL*/):
18         Element(x, y, 0, 0, parent), text(s)
19 {
20         fgColor = fg, bgColor = bg;
21 }
22
23 void Text::Draw(void)
24 {
25         if (text.length() > 0)
26         {
27 //              DrawString(screenBuffer, extents.x + offsetX, extents.y + offsetY, false, "%s", text.c_str());
28                 SDL_Rect r = GetScreenCoords();
29                 DrawStringOpaque(screen, r.x, r.y, fgColor, bgColor, "%s", text.c_str());
30         }
31 }