fixed typos

This commit is contained in:
2025-08-31 01:33:21 +02:00
parent b8f6238d31
commit 5d2244497f
5 changed files with 1 additions and 0 deletions
+26
View File
@@ -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);
}
+29
View File
@@ -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