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_GAMEPAD_DELEGATE_H_ |
| 6 #define COMPONENTS_EXO_GAMEPAD_DELEGATE_H_ |
| 7 |
| 8 namespace exo { |
| 9 class Gamepad; |
| 10 |
| 11 // Handles events on multiple gamepad |
| 12 class GamepadDelegate { |
| 13 public: |
| 14 // Gives the delegate a chance to clean up when the Gamepad instance is |
| 15 // destroyed. |
| 16 virtual void OnGamepadDestroying(Gamepad* gamepad) = 0; |
| 17 |
| 18 // Called when the state of the gamepad has changed. |
| 19 virtual void OnStateChange(bool connected) = 0; |
| 20 |
| 21 // Called when the user moved an axis of the gamepad. Valid axes are defined |
| 22 // by the W3C 'standard gamepad' specification. |
| 23 virtual void OnAxis(int axis, double value) = 0; |
| 24 |
| 25 // Called when the user pressed or moved a button of the gamepad. |
| 26 // Valid buttons are defined by the W3C 'standard gamepad' specification. |
| 27 virtual void OnButton(int button, bool pressed, double value) = 0; |
| 28 |
| 29 // Called after all gamepad information of this frame has been set and the |
| 30 // client should evaluate the updated state. |
| 31 virtual void OnFrame() = 0; |
| 32 |
| 33 protected: |
| 34 virtual ~GamepadDelegate() {} |
| 35 }; |
| 36 |
| 37 } // namespace exo |
| 38 |
| 39 #endif // COMPONENTS_EXO_GAMEPAD_DELEGATE_H_ |
OLD | NEW |