OLD | NEW |
(Empty) | |
| 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 |
| 5 #ifndef COMPONENTS_EXO_GAMEPADS_DELEGATE_H_ |
| 6 #define COMPONENTS_EXO_GAMEPADS_DELEGATE_H_ |
| 7 |
| 8 namespace exo { |
| 9 class Gamepads; |
| 10 |
| 11 // Handles events on multiple gamepads |
| 12 class GamepadsDelegate { |
| 13 public: |
| 14 // Gives the delegate a chance to clean up when the Gamepads instance is |
| 15 // destroyed. |
| 16 virtual void OnGamepadsDestroying(Gamepads* gamepads) = 0; |
| 17 |
| 18 // Called when a new gamepad is connected. Each gamepad is assigned an id |
| 19 // that is used to identify it in every subsequent call. |
| 20 virtual void OnConnected(int id) = 0; |
| 21 |
| 22 // Called when a gamepad is disconnected. |
| 23 virtual void OnDisconnected(int id) = 0; |
| 24 |
| 25 // Called when the user moved an axis of the gamepad. Valid axes are defined |
| 26 // by the W3C 'standard gamepad' specification. |
| 27 virtual void OnAxis(int id, int axis, double value) = 0; |
| 28 |
| 29 // Called when the user pressed or moved a button of the gamepad. |
| 30 // Valid buttons are defined by the W3C 'standard gamepad' specification. |
| 31 virtual void OnButton(int id, int button, bool pressed, double value) = 0; |
| 32 |
| 33 // Called after all gamepad information of this frame has been set and the |
| 34 // client should evaluate the updated state. |
| 35 virtual void OnFrame(int id) = 0; |
| 36 |
| 37 protected: |
| 38 virtual ~GamepadsDelegate() {} |
| 39 }; |
| 40 |
| 41 } // namespace exo |
| 42 |
| 43 #endif // COMPONENTS_EXO_GAMEPADS_DELEGATE_H_ |
OLD | NEW |