sprk_space_mouse_op.h
1 #include "sprk.h"
2 
3 #define DIRECTINPUT_VERSION 0x0800
4 #include <dinput.h>
5 
6 using namespace HPS;
7 
9 {
10 public:
11  SpaceMouseOperator(HPS::WindowHandle in_window_handle, Canvas const & in_canvas);
13 
14  virtual HPS::UTF8 GetName() const override { return "HPS_SpaceMouseOperator"; }
15 
16  virtual void OnViewAttached(HPS::View const & attached_view) override;
17  virtual void OnModelAttached() override;
18  virtual bool OnTimerTick(HPS::TimerTickEvent const & in_event) override;
19 
20  void HandleButtons(unsigned char const buttons[32]);
21 
22 private:
23  class DIDeviceInfo
24  {
25  public:
26  DIDEVICEINSTANCE di_instance;
27  DIJOYSTATE di_joystick;
28  LPDIRECTINPUTDEVICE8 di_hid_device;
29  };
30 
31  void GetModelBounding(Model const & model);
32  bool InitializeDirectInput();
33  bool UpdateState();
34  static BOOL CALLBACK SMEnumDevices(DIDEVICEINSTANCE const * instance, void * context);
35  static BOOL CALLBACK SMEnumAxes(DIDEVICEOBJECTINSTANCE const * instance, void * context);
36 
37  bool di_initialized;
38  HPS::WindowHandle window_handle;
39  LPDIRECTINPUT8 di_interface;
40  DIDeviceInfo di_device_info;
41  std::vector<bool> button_states;
42 
43  float bbx_radius;
44  Point bbx_center;
45 
46  View attached_view;
47  Canvas canvas;
48  SegmentKey view_segment;
49  KeyPath path_to_model;
50 
51 };
Definition: hps.h:85
Definition: sprk.h:1102
Definition: sprk.h:936
Definition: hps.h:8044
virtual HPS::UTF8 GetName() const override
Definition: sprk_space_mouse_op.h:14
Definition: hps.h:7396
Definition: sprk_space_mouse_op.h:8
Definition: hps.h:47547
Definition: sprk.h:1317
Definition: hps.h:9675
Definition: sprk.h:1945