aboutsummaryrefslogtreecommitdiffstats
path: root/include/components/visible.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/components/visible.hpp')
-rw-r--r--include/components/visible.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/components/visible.hpp b/include/components/visible.hpp
new file mode 100644
index 0000000..4785fb0
--- /dev/null
+++ b/include/components/visible.hpp
@@ -0,0 +1,30 @@
+#ifndef COMPONENTS_VISIBLE_HPP_
+#define COMPONENTS_VISIBLE_HPP_
+
+#include "base.hpp"
+
+/**
+ * @struct Visible
+ * @brief If an entity is visible we want to be able to draw it.
+ */
+struct Visible : public Component {
+ /**
+ * @brief Decide what layer to draw the entity on.
+ * When stuff is drawn, it is drawn on a "layer". This layer gives more of a 3D effect to the world.
+ * @param z The desired "layer" of the entity.
+ */
+ Visible(float z = 0.0f): z(z) {}
+ Visible(XMLElement* imp, XMLElement* def) {
+ fromXML(imp, def);
+ }
+
+ float z; /**< The value along the z axis the entity will be drawn on */
+
+ void fromXML(XMLElement* imp, XMLElement* def) final {
+ (void)imp;
+ if (def->QueryFloatAttribute("value", &z) != XML_NO_ERROR)
+ z = 0;
+ }
+};
+
+#endif // COMPONENTS_VISIBLE_HPP_