Position_InputNode.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 #include "InputNode.hpp"
6 #include "InputEvent.hpp"
7 #include "../TimeSystem/FrameUpdateClient.hpp"
8 
9 namespace iv
10 {
11 
17 {
18 public:
19  class Tester
20  {
21  public:
25  virtual bool position_test( int2 input_pos ) = 0;
26  };
27 
28 public:
31 
36  Position_InputNode( Instance * inst, Tester * tester, bool keeps_press_in_offspace );
38  void status( iv::TableDebugView * view );
39 
40 //------------------------- configuration ---------------------------
41  void input_id( InputId );
42  InputId input_id();
43 
44 
51  void fallthrough_enabled( bool );
52  bool fallthrough_enabled();
53 
54 //------------------------- query --------------------------------------------
56 
58 
59  //-------------
65  void interruptActivation();
66 
67 private:
68  // FrameUpdateClient
69  virtual void frame_update() override;
70 
71 private:
72  // InputNode
73  virtual void input_process( InputRoot * root, Input::DeviceKey key, bool & press, bool & real, bool & offspace ) override;
74  virtual bool input_trigger_process( InputRoot * root, Input::DeviceKey key ) override;
75 
76  //
77  void input_process_hover( InputRoot * root, Input::DeviceKey key, bool & press, bool & real, bool & offspace );
78  void setup_frame_update();
79  void reserve_hover_keys( InputRoot * root, bool reserve );
80 
81 private:
82  Tester * tester;
83  bool keeps_press_in_offspace;
84 
86  InputQuery iq;
87  InputId _input_id;
88 
89  bool _fallthrough;
90 
91  std::optional< Input::DeviceKey > _active;
92  std::optional< Input::DeviceKey > _durated;
93 
94  std::unordered_map< Input::DeviceKey, bool /*hit_last*/, Input::DeviceKey_Hash > _watched;
95 
96  std::optional< Input::DeviceKey > _last;
97 };
98 
99 }