Files clean up

This commit is contained in:
Yukarin 2017-02-03 20:19:10 +03:00 committed by Ivan
parent fa6fd5980e
commit 758f1bcdee
4 changed files with 17 additions and 10 deletions

View File

@ -1,13 +1,15 @@
#ifdef QT_UI #ifdef QT_UI
#include "glviewer.h"
#include <QQuickWindow> #include <QQuickWindow>
#include <QOpenGLContext> #include <QOpenGLContext>
#include <QCoreApplication> #include <QCoreApplication>
#include "glviewer.h"
// This class hooks beforeRendering and allows us to draw a scene and reset GL state. // This class hooks beforeRendering and allows us to draw a scene and reset GL state.
// In future, we will likely want to manually control the update rate. // In future, we will likely want to manually control the update rate.
void GLRenderer::paint() { void GLRenderer::paint()
{
// Do GL here // Do GL here
glViewport(0, 0, m_viewportSize.width(), m_viewportSize.height()); glViewport(0, 0, m_viewportSize.width(), m_viewportSize.height());
@ -48,7 +50,8 @@ void GLViewer::sync()
m_renderer->setViewportSize(window()->size() * window()->devicePixelRatio()); m_renderer->setViewportSize(window()->size() * window()->devicePixelRatio());
} }
void GLViewer::cleanup() { void GLViewer::cleanup()
{
if (m_renderer) { if (m_renderer) {
delete m_renderer; delete m_renderer;
m_renderer = 0; m_renderer = 0;

View File

@ -2,18 +2,19 @@
#include <QQuickItem> #include <QQuickItem>
class GLRenderer : public QObject { class GLRenderer : public QObject
Q_OBJECT {
Q_OBJECT
public: public:
GLRenderer() { } GLRenderer() { }
void setViewportSize(const QSize &size) { m_viewportSize = size; } void setViewportSize(const QSize &size) { m_viewportSize = size; }
public slots: public slots:
void paint(); void paint();
private: private:
QSize m_viewportSize; QSize m_viewportSize;
}; };
class GLViewer : public QQuickItem class GLViewer : public QQuickItem

View File

@ -3,6 +3,7 @@
#ifdef QT_UI #ifdef QT_UI
#include <QGuiApplication> #include <QGuiApplication>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include "glviewer.h" #include "glviewer.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -13,6 +14,5 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml")); QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml"));
return app.exec(); return app.exec();
Q_UNUSED(engine)
} }
#endif #endif

View File

@ -8,6 +8,7 @@ ApplicationWindow {
title: qsTr("RPCS3 Qt") title: qsTr("RPCS3 Qt")
width: Screen.desktopAvailableWidth / 2 width: Screen.desktopAvailableWidth / 2
height: Screen.desktopAvailableHeight / 2 height: Screen.desktopAvailableHeight / 2
menuBar: MenuBar { menuBar: MenuBar {
Menu { Menu {
title: qsTr("&Boot") title: qsTr("&Boot")
@ -46,7 +47,9 @@ ApplicationWindow {
MenuItem { text: qsTr("&About...") } MenuItem { text: qsTr("&About...") }
} }
} }
GLViewer {} GLViewer {}
Rectangle { Rectangle {
color: Qt.rgba(0, 0.5, 0.35); color: Qt.rgba(0, 0.5, 0.35);
height: Math.round(parent.height / 2) height: Math.round(parent.height / 2)