all repos — mgba @ 6248e44e47a8156555f5b9873a24093643a8a12f

mGBA Game Boy Advance Emulator

src/platform/qt/SensorView.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#ifndef QGBA_SENSOR_VIEW
 7#define QGBA_SENSOR_VIEW
 8
 9#include <QTimer>
10#include <QWidget>
11
12#include <functional>
13
14#include "ui_SensorView.h"
15
16struct GBARotationSource;
17
18namespace QGBA {
19
20class ConfigController;
21class GameController;
22class GamepadAxisEvent;
23class InputController;
24
25class SensorView : public QWidget {
26Q_OBJECT
27
28public:
29	SensorView(GameController* controller, InputController* input, QWidget* parent = nullptr);
30
31protected:
32	bool eventFilter(QObject*, QEvent* event) override;
33
34private slots:
35	void updateSensors();
36	void setLuminanceValue(int);
37	void luminanceValueChanged(int);
38
39private:
40	Ui::SensorView m_ui;
41
42	std::function<void(int)> m_jiggered;
43	GameController* m_controller;
44	InputController* m_input;
45	GBARotationSource* m_rotation;
46	QTimer m_timer;
47
48	void jiggerer(QAbstractButton*, void (InputController::*)(int));
49};
50
51}
52
53#endif