diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/creature.cpp | 8 | ||||
-rw-r--r-- | src/creature.h | 12 | ||||
-rw-r--r-- | src/entity.cpp | 7 | ||||
-rw-r--r-- | src/entity.h | 1 | ||||
-rw-r--r-- | src/main.cpp | 6 | ||||
-rw-r--r-- | src/main.h | 2 | ||||
-rw-r--r-- | src/resource.cpp | 8 | ||||
-rw-r--r-- | src/resource.h | 12 |
8 files changed, 46 insertions, 10 deletions
diff --git a/src/creature.cpp b/src/creature.cpp new file mode 100644 index 0000000..c96785e --- /dev/null +++ b/src/creature.cpp @@ -0,0 +1,8 @@ +#include "creature.h" + +Creature::Creature(Window m, std::string s) +{ + texture = loadTexture(s, m); + renderer = m.getRenderer(); + x=y=500; +} diff --git a/src/creature.h b/src/creature.h new file mode 100644 index 0000000..5f5bb8d --- /dev/null +++ b/src/creature.h @@ -0,0 +1,12 @@ +#ifndef creature_h +#define creature_h + +#include "entity.h" + +class Creature: public Entity +{ + public: + Creature(Window m, std::string s); +}; + +#endif diff --git a/src/entity.cpp b/src/entity.cpp index 5533975..03accd9 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -1,12 +1,5 @@ #include "entity.h" -Entity::Entity(Window m, std::string s) -{ - texture = loadTexture(s, m); - renderer = m.getRenderer(); - x=y=200; -} - void Entity::Place() { SDL_Rect rect = {x, y, width/8, height/8}; diff --git a/src/entity.h b/src/entity.h index 1d1f876..1d16a2c 100644 --- a/src/entity.h +++ b/src/entity.h @@ -6,7 +6,6 @@ class Entity { public: - Entity(Window m, std::string s); void Place(); SDL_Texture* loadTexture(std::string path, Window main); diff --git a/src/main.cpp b/src/main.cpp index 5ab78b3..88a34dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,7 +3,8 @@ int main()
{
Window main;
- Entity ship(main, "images/basic.png");
+ Creature testcreature(main, "images/Cbasic.png");
+ Resource testresource(main, "images/Rbasic.png");
Event e;
while(e.gRun())
@@ -16,7 +17,8 @@ int main() // eventHandle(e.gEvent());
}
main.Clear();
- ship.Place();
+ testcreature.Place();
+ testresource.Place();
main.Render();
}
@@ -4,5 +4,7 @@ #include "window.h" #include "entity.h" #include "event.h" +#include "creature.h" +#include "resource.h" #endif diff --git a/src/resource.cpp b/src/resource.cpp new file mode 100644 index 0000000..06c7a04 --- /dev/null +++ b/src/resource.cpp @@ -0,0 +1,8 @@ +#include "resource.h" + +Resource::Resource(Window m, std::string s) +{ + texture = loadTexture(s, m); + renderer = m.getRenderer(); + x=y=300; +} diff --git a/src/resource.h b/src/resource.h new file mode 100644 index 0000000..463f355 --- /dev/null +++ b/src/resource.h @@ -0,0 +1,12 @@ +#ifndef resource_h +#define resource_h + +#include "entity.h" + +class Resource: public Entity +{ + public: + Resource(Window m, std::string s); +}; + +#endif |