~vladh/peony

peony/src/behavior.hpp -rw-r--r-- 1.2 KiB
7fc9922bVlad-Stefan Harbuz changes shaders namespace into class a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
  Peony Game Engine
  Copyright (C) 2020 Vlad-Stefan Harbuz <vlad@vladh.net>
  All rights reserved.
*/

#pragma once

#include "types.hpp"
#include "array.hpp"
#include "entities.hpp"
#include "spatial.hpp"

struct State;
struct EngineState;

namespace behavior {
  enum class Behavior {
    none,
    test,
    char_movement_test,
    length
  };

  struct BehaviorComponent {
    EntityHandle entity_handle;
    Behavior behavior = Behavior::none;
  };

  struct BehaviorComponentSet {
    Array<BehaviorComponent> components;
  };

  struct BehaviorState {
    State *state;
  };

  typedef void (*BehaviorFunction) (void *state, EntityHandle entity_handle);

  extern BehaviorFunction function_map[(uint32)Behavior::length];

  const char* behavior_to_string(Behavior behavior);
  Behavior behavior_from_string(const char *str);
  bool32 is_behavior_component_valid(BehaviorComponent *behavior_component);
  void update_behavior_components(
    BehaviorState *behavior_state,
    EngineState *engine_state
  );
  void init(
    BehaviorState *behavior_state,
    State *state
  );
}

using behavior::Behavior, behavior::BehaviorComponent,
  behavior::BehaviorComponentSet, behavior::BehaviorFunction,
  behavior::BehaviorState;