summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortom <tom@ground-control>2015-04-30 22:53:59 -0500
committertom <tom@ground-control>2015-04-30 22:53:59 -0500
commit29168e06ffcea8b8f55a9ed2e8acb3529e776456 (patch)
treee56d99ef9e38962064b64a00d61a355f9a23fc29
parente1d75dfdf0727776adf0b3d44995ccf0e03487b3 (diff)
added creature and resource classes
-rw-r--r--Makefile2
-rw-r--r--README.md2
-rw-r--r--images/Cbasic.png (renamed from images/basic.png)bin3081 -> 3081 bytes
-rw-r--r--images/Rbasic.pngbin0 -> 1310 bytes
-rw-r--r--src/creature.cpp8
-rw-r--r--src/creature.h12
-rw-r--r--src/entity.cpp7
-rw-r--r--src/entity.h1
-rw-r--r--src/main.cpp6
-rw-r--r--src/main.h2
-rw-r--r--src/resource.cpp8
-rw-r--r--src/resource.h12
12 files changed, 48 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 9f346de..369b090 100644
--- a/Makefile
+++ b/Makefile
@@ -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++
diff --git a/README.md b/README.md
index 383e625..cfffeb3 100644
--- a/README.md
+++ b/README.md
@@ -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
index 6d1f592..6d1f592 100644
--- a/images/basic.png
+++ b/images/Cbasic.png
Binary files differ
diff --git a/images/Rbasic.png b/images/Rbasic.png
new file mode 100644
index 0000000..9f668cf
--- /dev/null
+++ b/images/Rbasic.png
Binary files differ
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();
}
diff --git a/src/main.h b/src/main.h
index 9a1a64d..d026886 100644
--- a/src/main.h
+++ b/src/main.h
@@ -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