src/platform/qt/GamepadAxisEvent.h (view raw)
1/* Copyright (c) 2013-2015 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef QGBA_GAMEPAD_AXIS_EVENT
7#define QGBA_GAMEPAD_AXIS_EVENT
8
9#include <QEvent>
10
11extern "C" {
12#include "gba/input.h"
13}
14
15namespace QGBA {
16
17class InputController;
18
19class GamepadAxisEvent : public QEvent {
20public:
21 enum Direction {
22 NEUTRAL = 0,
23 POSITIVE = 1,
24 NEGATIVE = -1
25 };
26
27 GamepadAxisEvent(int axis, Direction direction, bool isNew, InputController* controller = nullptr);
28
29 int axis() const { return m_axis; }
30 Direction direction() const { return m_direction; }
31 bool isNew() const { return m_isNew; }
32 GBAKey gbaKey() const { return m_key; }
33
34 static enum Type Type();
35
36private:
37 static enum Type s_type;
38
39 int m_axis;
40 Direction m_direction;
41 bool m_isNew;
42 InputController* m_controller;
43 GBAKey m_key;
44};
45
46}
47
48#endif