gamepad_delegate.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_EXO_GAMEPAD_DELEGATE_H_
  5. #define COMPONENTS_EXO_GAMEPAD_DELEGATE_H_
  6. #include "base/time/time.h"
  7. namespace exo {
  8. // Handles events for a specific gamepad.
  9. class GamepadDelegate {
  10. public:
  11. virtual ~GamepadDelegate() {}
  12. // Called when the gamepad has been removed.
  13. virtual void OnRemoved() = 0;
  14. // Called when the user moved an axis of the gamepad.
  15. virtual void OnAxis(int axis, double value, base::TimeTicks timestamp) = 0;
  16. // Called when the user pressed or moved a button of the gamepad.
  17. virtual void OnButton(int button,
  18. bool pressed,
  19. base::TimeTicks timestamp) = 0;
  20. // Called after all gamepad information of this frame has been set and the
  21. // client should evaluate the updated state.
  22. virtual void OnFrame(base::TimeTicks timestamp) = 0;
  23. };
  24. } // namespace exo
  25. #endif // COMPONENTS_EXO_GAMEPAD_DELEGATE_H_