2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-07-01 05:33:29 +00:00

Add Experimental Features / Variable DT option

This commit is contained in:
Luke Street 2020-04-14 14:45:07 -04:00
parent 0ce0ea712e
commit 7eb0e89e3e
2 changed files with 27 additions and 1 deletions

View File

@ -11,6 +11,7 @@ LaunchMenu::LaunchMenu(hecl::CVarCommons& commons, QWidget* parent)
, m_apiMenu(tr("Graphics API"), this) , m_apiMenu(tr("Graphics API"), this)
, m_msaaMenu(tr("Anti-Aliasing"), this) , m_msaaMenu(tr("Anti-Aliasing"), this)
, m_anisoMenu(tr("Anisotropic Filtering"), this) , m_anisoMenu(tr("Anisotropic Filtering"), this)
, m_experimentalMenu(tr("Experimental Features"), this)
, m_apiGroup(this) , m_apiGroup(this)
, m_msaaGroup(this) , m_msaaGroup(this)
, m_anisoGroup(this) { , m_anisoGroup(this) {
@ -39,9 +40,11 @@ LaunchMenu::LaunchMenu(hecl::CVarCommons& commons, QWidget* parent)
m_apiMenu.addActions(m_apiGroup.actions()); m_apiMenu.addActions(m_apiGroup.actions());
m_msaaMenu.addActions(m_msaaGroup.actions()); m_msaaMenu.addActions(m_msaaGroup.actions());
m_anisoMenu.addActions(m_anisoGroup.actions()); m_anisoMenu.addActions(m_anisoGroup.actions());
initExperimental();
addMenu(&m_apiMenu)->setToolTip(QString::fromUtf8(m_commons.m_graphicsApi->rawHelp().data())); addMenu(&m_apiMenu)->setToolTip(QString::fromUtf8(m_commons.m_graphicsApi->rawHelp().data()));
addMenu(&m_msaaMenu)->setToolTip(QString::fromUtf8(m_commons.m_drawSamples->rawHelp().data())); addMenu(&m_msaaMenu)->setToolTip(QString::fromUtf8(m_commons.m_drawSamples->rawHelp().data()));
addMenu(&m_anisoMenu)->setToolTip(QString::fromUtf8(m_commons.m_texAnisotropy->rawHelp().data())); addMenu(&m_anisoMenu)->setToolTip(QString::fromUtf8(m_commons.m_texAnisotropy->rawHelp().data()));
addMenu(&m_experimentalMenu)->setToolTip(QString::fromUtf8(hecl::com_variableDt->rawHelp().data()));
const QAction* argumentEditor = addAction(tr("Edit Runtime Arguments")); const QAction* argumentEditor = addAction(tr("Edit Runtime Arguments"));
connect(argumentEditor, &QAction::triggered, this, &LaunchMenu::editRuntimeArgs); connect(argumentEditor, &QAction::triggered, this, &LaunchMenu::editRuntimeArgs);
initDeepColor(); initDeepColor();
@ -99,6 +102,14 @@ void LaunchMenu::initCheats() {
connect(m_enableCheats, &QAction::triggered, this, &LaunchMenu::cheatsTriggered); connect(m_enableCheats, &QAction::triggered, this, &LaunchMenu::cheatsTriggered);
} }
void LaunchMenu::initExperimental() {
m_variableDt = m_experimentalMenu.addAction(tr("Variable delta time"));
m_variableDt->setToolTip(QString::fromUtf8(hecl::com_variableDt->rawHelp().data()));
m_variableDt->setCheckable(true);
m_variableDt->setChecked(hecl::com_variableDt->toBoolean());
connect(m_variableDt, &QAction::triggered, this, &LaunchMenu::variableDtTriggered);
}
void LaunchMenu::apiTriggered() { void LaunchMenu::apiTriggered() {
QString apiStr = qobject_cast<QAction*>(sender())->text(); QString apiStr = qobject_cast<QAction*>(sender())->text();
apiStr = apiStr.remove(QLatin1Char{'&'}); apiStr = apiStr.remove(QLatin1Char{'&'});
@ -143,6 +154,17 @@ void LaunchMenu::cheatsTriggered() {
m_commons.serialize(); m_commons.serialize();
} }
void LaunchMenu::variableDtTriggered() {
const bool isChecked = qobject_cast<QAction*>(sender())->isChecked();
if (!hecl::com_variableDt->toBoolean() && isChecked) {
m_variableDt->setChecked(false);
}
hecl::CVarManager::instance()->setVariableDtEnabled(isChecked, true);
m_commons.serialize();
}
void LaunchMenu::editRuntimeArgs() { void LaunchMenu::editRuntimeArgs() {
ArgumentEditor editor(this); ArgumentEditor editor(this);
editor.exec(); editor.exec();

View File

@ -4,7 +4,7 @@
namespace hecl { namespace hecl {
struct CVarCommons; struct CVarCommons;
} } // namespace hecl
class QAction; class QAction;
@ -15,6 +15,7 @@ class LaunchMenu : public QMenu {
QMenu m_apiMenu; QMenu m_apiMenu;
QMenu m_msaaMenu; QMenu m_msaaMenu;
QMenu m_anisoMenu; QMenu m_anisoMenu;
QMenu m_experimentalMenu;
QActionGroup m_apiGroup; QActionGroup m_apiGroup;
QActionGroup m_msaaGroup; QActionGroup m_msaaGroup;
@ -22,6 +23,7 @@ class LaunchMenu : public QMenu {
QAction* m_developerMode = nullptr; QAction* m_developerMode = nullptr;
QAction* m_enableCheats = nullptr; QAction* m_enableCheats = nullptr;
QAction* m_variableDt = nullptr;
void initApiAction(const QString& action); void initApiAction(const QString& action);
void initMsaaAction(const QString& action); void initMsaaAction(const QString& action);
@ -29,6 +31,7 @@ class LaunchMenu : public QMenu {
void initDeepColor(); void initDeepColor();
void initDeveloperMode(); void initDeveloperMode();
void initCheats(); void initCheats();
void initExperimental();
public: public:
explicit LaunchMenu(hecl::CVarCommons& commons, QWidget* parent = Q_NULLPTR); explicit LaunchMenu(hecl::CVarCommons& commons, QWidget* parent = Q_NULLPTR);
@ -41,5 +44,6 @@ public slots:
void deepColorTriggered(); void deepColorTriggered();
void developerModeTriggered(); void developerModeTriggered();
void cheatsTriggered(); void cheatsTriggered();
void variableDtTriggered();
void editRuntimeArgs(); void editRuntimeArgs();
}; };