removed entity.h
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "datatypes.h"
|
||||
#include <SDL3/SDL.h>
|
||||
//#include <SDL3/SDL_render.h>
|
||||
#include <SDL3/SDL_render.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
class Entity {
|
||||
|
||||
public:
|
||||
Entity() {}
|
||||
Entity(float x, float y) : position(x, y) {}
|
||||
Entity(float x, float y, int w, int h) : position(x, y), rect(w, h) {}
|
||||
|
||||
bool load(SDL_Renderer *renderer, std::string path) {
|
||||
|
||||
SDL_Surface *asset = SDL_LoadBMP(path.c_str());
|
||||
if(asset == NULL) {
|
||||
SDL_Log("Unable to load image: %s", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
texture = SDL_CreateTextureFromSurface(renderer, asset);
|
||||
return true;
|
||||
};
|
||||
|
||||
Vec2D<float> position;
|
||||
Vec2D<int> size;
|
||||
|
||||
SDL_Texture *texture;
|
||||
SDL_FRect rect;
|
||||
Color color = {100,100,100};
|
||||
|
||||
void draw(SDL_Renderer *renderer){
|
||||
rect.x = position.x;
|
||||
rect.y = position.y;
|
||||
rect.w = size.x;
|
||||
rect.h = size.y;
|
||||
|
||||
//SDL_SetTextureColorMod(texture, color.r, color.g, color.b);
|
||||
SDL_RenderTexture(renderer, texture, NULL, &rect);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user