Starting matricies, etc...
This commit is contained in:
38
cve_game_object.hpp
Normal file
38
cve_game_object.hpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include "cve_model.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace cve {
|
||||
|
||||
struct Transform2dComponent {
|
||||
glm::vec2 translation{}; // Position offset
|
||||
glm::mat2 mat2() { return glm::mat2{1.f}; };
|
||||
};
|
||||
|
||||
class CveGameObject {
|
||||
public:
|
||||
using id_t = unsigned int;
|
||||
|
||||
static CveGameObject createGameObject() {
|
||||
static id_t currentId = 0;
|
||||
return CveGameObject{currentId++};
|
||||
}
|
||||
|
||||
CveGameObject(const CveGameObject &) = delete;
|
||||
CveGameObject &operator=(const CveGameObject &) = delete;
|
||||
CveGameObject(CveGameObject &&) = default;
|
||||
CveGameObject &operator=(CveGameObject &&) = default;
|
||||
|
||||
const id_t getId() { return id; }
|
||||
|
||||
std::shared_ptr<CveModel> model{};
|
||||
glm::vec3 color;
|
||||
Transform2dComponent transform2d{};
|
||||
|
||||
private:
|
||||
CveGameObject(id_t objID) : id{objID} {}
|
||||
id_t id;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user