Overte C++ Documentation
ActionEndpoint.h
1 //
2 // Created by Bradley Austin Davis 2015/10/23
3 // Copyright 2015 High Fidelity, Inc.
4 //
5 // Distributed under the Apache License, Version 2.0.
6 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7 //
8 
9 #pragma once
10 #ifndef hifi_Controllers_ActionEndpoint_h
11 #define hifi_Controllers_ActionEndpoint_h
12 
13 #include "../Endpoint.h"
14 
15 #include "../../Actions.h"
16 #include <DependencyManager.h>
17 
18 #include "../../UserInputMapper.h"
19 
20 namespace controller {
21 
22 class ActionEndpoint : public Endpoint {
23 public:
24  static std::shared_ptr<Endpoint> newEndpoint(const Input& id = Input::INVALID_INPUT) {
25  return std::shared_ptr<Endpoint>(new ActionEndpoint(id));
26  };
27 
28  virtual AxisValue peek() const override { return _currentValue; }
29  virtual void apply(AxisValue newValue, const Pointer& source) override;
30 
31  virtual Pose peekPose() const override { return _currentPose; }
32  virtual void apply(const Pose& value, const Pointer& source) override;
33 
34  virtual void reset() override;
35 
36 private:
37  ActionEndpoint(const Input& id = Input::INVALID_INPUT) : Endpoint(id) { }
38 
39  AxisValue _currentValue { 0.0f, 0, false };
40  Pose _currentPose{};
41 };
42 
43 }
44 
45 #endif