]> Shamusworld >> Repos - apple2/blob - src/gui/text.cpp
0c7ea6d21d3047db05f99e74b5df78a85a154b3d
[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_t x/*= 0*/, uint32_t y/*= 0*/, uint32_t w/*= 0*/, uint32_t h/*= 0*/, Element * parent/*= NULL*/):
12         Element(x, y, w, h, parent)
13 {
14         fgColor = 0xFF8484FF, bgColor = 0xFF84FF4D;
15 }
16
17 Text::Text(uint32_t x, uint32_t y, std::string s, uint32_t fg/*= 0xFF8484FF*/, uint32_t 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 }
32
33 void Text::SetText(std::string s)
34 {
35         text = s;
36 }