fixed typos
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#include "entitybase.hpp"
|
||||
#include "../../include/raylib-cpp.hpp"
|
||||
#include "../render/textures.hpp"
|
||||
#include <functional>
|
||||
#include <sys/types.h>
|
||||
#include <iostream>
|
||||
|
||||
Entity::Entity(ID Id, raylib::Rectangle Rect, std::string &n, int h, int maxh) {
|
||||
id = Id;
|
||||
rect = Rect;
|
||||
health = h;
|
||||
maxhealth = maxh;
|
||||
nametag = n;
|
||||
}
|
||||
|
||||
void Entity::Update() {
|
||||
if (controller) {
|
||||
controller(*this);
|
||||
}else {
|
||||
std::cout << "Entity is missing an controller, doing nothing.\n";
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::Draw() {
|
||||
DrawTextureEx(entityTextures.GetTexture(id), raylib::Vector2(rect.x, rect.y), 0, 0, WHITE);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef ENTITYBASE_HPP
|
||||
#define ENTITYBASE_HPP
|
||||
|
||||
#include "../../include/raylib-cpp.hpp"
|
||||
#include "../render/textures.hpp"
|
||||
#include <functional>
|
||||
#include <sys/types.h>
|
||||
#include <iostream>
|
||||
|
||||
struct Entity;
|
||||
|
||||
|
||||
using ControllerFunc = std::function<void(Entity&)>;
|
||||
|
||||
struct Entity {
|
||||
ID id;
|
||||
raylib::Rectangle rect;
|
||||
int health;
|
||||
int maxhealth;
|
||||
std::string nametag;
|
||||
ControllerFunc controller;
|
||||
void Update();
|
||||
void Draw();
|
||||
|
||||
Entity(ID Id, raylib::Rectangle rect, std::string &n, int h, int maxh);
|
||||
|
||||
};
|
||||
|
||||
#endif //ENTITYBASE_HPP
|
||||
Reference in New Issue
Block a user