diff options
Diffstat (limited to 'src/entity.cpp')
-rw-r--r-- | src/entity.cpp | 31 |
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); } |