Basic ECS setup.
- Added std::variant to pch.h
This commit is contained in:
+18
-5
@@ -1,14 +1,27 @@
|
|||||||
#ifndef ECS_H
|
#ifndef ECS_H
|
||||||
#define ECS_H
|
#define ECS_H
|
||||||
|
|
||||||
|
#include "bindings/ruby.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
struct Entity {};
|
struct Entity {
|
||||||
struct Component;
|
Vec2<float> position;
|
||||||
struct System;
|
std::unordered_map<std::string, size_t> components;
|
||||||
|
};
|
||||||
|
|
||||||
struct EntityPool {
|
struct Component {
|
||||||
Entity entities[];
|
enum struct Type {
|
||||||
|
Int,
|
||||||
|
Float,
|
||||||
|
Boolean,
|
||||||
|
RubyObject
|
||||||
|
};
|
||||||
|
std::unordered_map<std::string, std::variant<int64_t, double, bool, Ruby::RubyObject>> globals;
|
||||||
|
std::vector<std::tuple<std::string, Type, void *>> table;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct System {
|
||||||
|
Ruby::Block function;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
#include <variant>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user