AnimSystem.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "AnimConnector.hpp"
5 #include <unordered_set>
6 #include <vector>
7 
8 namespace iv
9 {
10 
11 class AnimNodeI;
12 class AnimConnector;
13 
14 class AnimSystem : public System
15 {
16 public:
18 
19  virtual void status( TextDebugView * view ) override;
20  virtual std::string debug_name() const override { return "AnimSystem"; }
21 
22  //
23  void AnimUpdate( int delta_ms );
24 
25  // roots
26  void InsertRoot( AnimNodeI * client );
27  void RemoveRoot( AnimNodeI * client );
28 
29  unsigned update_id();
30 
31 private:
32  void AnimUpdate_Connector( AnimConnector * connector );
33  void AnimUpdate_Node( AnimNodeI * node );
34 
35 private:
36  struct PrintState
37  {
38  std::unordered_set< AnimNodeI const * > printed_nodes;
39  std::unordered_set< AnimConnector const * > printed_connectors;
40  };
41 
42  void debug_print_connector( TreeDebugView * tree, AnimConnector * connector, PrintState & state );
43  void debug_print_node( TreeDebugView * tree, AnimNodeI * node, PrintState & state );
44 
45 private:
46  // index
47  std::unordered_set< AnimNodeI * > roots;
48 
49  // state
50  unsigned _update_id;
51 
52  // cache
53  std::vector< AnimConnector * > connectors;
54  unsigned nodes_cnt;
55 };
56 
57 }