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 #include "base/memory/weak_ptr.h" | |
9 | |
10 namespace exo { | |
11 class Gamepad; | |
12 | |
13 // Handles events on multiple gamepad | |
14 class GamepadDelegate { | |
15 public: | |
16 // Gives the delegate a chance to clean up when the Gamepad instance is | |
17 // destroyed. | |
18 virtual void OnGamepadDestroying(Gamepad* gamepad) = 0; | |
19 | |
20 // Called when the state of the gamepad has changed. | |
21 virtual void OnStateChange(bool connected) = 0; | |
22 | |
23 // Called when the user moved an axis of the gamepad. Valid axes are defined | |
24 // by the W3C 'standard gamepad' specification. | |
25 virtual void OnAxis(int axis, double value) = 0; | |
26 | |
27 // Called when the user pressed or moved a button of the gamepad. | |
28 // Valid buttons are defined by the W3C 'standard gamepad' specification. | |
29 virtual void OnButton(int button, bool pressed, double value) = 0; | |
30 | |
31 // Called after all gamepad information of this frame has been set and the | |
32 // client should evaluate the updated state. | |
33 virtual void OnFrame() = 0; | |
34 | |
35 // Used to obtain a weak pointer to this delegate. | |
36 virtual base::WeakPtr<GamepadDelegate> GetWeakPtr() = 0; | |
reveman
2016/06/30 01:19:05
Please handle this in the Gamepad implementation i
denniskempin
2016/06/30 17:08:29
Done. Also no longer needed.
| |
37 | |
38 protected: | |
39 virtual ~GamepadDelegate() {} | |
40 }; | |
41 | |
42 } // namespace exo | |
43 | |
44 #endif // COMPONENTS_EXO_GAMEPAD_DELEGATE_H_ | |
OLD | NEW |