aboutsummaryrefslogtreecommitdiffstats
path: root/include/components.hpp
diff options
context:
space:
mode:
authorAndy <drumsetmonkey@gmail.com>2017-01-20 10:37:21 -0500
committerAndy <drumsetmonkey@gmail.com>2017-01-20 10:37:21 -0500
commit4d8f9974156068e4595bf219cacfd9fcd2fd7174 (patch)
treef3e938c0e49537a9dea661f46eed6ee74950b48a /include/components.hpp
parent1894e311bdeb098c3bef9bd342e0eaf78d197a9b (diff)
parent1ac412a5496fb6c63c47f199dfc7facd5f4c080a (diff)
Merge branch 'master' of https://github.com/tcsullivan/gamedev
Diffstat (limited to 'include/components.hpp')
-rw-r--r--include/components.hpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/include/components.hpp b/include/components.hpp
index e0147b0..5292fb2 100644
--- a/include/components.hpp
+++ b/include/components.hpp
@@ -5,15 +5,19 @@
* this allows the entity to change stats or skills on the go. This also allows every "object"
* the be an entity, and it gives the game a much better customizability over xml.
*/
-
#ifndef COMPONENTS_HPP
#define COMPONENTS_HPP
-#include <entityx/entityx.h>
-#include <common.hpp>
-#include <texture.hpp>
+#include <string>
+#include <vector>
+
#include <events.hpp>
-#include <atomic>
+#include <inventory.hpp>
+#include <random.hpp>
+#include <texture.hpp>
+#include <vector2.hpp>
+
+#include <entityx/entityx.h>
#include <tinyxml2.h>
using namespace tinyxml2;
@@ -61,7 +65,7 @@ struct Physics {
* Constructor that sets the gravity constant, if not specified it becomes 0.
* @param g The non default gravity constant.
*/
- Physics(float g = 0.0f): g(g) {}
+ Physics(float g = 1.0f): g(g) {}
float g; /**< The gravity constant, how fast the object falls */
};
@@ -102,6 +106,13 @@ struct Name {
std::string name;
};
+struct ItemDrop {
+ ItemDrop(InventoryEntry& ie)
+ : item(ie) {}
+
+ InventoryEntry item;
+};
+
/**
* @struct Solid
* @brief Allows an entity to collide with other objects.
@@ -151,6 +162,14 @@ struct SpriteData {
offset_tex.y = offset.y/tmpsize.y;
}
+ SpriteData(Texture t)
+ : tex(t) {
+ size_tex = 1;
+ offset_tex = 0;
+ size = tex.getDim();
+ offset = 0;
+ }
+
Texture tex;
vec2 size;
vec2 offset;
@@ -158,7 +177,7 @@ struct SpriteData {
vec2 offset_tex;
vec2 size_tex;
- uint limb;
+ unsigned int limb;
};
using Frame = std::vector<std::pair<SpriteData, vec2>>;