diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-24 20:19:19 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-24 20:19:19 (GMT) |
| commit | 97b35bc47059315d4138c8e0827842d2c03de152 (patch) | |
| tree | feaf7a8c018982ba9d7ca1b8e6e15294abfdfc84 /src/interface/Textbox.cpp | |
| parent | 04488081d3fa0cd3dfb2939e5d902bc894df150d (diff) | |
| download | powder-97b35bc47059315d4138c8e0827842d2c03de152.zip powder-97b35bc47059315d4138c8e0827842d2c03de152.tar.gz | |
Various
Diffstat (limited to 'src/interface/Textbox.cpp')
| -rw-r--r-- | src/interface/Textbox.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/interface/Textbox.cpp b/src/interface/Textbox.cpp index f087241..380ad59 100644 --- a/src/interface/Textbox.cpp +++ b/src/interface/Textbox.cpp @@ -14,7 +14,8 @@ Textbox::Textbox(Window* parent_state, std::string textboxText): textPosition(ui::Point(0, 0)), textVAlign(AlignMiddle), textHAlign(AlignCentre), - actionCallback(NULL) + actionCallback(NULL), + masked(false) { TextPosition(); cursor = text.length(); @@ -26,7 +27,8 @@ Textbox::Textbox(Point position, Point size, std::string textboxText): textPosition(ui::Point(0, 0)), textVAlign(AlignMiddle), textHAlign(AlignCentre), - actionCallback(NULL) + actionCallback(NULL), + masked(false) { TextPosition(); cursor = text.length(); @@ -38,7 +40,8 @@ Textbox::Textbox(std::string textboxText): textPosition(ui::Point(0, 0)), textVAlign(AlignMiddle), textHAlign(AlignCentre), - actionCallback(NULL) + actionCallback(NULL), + masked(false) { TextPosition(); cursor = text.length(); @@ -189,5 +192,15 @@ void Textbox::Draw(const Point& screenPos) { g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 160, 160, 160, 255); } - g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, text, 255, 255, 255, 255); + if(masked) + { + char tempText[text.length()]; + memset(tempText, 'a', text.length()); + tempText[text.length()] = 0; + g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, tempText, 255, 255, 255, 255); + } + else + { + g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, text, 255, 255, 255, 255); + } } |
