summaryrefslogtreecommitdiff
path: root/chromium/components/exo/gamepad_delegate.h
blob: bb698612c6f59a94decd21cc76b3d72770dbe806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// 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_GAMEPAD_DELEGATE_H_
#define COMPONENTS_EXO_GAMEPAD_DELEGATE_H_

#include "base/time/time.h"

namespace exo {

// Handles events for a specific gamepad.
class GamepadDelegate {
 public:
  // Called when the gamepad has been removed.
  virtual void OnRemoved() = 0;

  // Called when the user moved an axis of the gamepad.
  virtual void OnAxis(int axis, double value, base::TimeTicks timestamp) = 0;

  // Called when the user pressed or moved a button of the gamepad.
  virtual void OnButton(int button,
                        bool pressed,
                        base::TimeTicks timestamp) = 0;

  // Called after all gamepad information of this frame has been set and the
  // client should evaluate the updated state.
  virtual void OnFrame(base::TimeTicks timestamp) = 0;

 protected:
  virtual ~GamepadDelegate() {}
};

}  // namespace exo

#endif  // COMPONENTS_EXO_GAMEPAD_DELEGATE_H_