From f2f0867edd0d9624a77e4e5db39825b8ea1a55d0 Mon Sep 17 00:00:00 2001 From: tom Date: Sat, 14 Jan 2017 11:56:33 -0600 Subject: completly remove location structure and replaced it with sdl_rect --- src/resource.cpp | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'src/resource.cpp') 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; -- cgit v1.2.3