diff options
Diffstat (limited to 'src/resource.cpp')
-rw-r--r-- | src/resource.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/resource.cpp b/src/resource.cpp index fdb4bf0..9933c4f 100644 --- a/src/resource.cpp +++ b/src/resource.cpp @@ -2,15 +2,15 @@ Resource::Resource(Rectangle t) { - L = t; + rect = t; - if(L.x == 0 && L.y == 0){ - L.x = -30 + static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(30.0-(-30.0)))); - L.y = -30 + static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(30.0-(-30.0)))); + if(rect.x == 0 && rect.y == 0){ + rect.x = -30 + static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(30.0-(-30.0)))); + rect.y = -30 + static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(30.0-(-30.0)))); } - gfxData.x = L.x; - gfxData.y = L.y; + gfxData.x = rect.x; + gfxData.y = rect.y; gfxData.r = 0.0; gfxData.g = 1.0; gfxData.b = 0.0; @@ -30,6 +30,6 @@ void Resource::grow() { if(amount < RESOURCE_AMOUNT_MAX){ amount+=growAmount; - L.h = L.w = map(amount,0,RESOURCE_AMOUNT_MAX,0,RESOURCE_SIZE_MAX); + rect.h = rect.w = map(amount,0,RESOURCE_AMOUNT_MAX,0,RESOURCE_SIZE_MAX); } } |