summaryrefslogtreecommitdiff
path: root/src/entity.cpp
diff options
context:
space:
mode:
authortom <tom@apollo>2017-01-10 09:49:32 -0600
committertom <tom@apollo>2017-01-10 09:49:32 -0600
commitf6f6d81c5634f659693914b7b74efcdd39ba5d4f (patch)
tree5b51e9b82ae36c648e212cc9c95fb8233dc181c1 /src/entity.cpp
parent20717aeb1b12a7179e7b29c3c8880f18b360a1c8 (diff)
-Replaced images with colored rectangles
-Removed various functions and variables pertaining to such images -Started migrating all uses of Location to SDL_Rect (I would preferably completly remove Location.hpp) -Scaled down resolution to 1080x640 (I would like to make these global constants)
Diffstat (limited to 'src/entity.cpp')
-rw-r--r--src/entity.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/entity.cpp b/src/entity.cpp
index 4f60851..be3e792 100644
--- a/src/entity.cpp
+++ b/src/entity.cpp
@@ -1,18 +1,27 @@
#include "entity.hpp"
-void Entity::Place()
+void Entity::Init(Window m)
+{
+ renderer = m.getRenderer();
+ rect.y = rand()%640;
+ rect.x = rand()%1080;
+}
+
+void Entity::Init(Window m, Location z)
{
- SDL_Rect rect = {L.x, L.y, width/8, height/8};
- SDL_RenderCopyEx(renderer,texture,NULL,&rect,degrees,NULL,SDL_FLIP_NONE);
+ renderer = m.getRenderer();
+ rect.y = z.y;
+ rect.x = z.x;
}
-SDL_Texture* Entity::loadTexture(string path, Window main)
+void Entity::Place()
{
- SDL_Surface* surface = IMG_Load(path.c_str());
- SDL_SetColorKey(surface, SDL_TRUE, SDL_MapRGB(surface->format, 255, 255, 255));
- height = surface->h;
- width = surface->w;
- SDL_Texture* texture = SDL_CreateTextureFromSurface(main.getRenderer(),surface);
- SDL_FreeSurface(surface);
- return texture;
+ if(type == 1)
+ SDL_SetRenderDrawColor(renderer,255,0,255,255);
+ else
+ SDL_SetRenderDrawColor(renderer,0,255,0,255);
+
+ SDL_RenderDrawRect(renderer, &rect);
+
+ SDL_SetRenderDrawColor(renderer,0,0,0,255);
}