diff options
author | tom <tom@ground-control> | 2015-04-30 22:53:59 -0500 |
---|---|---|
committer | tom <tom@ground-control> | 2015-04-30 22:53:59 -0500 |
commit | 29168e06ffcea8b8f55a9ed2e8acb3529e776456 (patch) | |
tree | e56d99ef9e38962064b64a00d61a355f9a23fc29 | |
parent | e1d75dfdf0727776adf0b3d44995ccf0e03487b3 (diff) |
added creature and resource classes
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | images/Cbasic.png (renamed from images/basic.png) | bin | 3081 -> 3081 bytes | |||
-rw-r--r-- | images/Rbasic.png | bin | 0 -> 1310 bytes | |||
-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 |
12 files changed, 48 insertions, 12 deletions
@@ -1,4 +1,4 @@ -OBJS = src/main.cpp src/window.cpp src/entity.cpp src/event.cpp +OBJS = src/main.cpp src/window.cpp src/entity.cpp src/event.cpp src/creature.cpp src/resource.cpp CC = g++ @@ -1,4 +1,4 @@ -Nature's Course - Tom Barrett +Nature's Course For librarys ~ sudo apt-get install libsdl* diff --git a/images/basic.png b/images/Cbasic.png Binary files differindex 6d1f592..6d1f592 100644 --- a/images/basic.png +++ b/images/Cbasic.png diff --git a/images/Rbasic.png b/images/Rbasic.png Binary files differnew file mode 100644 index 0000000..9f668cf --- /dev/null +++ b/images/Rbasic.png 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 |