A 3D game engine from scratch.
1// (c) 2020 Vlad-Stefan Harbuz <vlad@vladh.net>
2
3#pragma once
4
5#include "types.hpp"
6#include "array.hpp"
7#include "entities.hpp"
8#include "spatial.hpp"
9
10struct State;
11struct EngineState;
12
13class behavior {
14public:
15 enum class Behavior {
16 none,
17 test,
18 char_movement_test,
19 length
20 };
21
22 struct Component {
23 entities::Handle entity_handle;
24 Behavior behavior = Behavior::none;
25 };
26
27 struct State {
28 Array<Component> components;
29 ::State *state;
30 };
31
32 typedef void (*Function) (entities::Handle entity_handle);
33
34 static Function function_map[(u32)Behavior::length];
35
36 static char const * behavior_to_string(Behavior behavior);
37 static Behavior behavior_from_string(const char *str);
38 static bool is_behavior_component_valid(Component *behavior_component);
39 static void update();
40 static Array<behavior::Component> * get_components();
41 static behavior::Component * get_component(entities::Handle entity_handle);
42 static void init(
43 behavior::State *behavior_state,
44 memory::Pool *asset_memory_pool,
45 ::State *state
46 );
47
48private:
49 static behavior::State *state;
50};