aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus/elements.h
diff options
context:
space:
mode:
authorMatthew Hoops2011-09-10 10:41:36 -0400
committerMatthew Hoops2011-09-10 10:41:36 -0400
commitd3fde69770b5a3065fa3ae1da76e443d6d185147 (patch)
tree5edfdac7b308989fcf3283bef54a50f62615f13c /engines/pegasus/elements.h
parentbbda19ab8033d67d2f2ea72e2ddb9a0b925fa0ac (diff)
downloadscummvm-rg350-d3fde69770b5a3065fa3ae1da76e443d6d185147.tar.gz
scummvm-rg350-d3fde69770b5a3065fa3ae1da76e443d6d185147.tar.bz2
scummvm-rg350-d3fde69770b5a3065fa3ae1da76e443d6d185147.zip
PEGASUS: Implement two of the primitive-based DisplayElements
Diffstat (limited to 'engines/pegasus/elements.h')
-rw-r--r--engines/pegasus/elements.h139
1 files changed, 139 insertions, 0 deletions
diff --git a/engines/pegasus/elements.h b/engines/pegasus/elements.h
new file mode 100644
index 0000000000..2fc7a3abd3
--- /dev/null
+++ b/engines/pegasus/elements.h
@@ -0,0 +1,139 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PEGASUS_ELEMENTS_H
+#define PEGASUS_ELEMENTS_H
+
+#include "common/rect.h"
+#include "common/str.h"
+#include "common/system.h"
+#include "graphics/pict.h"
+#include "graphics/surface.h"
+
+#include "pegasus/pegasus.h"
+#include "pegasus/util.h"
+
+namespace Pegasus {
+
+class DisplayElement : public IDObject {
+friend class GraphicsManager;
+public:
+ DisplayElement(const tDisplayElementID);
+ virtual ~DisplayElement();
+
+ void setDisplayOrder(const tDisplayOrder);
+ tDisplayOrder getDisplayOrder() const { return _elementOrder; }
+
+ bool validToDraw(tDisplayOrder, tDisplayOrder);
+
+ virtual void draw(const Common::Rect&) {}
+ bool isDisplaying() { return _elementIsDisplaying; }
+ virtual void startDisplaying();
+ virtual void stopDisplaying();
+
+ virtual void show();
+ virtual void hide();
+ bool isVisible() { return _elementIsVisible; }
+
+ // triggerRedraw only triggers a draw if the element is displaying and visible.
+ void triggerRedraw();
+ void setTriggeredElement(DisplayElement *);
+
+ virtual void setBounds(const tCoordType, const tCoordType, const tCoordType, const tCoordType);
+ virtual void setBounds(const Common::Rect&);
+ virtual void getBounds(Common::Rect&) const;
+ virtual void sizeElement(const tCoordType, const tCoordType);
+ virtual void moveElementTo(const tCoordType, const tCoordType);
+ virtual void moveElement(const tCoordType, const tCoordType);
+ virtual void getLocation(tCoordType&, tCoordType&) const;
+ virtual void getCenter(tCoordType&, tCoordType&) const;
+ virtual void centerElementAt(const tCoordType, const tCoordType);
+
+protected:
+ Common::Rect _bounds;
+ bool _elementIsVisible;
+ DisplayElement *_triggeredElement;
+
+ // Used only by PegasusEngine
+ bool _elementIsDisplaying;
+ tDisplayOrder _elementOrder;
+ DisplayElement *_nextElement;
+};
+
+// I'm using the proper "highlight" instead of the evil
+// QuickDraw "hilite" :P (deal with it!)
+class DropHighlight : public DisplayElement {
+public:
+ DropHighlight(const tDisplayElementID);
+ virtual ~DropHighlight() {}
+
+ void setHighlightColor(const uint32 &highlight) { _highlightColor = highlight; }
+ void getHighlightColor(uint32 &highlight) const { highlight = _highlightColor; }
+
+ void setHighlightThickness(const uint16 thickness) { _thickness = thickness; }
+ uint16 getHighlightThickness() const { return _thickness; }
+
+ void setHighlightCornerDiameter(const uint16 diameter) { _cornerDiameter = diameter; }
+ uint16 getHighlightCornerDiameter() const { return _cornerDiameter; }
+
+ virtual void draw(const Common::Rect&);
+
+protected:
+ uint32 _highlightColor;
+ uint16 _thickness;
+ uint16 _cornerDiameter;
+};
+
+class EnergyBar : public DisplayElement {
+public:
+ EnergyBar(const tDisplayElementID);
+ virtual ~EnergyBar() {}
+
+ void getBarColor(uint32 &color) const { color = _barColor; }
+ void setBarColor(const uint32 &color) { _barColor = color; }
+
+ long getEnergyLevel() const { return _energyLevel; }
+ void setEnergyLevel(const uint32);
+
+ long getMaxEnergy() const { return _maxEnergy; }
+ void setMaxEnergy(const uint32);
+
+ virtual void setBounds(const Common::Rect&);
+
+ virtual void draw(const Common::Rect&);
+
+protected:
+ void calcLevelRect(Common::Rect&) const;
+ void checkRedraw();
+
+ uint32 _energyLevel;
+ uint32 _maxEnergy;
+ Common::Rect _levelRect;
+ uint32 _barColor;
+};
+
+} // End of namespace Pegasus
+
+#endif