aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/supernova/state.cpp49
-rw-r--r--engines/supernova/state.h26
2 files changed, 75 insertions, 0 deletions
diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp
index d6fe286bf8..b8bb9dad6e 100644
--- a/engines/supernova/state.cpp
+++ b/engines/supernova/state.cpp
@@ -68,6 +68,55 @@ Object *Inventory::get(ObjectID id) const {
return NULL;
}
+GuiElement::GuiElement()
+ : _text("")
+ , _isHighlighted(false)
+ , _isVisible(true)
+ , _bgColorNormal(kColorWhite25)
+ , _bgColorHighlighted(kColorWhite44)
+ , _bgColor(kColorWhite25)
+ , _textColorNormal(kColorGreen)
+ , _textColorHighlighted(kColorLightGreen)
+ , _textColor(kColorGreen)
+{}
+
+void GuiElement::setText(const char *text) {
+ strncpy(_text, text, sizeof(_text));
+}
+
+void GuiElement::setTextPosition(int x, int y) {
+ _textPosition.x = x;
+ _textPosition.y = y;
+}
+void GuiElement::setSize(int x1, int y1, int x2, int y2) {
+ this->left = x1;
+ this->top = y1;
+ this->right = x2;
+ this->bottom = y2;
+
+ _textPosition.x = x1 + 1;
+ _textPosition.y = y1 + 1;
+}
+
+void GuiElement::setColor(int bgColor, int textColor, int bgColorHighlighted, int textColorHightlighted) {
+ _bgColor = bgColor;
+ _textColor = textColor;
+ _bgColorNormal = bgColor;
+ _textColorNormal = textColor;
+ _bgColorHighlighted = bgColorHighlighted;
+ _textColorHighlighted = textColorHightlighted;
+}
+
+void GuiElement::setHighlight(bool isHighlighted) {
+ if (isHighlighted) {
+ _bgColor = _bgColorHighlighted;
+ _textColor = _textColorHighlighted;
+ } else {
+ _bgColor = _bgColorNormal;
+ _textColor = _textColorNormal;
+ }
+}
+
static const char *timeToString(int t) {
// TODO: Does ScummVM emulate PIT timings for DOS?
diff --git a/engines/supernova/state.h b/engines/supernova/state.h
index 08e5591af1..e2d066f2cb 100644
--- a/engines/supernova/state.h
+++ b/engines/supernova/state.h
@@ -73,6 +73,32 @@ private:
uint _numObjects;
};
+class GuiElement : public Common::Rect {
+public:
+ GuiElement();
+
+ void setSize(int x1, int y1, int x2, int y2);
+ void setText(const char *text);
+ void setTextPosition(int x, int y);
+ void setColor(int bgColor, int textColor, int bgColorHighlighted, int textColorHightlighted);
+ void setHighlight(bool isHighlighted);
+
+// virtual void onMouseOver() {}
+// virtual void onMouseOut() {}
+// virtual void onMouseClick() {}
+
+ Common::Point _textPosition;
+ char _text[128];
+ int _bgColor;
+ int _textColor;
+ int _bgColorNormal;
+ int _bgColorHighlighted;
+ int _textColorNormal;
+ int _textColorHighlighted;
+ bool _isHighlighted;
+ bool _isVisible;
+};
+
class GameManager {
public:
GameManager(SupernovaEngine *vm);