all repos — mgba @ 9c92a29b28d1f81224ba28d5fc83a9481eccd5eb

mGBA Game Boy Advance Emulator

src/platform/qt/InputController.h (view raw)

 1/* Copyright (c) 2013-2014 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_INPUT_CONTROLLER_H
 7#define QGBA_INPUT_CONTROLLER_H
 8
 9extern "C" {
10#include "gba-input.h"
11
12#ifdef BUILD_SDL
13#include "platform/sdl/sdl-events.h"
14#endif
15}
16
17#include <QSet>
18
19namespace QGBA {
20
21class ConfigController;
22
23class InputController {
24public:
25	static const uint32_t KEYBOARD = 0x51545F4B;
26
27	InputController();
28	~InputController();
29
30	void setConfiguration(ConfigController* config);
31	void loadConfiguration(uint32_t type);
32	void saveConfiguration(uint32_t type = KEYBOARD);
33
34	GBAKey mapKeyboard(int key) const;
35
36	void bindKey(uint32_t type, int key, GBAKey);
37
38	const GBAInputMap* map() const { return &m_inputMap; }
39
40#ifdef BUILD_SDL
41	int testSDLEvents();
42	QSet<int> activeGamepadButtons();
43#endif
44
45private:
46	GBAInputMap m_inputMap;
47	ConfigController* m_config;
48
49#ifdef BUILD_SDL
50	GBASDLEvents m_sdlEvents;
51#endif
52};
53
54}
55
56#endif