From 5d89e31cf8beb75c4bf37da8189c1daa0bc77c2c Mon Sep 17 00:00:00 2001 From: LittleWhite Date: Fri, 28 Aug 2015 17:13:28 +0200 Subject: [PATCH] Add splash --- src/citra_qt/CMakeLists.txt | 10 ++++- src/citra_qt/bootmanager.cpp | 13 +++++- src/citra_qt/citra-qt.qrc | 5 +++ src/citra_qt/data/citra.svg | 80 ++++++++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 src/citra_qt/citra-qt.qrc create mode 100644 src/citra_qt/data/citra.svg diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index a82e8a85b..b3e18f0a8 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -60,18 +60,24 @@ set(UIS main.ui ) +set(RESOURCE + citra-qt.qrc + ) + create_directory_groups(${SRCS} ${HEADERS} ${UIS}) if (Qt5_FOUND) qt5_wrap_ui(UI_HDRS ${UIS}) + qt5_add_resources(RESOURCE_HDRS ${RESOURCE}) else() qt4_wrap_ui(UI_HDRS ${UIS}) + qt4_add_resources(RESOURCE_HDRS ${RESOURCE}) endif() if (APPLE) - add_executable(citra-qt MACOSX_BUNDLE ${SRCS} ${HEADERS} ${UI_HDRS}) + add_executable(citra-qt MACOSX_BUNDLE ${SRCS} ${HEADERS} ${UI_HDRS} ${RESOURCE_HDRS}) else() - add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS}) + add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS} ${RESOURCE_HDRS}) endif() target_link_libraries(citra-qt core video_core common qhexedit) target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 3d3347a64..426697d59 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -82,12 +82,20 @@ class GGLWidgetInternal : public QGLWidget { public: GGLWidgetInternal(QGLFormat fmt, GRenderWindow* parent) - : QGLWidget(fmt, parent), parent(parent) { + : QGLWidget(fmt, parent), splash(":/data/citra.svg"), parent(parent) { } void paintEvent(QPaintEvent* ev) override { if (do_painting) { QPainter painter(this); + + int scaled_width = width()/3; + int scaled_height = width()/3; + + painter.drawImage(QRect(width()/2-scaled_width/2, + height()/2-scaled_height/2, + scaled_width, + scaled_height), splash); } } @@ -101,6 +109,7 @@ public: private: GRenderWindow* parent; + QImage splash; bool do_painting; }; @@ -116,7 +125,7 @@ GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) : // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose QGLFormat fmt; fmt.setVersion(3,2); - fmt.setProfile(QGLFormat::CoreProfile); + //fmt.setProfile(QGLFormat::CoreProfile); // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X fmt.setOption(QGL::NoDeprecatedFunctions); diff --git a/src/citra_qt/citra-qt.qrc b/src/citra_qt/citra-qt.qrc new file mode 100644 index 000000000..928afd6e3 --- /dev/null +++ b/src/citra_qt/citra-qt.qrc @@ -0,0 +1,5 @@ + + + data/citra.svg + + diff --git a/src/citra_qt/data/citra.svg b/src/citra_qt/data/citra.svg new file mode 100644 index 000000000..7b299cd89 --- /dev/null +++ b/src/citra_qt/data/citra.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +