summaryrefslogtreecommitdiff
path: root/src/interface
diff options
context:
space:
mode:
authorSimon 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)
commit97b35bc47059315d4138c8e0827842d2c03de152 (patch)
treefeaf7a8c018982ba9d7ca1b8e6e15294abfdfc84 /src/interface
parent04488081d3fa0cd3dfb2939e5d902bc894df150d (diff)
downloadpowder-97b35bc47059315d4138c8e0827842d2c03de152.zip
powder-97b35bc47059315d4138c8e0827842d2c03de152.tar.gz
Various
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/Engine.cpp2
-rw-r--r--src/interface/Textbox.cpp21
-rw-r--r--src/interface/Textbox.h4
3 files changed, 22 insertions, 5 deletions
diff --git a/src/interface/Engine.cpp b/src/interface/Engine.cpp
index 7eec6b5..a505635 100644
--- a/src/interface/Engine.cpp
+++ b/src/interface/Engine.cpp
@@ -18,7 +18,7 @@ Engine::Engine():
mousey_(0),
mousexp_(0),
mouseyp_(0),
- FpsLimit(60.0f),
+ FpsLimit(0.0f),
windows(stack<Window*>()),
lastBuffer(NULL),
prevBuffers(stack<pixel*>()),
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);
+ }
}
diff --git a/src/interface/Textbox.h b/src/interface/Textbox.h
index 099368f..82ed648 100644
--- a/src/interface/Textbox.h
+++ b/src/interface/Textbox.h
@@ -23,6 +23,7 @@ class Textbox : public Component
VerticalAlignment textVAlign;
int cursor, cursorPosition;
TextboxAction *actionCallback;
+ bool masked;
public:
Textbox(Window* parent_state, std::string textboxText);
Textbox(Point position, Point size, std::string textboxText);
@@ -38,6 +39,9 @@ public:
void SetActionCallback(TextboxAction * action) { actionCallback = action; }
virtual void OnKeyPress(int key, bool shift, bool ctrl, bool alt);
+ void SetHidden(bool hidden) { masked = hidden; }
+ bool GetHidden() { return masked; }
+
virtual void Draw(const Point& screenPos);
};
}