Added desktop and no-sound modes.
When -desktop is given on the command line then the settings menu is shown on the desktop instead of an vr overlay. When -nosound is given on the command line then there are no sound effects.
This commit is contained in:
@@ -64,7 +64,7 @@ ComboBox {
|
|||||||
|
|
||||||
onActivated: {
|
onActivated: {
|
||||||
if (activeFocus) {
|
if (activeFocus) {
|
||||||
MyResources.activationSound.play()
|
MyResources.playActivationSound()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Button {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (activationSoundEnabled) {
|
if (activationSoundEnabled) {
|
||||||
MyResources.activationSound.play()
|
MyResources.playActivationSound()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ Button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
MyResources.activationSound.play()
|
MyResources.playActivationSound()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,19 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtMultimedia 5.6
|
import QtMultimedia 5.6
|
||||||
|
import matzman666.advsettings 1.0
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
function playActivationSound() {
|
||||||
|
if (!OverlayController.soundDisabled()) {
|
||||||
|
activationSound.play()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function playFocusChangedSound() {
|
||||||
|
if (!OverlayController.soundDisabled()) {
|
||||||
|
focusChangedSound.play()
|
||||||
|
}
|
||||||
|
}
|
||||||
property SoundEffect activationSound: SoundEffect {
|
property SoundEffect activationSound: SoundEffect {
|
||||||
source: vrRuntimePath + "tools/content/panorama/sounds/activation.wav"
|
source: vrRuntimePath + "tools/content/panorama/sounds/activation.wav"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ Slider {
|
|||||||
|
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
if (activeFocus) {
|
if (activeFocus) {
|
||||||
MyResources.activationSound.play()
|
MyResources.playActivationSound()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
MyResources.focusChangedSound.play()
|
MyResources.playFocusChangedSound()
|
||||||
stackView.pop()
|
stackView.pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,6 @@ CheckBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
MyResources.activationSound.play()
|
MyResources.playActivationSound()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ MyStackViewPage {
|
|||||||
text: "SteamVR"
|
text: "SteamVR"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
MyResources.focusChangedSound.play()
|
MyResources.playFocusChangedSound()
|
||||||
mainView.push(steamVRPage)
|
mainView.push(steamVRPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ MyStackViewPage {
|
|||||||
text: "Chaperone"
|
text: "Chaperone"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
MyResources.focusChangedSound.play()
|
MyResources.playFocusChangedSound()
|
||||||
mainView.push(chaperonePage)
|
mainView.push(chaperonePage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ MyStackViewPage {
|
|||||||
text: "Play Space"
|
text: "Play Space"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
MyResources.focusChangedSound.play()
|
MyResources.playFocusChangedSound()
|
||||||
mainView.push(playspacePage)
|
mainView.push(playspacePage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ MyStackViewPage {
|
|||||||
text: "Floor Fix"
|
text: "Floor Fix"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
MyResources.focusChangedSound.play()
|
MyResources.playFocusChangedSound()
|
||||||
mainView.push(fixFloorPage)
|
mainView.push(fixFloorPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ MyStackViewPage {
|
|||||||
text: "Audio"
|
text: "Audio"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
MyResources.focusChangedSound.play()
|
MyResources.playFocusChangedSound()
|
||||||
mainView.push(audioPage)
|
mainView.push(audioPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ MyStackViewPage {
|
|||||||
text: "Statistics"
|
text: "Statistics"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
MyResources.focusChangedSound.play()
|
MyResources.playFocusChangedSound()
|
||||||
mainView.push(statisticsPage)
|
mainView.push(statisticsPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ MyStackViewPage {
|
|||||||
text: "Settings"
|
text: "Settings"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
MyResources.focusChangedSound.play()
|
MyResources.playFocusChangedSound()
|
||||||
mainView.push(settingsPage)
|
mainView.push(settingsPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-22
@@ -44,6 +44,7 @@ void myQtMessageHandler(QtMsgType type, const QMessageLogContext &context, const
|
|||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// Configure logger
|
// Configure logger
|
||||||
START_EASYLOGGINGPP(argc, argv);
|
START_EASYLOGGINGPP(argc, argv);
|
||||||
el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
|
el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
|
||||||
@@ -55,6 +56,19 @@ int main(int argc, char *argv[]) {
|
|||||||
conf.parseFromText(logConfigDefault);
|
conf.parseFromText(logConfigDefault);
|
||||||
el::Loggers::reconfigureAllLoggers(conf);
|
el::Loggers::reconfigureAllLoggers(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool desktopMode = false;
|
||||||
|
bool noSound = false;
|
||||||
|
|
||||||
|
// Parse command line arguments
|
||||||
|
for (int i = 1; i < argc; i++) {
|
||||||
|
if (std::string(argv[i]).compare("-desktop") == 0) {
|
||||||
|
LOG(INFO) << "Desktop mode enabled.";
|
||||||
|
desktopMode = true;
|
||||||
|
} else if (std::string(argv[i]).compare("-nosound") == 0) {
|
||||||
|
noSound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LOG(INFO) << "Starting Application.";
|
LOG(INFO) << "Starting Application.";
|
||||||
try {
|
try {
|
||||||
@@ -67,7 +81,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
QQmlEngine qmlEngine;
|
QQmlEngine qmlEngine;
|
||||||
|
|
||||||
advsettings::OverlayController* controller = advsettings::OverlayController::getInstance();
|
advsettings::OverlayController* controller = advsettings::OverlayController::createInstance(desktopMode, noSound);
|
||||||
controller->Init(&qmlEngine);
|
controller->Init(&qmlEngine);
|
||||||
|
|
||||||
QQmlComponent component(&qmlEngine, QUrl::fromLocalFile("res/qml/mainwidget.qml"));
|
QQmlComponent component(&qmlEngine, QUrl::fromLocalFile("res/qml/mainwidget.qml"));
|
||||||
@@ -78,31 +92,33 @@ int main(int argc, char *argv[]) {
|
|||||||
auto quickObj = component.create();
|
auto quickObj = component.create();
|
||||||
controller->SetWidget(qobject_cast<QQuickItem*>(quickObj), advsettings::OverlayController::applicationName, advsettings::OverlayController::applicationKey);
|
controller->SetWidget(qobject_cast<QQuickItem*>(quickObj), advsettings::OverlayController::applicationName, advsettings::OverlayController::applicationKey);
|
||||||
|
|
||||||
std::string manifestPath = QApplication::applicationDirPath().toStdString() + "\\advancedsettings.vrmanifest";
|
if (!desktopMode) {
|
||||||
if (QFile::exists(QString::fromStdString(manifestPath))) {
|
std::string manifestPath = QApplication::applicationDirPath().toStdString() + "\\advancedsettings.vrmanifest";
|
||||||
bool firstTime = false;
|
if (QFile::exists(QString::fromStdString(manifestPath))) {
|
||||||
if (!vr::VRApplications()->IsApplicationInstalled(advsettings::OverlayController::applicationKey)) {
|
bool firstTime = false;
|
||||||
firstTime;
|
if (!vr::VRApplications()->IsApplicationInstalled(advsettings::OverlayController::applicationKey)) {
|
||||||
}
|
firstTime;
|
||||||
auto apperror = vr::VRApplications()->AddApplicationManifest(manifestPath.c_str());
|
|
||||||
if (apperror != vr::VRApplicationError_None) {
|
|
||||||
LOG(ERROR) << "Could not add application manifest: " << vr::VRApplications()->GetApplicationsErrorNameFromEnum(apperror);
|
|
||||||
} else if (firstTime) {
|
|
||||||
auto apperror = vr::VRApplications()->SetApplicationAutoLaunch(advsettings::OverlayController::applicationKey, true);
|
|
||||||
if (apperror != vr::VRApplicationError_None) {
|
|
||||||
LOG(ERROR) << "Could not set auto start: " << vr::VRApplications()->GetApplicationsErrorNameFromEnum(apperror);
|
|
||||||
}
|
}
|
||||||
|
auto apperror = vr::VRApplications()->AddApplicationManifest(manifestPath.c_str());
|
||||||
|
if (apperror != vr::VRApplicationError_None) {
|
||||||
|
LOG(ERROR) << "Could not add application manifest: " << vr::VRApplications()->GetApplicationsErrorNameFromEnum(apperror);
|
||||||
|
} else if (firstTime) {
|
||||||
|
auto apperror = vr::VRApplications()->SetApplicationAutoLaunch(advsettings::OverlayController::applicationKey, true);
|
||||||
|
if (apperror != vr::VRApplicationError_None) {
|
||||||
|
LOG(ERROR) << "Could not set auto start: " << vr::VRApplications()->GetApplicationsErrorNameFromEnum(apperror);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Could not find application manifest: " << manifestPath;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
LOG(ERROR) << "Could not find application manifest: " << manifestPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_DESKTOP_WINDOW
|
if (desktopMode) {
|
||||||
auto m_pWindow = new QQuickWindow();
|
auto m_pWindow = new QQuickWindow();
|
||||||
qobject_cast<QQuickItem*>(quickObj)->setParentItem(m_pWindow->contentItem());
|
qobject_cast<QQuickItem*>(quickObj)->setParentItem(m_pWindow->contentItem());
|
||||||
m_pWindow->setGeometry(0, 0, qobject_cast<QQuickItem*>(quickObj)->width(), qobject_cast<QQuickItem*>(quickObj)->height());
|
m_pWindow->setGeometry(0, 0, qobject_cast<QQuickItem*>(quickObj)->width(), qobject_cast<QQuickItem*>(quickObj)->height());
|
||||||
m_pWindow->show();
|
m_pWindow->show();
|
||||||
#endif
|
}
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|
||||||
|
|||||||
+64
-60
@@ -130,21 +130,51 @@ void OverlayController::Init(QQmlEngine* qmlEngine) {
|
|||||||
|
|
||||||
|
|
||||||
void OverlayController::SetWidget(QQuickItem* quickItem, const std::string& name, const std::string& key) {
|
void OverlayController::SetWidget(QQuickItem* quickItem, const std::string& name, const std::string& key) {
|
||||||
vr::VROverlayError overlayError = vr::VROverlay()->CreateDashboardOverlay(key.c_str(), name.c_str(), &m_ulOverlayHandle, &m_ulOverlayThumbnailHandle);
|
if (!desktopMode) {
|
||||||
if (overlayError != vr::VROverlayError_None) {
|
vr::VROverlayError overlayError = vr::VROverlay()->CreateDashboardOverlay(key.c_str(), name.c_str(), &m_ulOverlayHandle, &m_ulOverlayThumbnailHandle);
|
||||||
if (overlayError == vr::VROverlayError_KeyInUse) {
|
if (overlayError != vr::VROverlayError_None) {
|
||||||
QMessageBox::critical(nullptr, "OpenVR Advanced Settings Overlay", "Another instance is already running.");
|
if (overlayError == vr::VROverlayError_KeyInUse) {
|
||||||
|
QMessageBox::critical(nullptr, "OpenVR Advanced Settings Overlay", "Another instance is already running.");
|
||||||
|
}
|
||||||
|
throw std::runtime_error(std::string("Failed to create Overlay: " + std::string(vr::VROverlay()->GetOverlayErrorNameFromEnum(overlayError))));
|
||||||
}
|
}
|
||||||
throw std::runtime_error(std::string("Failed to create Overlay: " + std::string(vr::VROverlay()->GetOverlayErrorNameFromEnum(overlayError))));
|
vr::VROverlay()->SetOverlayWidthInMeters(m_ulOverlayHandle, 2.5f);
|
||||||
}
|
vr::VROverlay()->SetOverlayInputMethod(m_ulOverlayHandle, vr::VROverlayInputMethod_Mouse);
|
||||||
vr::VROverlay()->SetOverlayWidthInMeters(m_ulOverlayHandle, 2.5f);
|
vr::VROverlay()->SetOverlayFlag(m_ulOverlayHandle, vr::VROverlayFlags_SendVRScrollEvents, true);
|
||||||
vr::VROverlay()->SetOverlayInputMethod(m_ulOverlayHandle, vr::VROverlayInputMethod_Mouse);
|
std::string thumbIconPath = QApplication::applicationDirPath().toStdString() + "\\res\\thumbicon.png";
|
||||||
vr::VROverlay()->SetOverlayFlag(m_ulOverlayHandle, vr::VROverlayFlags_SendVRScrollEvents, true);
|
if (QFile::exists(QString::fromStdString(thumbIconPath))) {
|
||||||
std::string thumbIconPath = QApplication::applicationDirPath().toStdString() + "\\res\\thumbicon.png";
|
vr::VROverlay()->SetOverlayFromFile(m_ulOverlayThumbnailHandle, thumbIconPath.c_str());
|
||||||
if (QFile::exists(QString::fromStdString(thumbIconPath))) {
|
} else {
|
||||||
vr::VROverlay()->SetOverlayFromFile(m_ulOverlayThumbnailHandle, thumbIconPath.c_str());
|
LOG(ERROR) << "Could not find thumbnail icon \"" << thumbIconPath << "\"";
|
||||||
} else {
|
}
|
||||||
LOG(ERROR) << "Could not find thumbnail icon \"" << thumbIconPath << "\"";
|
|
||||||
|
// Too many render calls in too short time overwhelm Qt and an assertion gets thrown.
|
||||||
|
// Therefore we use an timer to delay render calls
|
||||||
|
m_pRenderTimer.reset(new QTimer());
|
||||||
|
m_pRenderTimer->setSingleShot(true);
|
||||||
|
m_pRenderTimer->setInterval(5);
|
||||||
|
connect(m_pRenderTimer.get(), SIGNAL(timeout()), this, SLOT(renderOverlay()));
|
||||||
|
|
||||||
|
QOpenGLFramebufferObjectFormat fboFormat;
|
||||||
|
fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
|
||||||
|
fboFormat.setTextureTarget(GL_TEXTURE_2D);
|
||||||
|
m_pFbo.reset(new QOpenGLFramebufferObject(quickItem->width(), quickItem->height(), fboFormat));
|
||||||
|
|
||||||
|
m_pRenderControl.reset(new QQuickRenderControl());
|
||||||
|
m_pWindow.reset(new QQuickWindow(m_pRenderControl.get()));
|
||||||
|
m_pWindow->setRenderTarget(m_pFbo.get());
|
||||||
|
quickItem->setParentItem(m_pWindow->contentItem());
|
||||||
|
m_pWindow->setGeometry(0, 0, quickItem->width(), quickItem->height());
|
||||||
|
m_pRenderControl->initialize(m_pOpenGLContext.get());
|
||||||
|
|
||||||
|
vr::HmdVector2_t vecWindowSize = {
|
||||||
|
(float)quickItem->width(),
|
||||||
|
(float)quickItem->height()
|
||||||
|
};
|
||||||
|
vr::VROverlay()->SetOverlayMouseScale(m_ulOverlayHandle, &vecWindowSize);
|
||||||
|
|
||||||
|
connect(m_pRenderControl.get(), SIGNAL(renderRequested()), this, SLOT(OnRenderRequest()));
|
||||||
|
connect(m_pRenderControl.get(), SIGNAL(sceneChanged()), this, SLOT(OnRenderRequest()));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pPumpEventsTimer.reset(new QTimer());
|
m_pPumpEventsTimer.reset(new QTimer());
|
||||||
@@ -152,36 +182,6 @@ void OverlayController::SetWidget(QQuickItem* quickItem, const std::string& name
|
|||||||
m_pPumpEventsTimer->setInterval(20);
|
m_pPumpEventsTimer->setInterval(20);
|
||||||
m_pPumpEventsTimer->start();
|
m_pPumpEventsTimer->start();
|
||||||
|
|
||||||
// Too many render calls in too short time overwhelm Qt and an assertion gets thrown.
|
|
||||||
// Therefore we use an timer to delay render calls
|
|
||||||
m_pRenderTimer.reset(new QTimer());
|
|
||||||
m_pRenderTimer->setSingleShot(true);
|
|
||||||
m_pRenderTimer->setInterval(5);
|
|
||||||
connect(m_pRenderTimer.get(), SIGNAL(timeout()), this, SLOT(renderOverlay()));
|
|
||||||
|
|
||||||
QOpenGLFramebufferObjectFormat fboFormat;
|
|
||||||
fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
|
|
||||||
fboFormat.setTextureTarget(GL_TEXTURE_2D);
|
|
||||||
m_pFbo.reset(new QOpenGLFramebufferObject(quickItem->width(), quickItem->height(), fboFormat));
|
|
||||||
|
|
||||||
#ifndef DEBUG_DESKTOP_WINDOW
|
|
||||||
m_pRenderControl.reset(new QQuickRenderControl());
|
|
||||||
m_pWindow.reset(new QQuickWindow(m_pRenderControl.get()));
|
|
||||||
m_pWindow->setRenderTarget(m_pFbo.get());
|
|
||||||
quickItem->setParentItem(m_pWindow->contentItem());
|
|
||||||
m_pWindow->setGeometry(0, 0, quickItem->width(), quickItem->height());
|
|
||||||
m_pRenderControl->initialize(m_pOpenGLContext.get());
|
|
||||||
|
|
||||||
vr::HmdVector2_t vecWindowSize = {
|
|
||||||
(float)quickItem->width(),
|
|
||||||
(float)quickItem->height()
|
|
||||||
};
|
|
||||||
vr::VROverlay()->SetOverlayMouseScale(m_ulOverlayHandle, &vecWindowSize);
|
|
||||||
|
|
||||||
connect(m_pRenderControl.get(), SIGNAL(renderRequested()), this, SLOT(OnRenderRequest()));
|
|
||||||
connect(m_pRenderControl.get(), SIGNAL(sceneChanged()), this, SLOT(OnRenderRequest()));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
steamVRTabController.initStage2(this, m_pWindow.get());
|
steamVRTabController.initStage2(this, m_pWindow.get());
|
||||||
chaperoneTabController.initStage2(this, m_pWindow.get());
|
chaperoneTabController.initStage2(this, m_pWindow.get());
|
||||||
moveCenterTabController.initStage2(this, m_pWindow.get());
|
moveCenterTabController.initStage2(this, m_pWindow.get());
|
||||||
@@ -199,27 +199,26 @@ void OverlayController::OnRenderRequest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OverlayController::renderOverlay() {
|
void OverlayController::renderOverlay() {
|
||||||
// skip rendering if the overlay isn't visible
|
if (!desktopMode) {
|
||||||
if (!vr::VROverlay() || !vr::VROverlay()->IsOverlayVisible(m_ulOverlayHandle) && !vr::VROverlay()->IsOverlayVisible(m_ulOverlayThumbnailHandle))
|
// skip rendering if the overlay isn't visible
|
||||||
return;
|
if (!vr::VROverlay() || !vr::VROverlay()->IsOverlayVisible(m_ulOverlayHandle) && !vr::VROverlay()->IsOverlayVisible(m_ulOverlayThumbnailHandle))
|
||||||
|
return;
|
||||||
|
m_pRenderControl->polishItems();
|
||||||
|
m_pRenderControl->sync();
|
||||||
|
m_pRenderControl->render();
|
||||||
|
|
||||||
#ifndef DEBUG_DESKTOP_WINDOW
|
GLuint unTexture = m_pFbo->texture();
|
||||||
m_pRenderControl->polishItems();
|
if (unTexture != 0) {
|
||||||
m_pRenderControl->sync();
|
|
||||||
m_pRenderControl->render();
|
|
||||||
|
|
||||||
GLuint unTexture = m_pFbo->texture();
|
|
||||||
if (unTexture != 0) {
|
|
||||||
#if defined _WIN64 || defined _LP64
|
#if defined _WIN64 || defined _LP64
|
||||||
// To avoid any compiler warning because of cast to a larger pointer type (warning C4312 on VC)
|
// To avoid any compiler warning because of cast to a larger pointer type (warning C4312 on VC)
|
||||||
vr::Texture_t texture = { (void*)((uint64_t)unTexture), vr::API_OpenGL, vr::ColorSpace_Auto };
|
vr::Texture_t texture = { (void*)((uint64_t)unTexture), vr::API_OpenGL, vr::ColorSpace_Auto };
|
||||||
#else
|
#else
|
||||||
vr::Texture_t texture = { (void*)unTexture, vr::API_OpenGL, vr::ColorSpace_Auto };
|
vr::Texture_t texture = { (void*)unTexture, vr::API_OpenGL, vr::ColorSpace_Auto };
|
||||||
#endif
|
#endif
|
||||||
vr::VROverlay()->SetOverlayTexture(m_ulOverlayHandle, &texture);
|
vr::VROverlay()->SetOverlayTexture(m_ulOverlayHandle, &texture);
|
||||||
|
}
|
||||||
|
m_pOpenGLContext->functions()->glFlush(); // We need to flush otherwise the texture may be empty.*/
|
||||||
}
|
}
|
||||||
m_pOpenGLContext->functions()->glFlush(); // We need to flush otherwise the texture may be empty.*/
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -472,6 +471,11 @@ QUrl OverlayController::getVRRuntimePathUrl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool OverlayController::soundDisabled() {
|
||||||
|
return noSound;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void OverlayController::showKeyboard(QString existingText, unsigned long userValue) {
|
void OverlayController::showKeyboard(QString existingText, unsigned long userValue) {
|
||||||
vr::VROverlay()->ShowKeyboardForOverlay(m_ulOverlayHandle, vr::k_EGamepadTextInputModeNormal, vr::k_EGamepadTextInputLineModeSingleLine, "Advanced Settings Overlay", 1024, existingText.toStdString().c_str(), false, userValue);
|
vr::VROverlay()->ShowKeyboardForOverlay(m_ulOverlayHandle, vr::k_EGamepadTextInputModeNormal, vr::k_EGamepadTextInputLineModeSingleLine, "Advanced Settings Overlay", 1024, existingText.toStdString().c_str(), false, userValue);
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-7
@@ -31,9 +31,6 @@
|
|||||||
#include "tabcontrollers/SettingsTabController.h"
|
#include "tabcontrollers/SettingsTabController.h"
|
||||||
|
|
||||||
|
|
||||||
// Show a window on the desktop instead of an overlay in vr
|
|
||||||
//#define DEBUG_DESKTOP_WINDOW
|
|
||||||
|
|
||||||
|
|
||||||
// application namespace
|
// application namespace
|
||||||
namespace advsettings {
|
namespace advsettings {
|
||||||
@@ -63,6 +60,9 @@ private:
|
|||||||
QPoint m_ptLastMouse;
|
QPoint m_ptLastMouse;
|
||||||
Qt::MouseButtons m_lastMouseButtons = 0;
|
Qt::MouseButtons m_lastMouseButtons = 0;
|
||||||
|
|
||||||
|
bool desktopMode;
|
||||||
|
bool noSound;
|
||||||
|
|
||||||
QUrl m_runtimePathUrl;
|
QUrl m_runtimePathUrl;
|
||||||
|
|
||||||
SteamVRTabController steamVRTabController;
|
SteamVRTabController steamVRTabController;
|
||||||
@@ -74,7 +74,7 @@ private:
|
|||||||
SettingsTabController settingsTabController;
|
SettingsTabController settingsTabController;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OverlayController() : QObject() {}
|
OverlayController(bool desktopMode, bool noSound) : QObject(), desktopMode(desktopMode), noSound(noSound) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~OverlayController();
|
virtual ~OverlayController();
|
||||||
@@ -95,6 +95,8 @@ public:
|
|||||||
Q_INVOKABLE QString getVersionString();
|
Q_INVOKABLE QString getVersionString();
|
||||||
Q_INVOKABLE QUrl getVRRuntimePathUrl();
|
Q_INVOKABLE QUrl getVRRuntimePathUrl();
|
||||||
|
|
||||||
|
Q_INVOKABLE bool soundDisabled();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void renderOverlay();
|
void renderOverlay();
|
||||||
void OnRenderRequest();
|
void OnRenderRequest();
|
||||||
@@ -111,9 +113,11 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static OverlayController* getInstance() {
|
static OverlayController* getInstance() {
|
||||||
if (!singleton) {
|
return singleton.get();
|
||||||
singleton.reset(new advsettings::OverlayController());
|
}
|
||||||
}
|
|
||||||
|
static OverlayController* createInstance(bool desktopMode, bool noSound) {
|
||||||
|
singleton.reset(new advsettings::OverlayController(desktopMode, noSound));
|
||||||
return singleton.get();
|
return singleton.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user