all repos — mgba @ 25cda2d7b2f1777ec4d7a004ee78079080958898

mGBA Game Boy Advance Emulator

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#pragma once
 7
 8#include <QEvent>
 9
10#include <mgba/internal/gba/input.h>
11
12namespace QGBA {
13
14class InputController;
15
16class GamepadAxisEvent : public QEvent {
17public:
18	enum Direction {
19		NEUTRAL = 0,
20		POSITIVE = 1,
21		NEGATIVE = -1
22	};
23
24	GamepadAxisEvent(int axis, Direction direction, bool isNew, int type, InputController* controller = nullptr);
25
26	int axis() const { return m_axis; }
27	Direction direction() const { return m_direction; }
28	bool isNew() const { return m_isNew; }
29	GBAKey gbaKey() const { return m_key; }
30
31	static enum Type Type();
32
33private:
34	static enum Type s_type;
35
36	int m_axis;
37	Direction m_direction;
38	bool m_isNew;
39	InputController* m_controller;
40	GBAKey m_key;
41};
42
43}