From f6f6d81c5634f659693914b7b74efcdd39ba5d4f Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 10 Jan 2017 09:49:32 -0600 Subject: -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) --- src/entity.cpp | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src/entity.cpp') 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); } -- cgit v1.2.3