summaryrefslogtreecommitdiff
path: root/src/resource.cpp
diff options
context:
space:
mode:
authortom <tombarrett@siu.edu>2017-01-14 11:56:33 -0600
committertom <tombarrett@siu.edu>2017-01-14 11:56:33 -0600
commitf2f0867edd0d9624a77e4e5db39825b8ea1a55d0 (patch)
tree1ead1fa412bd7c2e791310c7cb7bbe84c79696a4 /src/resource.cpp
parentb97a54b8acd113e99871fdb0f683e27e0912bf42 (diff)
completly remove location structure and replaced it with sdl_rect
Diffstat (limited to 'src/resource.cpp')
-rw-r--r--src/resource.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/resource.cpp b/src/resource.cpp
index 326c047..eec1113 100644
--- a/src/resource.cpp
+++ b/src/resource.cpp
@@ -1,31 +1,19 @@
#include "resource.hpp"
-Resource::Resource(Window m, int size)
+Resource::Resource(Window m, SDL_Rect R)
{
- Init(m);
+ renderer = m.getRenderer();
type = 2;
-
- rect.h = rect.w = size;
+ rect = R;
- L.x = rect.x;
- L.y = rect.y;
+ if(rect.x == 0 && rect.y == 0){
+ rect.x = rand()%WINDOW_X;
+ rect.y = rand()%WINDOW_Y;
+ }
amount = RESOURCE_AMOUNT;
}
-Resource::Resource(Window m, int size, Location z)
-{
- Init(m,z);
- type = 2;
-
- rect.h = rect.w = size;
-
- L.x = rect.x;
- L.y = rect.y;
-
- amount = RESOURCE_AMOUNT;
-}
-
void Resource::eat()
{
amount-=10;