src/platform/qt/GamepadHatEvent.h (view raw)
1/* Copyright (c) 2013-2017 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#pragma once
7
8#include <QEvent>
9
10#include <mgba/internal/gba/input.h>
11
12namespace QGBA {
13
14class InputController;
15
16class GamepadHatEvent : public QEvent {
17public:
18 enum Direction {
19 CENTER = 0,
20 UP = 1,
21 RIGHT = 2,
22 DOWN = 4,
23 LEFT = 8
24 };
25
26 GamepadHatEvent(Type pressType, int hatId, Direction direction, int type, InputController* controller = nullptr);
27
28 int hatId() const { return m_hatId; }
29 Direction direction() const { return m_direction; }
30 GBAKey gbaKey() const { return m_key; }
31
32 static Type Down();
33 static Type Up();
34
35private:
36 static Type s_downType;
37 static Type s_upType;
38
39 int m_hatId;
40 Direction m_direction;
41 InputController* m_controller;
42 GBAKey m_key;
43};
44
45}