ppsspp/Qt/QtMain.h

124 lines
2.1 KiB
C
Raw Normal View History

2012-12-16 09:47:51 +00:00
#ifndef QTMAIN_H
#define QTMAIN_H
#include <QTouchEvent>
#include <QMouseEvent>
#include <QInputDialog>
#include "gfx_es2/glsl_program.h"
#include <QGLWidget>
2014-12-18 22:57:59 +00:00
#ifndef SDL
2012-12-16 09:47:51 +00:00
#include <QAudioOutput>
#include <QAudioFormat>
#endif
2016-10-12 10:32:20 +00:00
#if defined(MOBILE_DEVICE)
#include <QAccelerometer>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QTM_USE_NAMESPACE
#endif
#endif
#include <cassert>
#include "base/display.h"
#include "base/logging.h"
#include "base/timeutil.h"
#include "file/zip_read.h"
2015-09-06 11:44:06 +00:00
#include "gfx/gl_common.h"
#include "input/input_state.h"
2013-07-08 00:04:20 +00:00
#include "input/keycodes.h"
2016-01-03 14:03:08 +00:00
#include "thin3d/thin3d.h"
#include "base/NativeApp.h"
#include "net/resolve.h"
2013-08-05 10:08:38 +00:00
#include "base/NKCodeFromQt.h"
2016-01-03 14:03:08 +00:00
#include "Common/GraphicsContext.h"
#include "Core/Core.h"
#include "Core/Config.h"
#include "Core/System.h"
// Input
2017-03-15 05:01:18 +00:00
void SimulateGamepad();
2016-01-03 14:03:08 +00:00
class QtDummyGraphicsContext : public DummyGraphicsContext {
public:
QtDummyGraphicsContext() {
draw_ = Draw::T3DCreateGLContext();
SetGPUBackend(GPUBackend::OPENGL);
bool success = draw_->CreatePresets();
assert(success);
2016-01-03 14:03:08 +00:00
}
~QtDummyGraphicsContext() {
delete draw_;
}
Draw::DrawContext *GetDrawContext() override {
return draw_;
}
private:
Draw::DrawContext *draw_;
2016-01-03 14:03:08 +00:00
};
//GUI
class MainUI : public QGLWidget
{
Q_OBJECT
public:
explicit MainUI(QWidget *parent = 0);
~MainUI();
public slots:
QString InputBoxGetQString(QString title, QString defaultValue);
signals:
void doubleClick();
void newFrame();
protected:
void timerEvent(QTimerEvent *);
void changeEvent(QEvent *e);
bool event(QEvent *e);
void initializeGL();
void resizeGL(int w, int h);
void paintGL();
void updateAccelerometer();
private:
2016-01-03 14:03:08 +00:00
QtDummyGraphicsContext *graphicsContext;
float xscale, yscale;
2016-10-12 10:32:20 +00:00
#if defined(MOBILE_DEVICE)
QAccelerometer* acc;
#endif
};
2016-02-10 11:37:47 +00:00
extern MainUI* emugl;
2014-12-18 22:57:59 +00:00
#ifndef SDL
// Audio
2012-12-16 09:47:51 +00:00
class MainAudio: public QObject
{
Q_OBJECT
public:
2016-02-10 11:37:47 +00:00
MainAudio() {}
~MainAudio();
2013-10-26 09:51:29 +00:00
public slots:
void run();
2013-01-15 10:45:26 +00:00
protected:
void timerEvent(QTimerEvent *);
2012-12-16 09:47:51 +00:00
private:
QIODevice* feed;
QAudioOutput* output;
int mixlen;
char* mixbuf;
2013-01-31 22:49:37 +00:00
int timer;
2012-12-16 09:47:51 +00:00
};
2014-12-18 22:57:59 +00:00
#endif //SDL
#endif