all repos — mgba @ ec1fc632b23749add411a2d9a9a4a32bd957a99c

mGBA Game Boy Advance Emulator

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