Index: components/exo/gamepads_delegate.h |
diff --git a/components/exo/gamepads_delegate.h b/components/exo/gamepads_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e3a0371c1f1bf315bc5918086c969b70b73fbe4b |
--- /dev/null |
+++ b/components/exo/gamepads_delegate.h |
@@ -0,0 +1,43 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_EXO_GAMEPADS_DELEGATE_H_ |
+#define COMPONENTS_EXO_GAMEPADS_DELEGATE_H_ |
+ |
+namespace exo { |
+class Gamepads; |
+ |
+// Handles events on multiple gamepads |
+class GamepadsDelegate { |
+ public: |
+ // Gives the delegate a chance to clean up when the Gamepads instance is |
+ // destroyed. |
+ virtual void OnGamepadsDestroying(Gamepads* gamepads) = 0; |
+ |
+ // Called when a new gamepad is connected. Each gamepad is assigned an id |
+ // that is used to identify it in every subsequent call. |
+ virtual void OnConnected(int id) = 0; |
+ |
+ // Called when a gamepad is disconnected. |
+ virtual void OnDisconnected(int id) = 0; |
+ |
+ // Called when the user moved an axis of the gamepad. Valid axes are defined |
+ // by the W3C 'standard gamepad' specification. |
+ virtual void OnAxis(int id, int axis, double value) = 0; |
+ |
+ // Called when the user pressed or moved a button of the gamepad. |
+ // Valid buttons are defined by the W3C 'standard gamepad' specification. |
+ virtual void OnButton(int id, int button, bool pressed, double value) = 0; |
+ |
+ // Called after all gamepad information of this frame has been set and the |
+ // client should evaluate the updated state. |
+ virtual void OnFrame(int id) = 0; |
+ |
+ protected: |
+ virtual ~GamepadsDelegate() {} |
+}; |
+ |
+} // namespace exo |
+ |
+#endif // COMPONENTS_EXO_GAMEPADS_DELEGATE_H_ |