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 12 namespace QGBA { 13 14 class InputController; 15 16 class GamepadHatEvent : public QEvent { 17 public: 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 hatId()28 int hatId() const { return m_hatId; } direction()29 Direction direction() const { return m_direction; } gbaKey()30 GBAKey gbaKey() const { return m_key; } 31 32 static Type Down(); 33 static Type Up(); 34 35 private: 36 static Type s_downType; 37 static Type s_upType; 38 39 int m_hatId; 40 Direction m_direction; 41 GBAKey m_key; 42 }; 43 44 } 45