mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
Add shadows toggle and F4 hotkey
This commit is contained in:
parent
528f645350
commit
79e4bfd6c3
2 changed files with 14 additions and 0 deletions
|
|
@ -60,6 +60,7 @@ private:
|
||||||
bool pendingFullscreen = false;
|
bool pendingFullscreen = false;
|
||||||
bool pendingVsync = false;
|
bool pendingVsync = false;
|
||||||
int pendingResIndex = 0;
|
int pendingResIndex = 0;
|
||||||
|
bool pendingShadows = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render player info window
|
* Render player info window
|
||||||
|
|
|
||||||
|
|
@ -385,6 +385,13 @@ void GameScreen::processTargetInput(game::GameHandler& gameHandler) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (input.isKeyJustPressed(SDL_SCANCODE_F4)) {
|
||||||
|
auto* renderer = core::Application::getInstance().getRenderer();
|
||||||
|
if (renderer) {
|
||||||
|
renderer->setShadowsEnabled(!renderer->areShadowsEnabled());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slash key: focus chat input
|
// Slash key: focus chat input
|
||||||
|
|
@ -1780,6 +1787,7 @@ void GameScreen::renderSettingsWindow() {
|
||||||
if (!showSettingsWindow) return;
|
if (!showSettingsWindow) return;
|
||||||
|
|
||||||
auto* window = core::Application::getInstance().getWindow();
|
auto* window = core::Application::getInstance().getWindow();
|
||||||
|
auto* renderer = core::Application::getInstance().getRenderer();
|
||||||
if (!window) return;
|
if (!window) return;
|
||||||
|
|
||||||
static const int kResolutions[][2] = {
|
static const int kResolutions[][2] = {
|
||||||
|
|
@ -1794,6 +1802,7 @@ void GameScreen::renderSettingsWindow() {
|
||||||
if (!settingsInit) {
|
if (!settingsInit) {
|
||||||
pendingFullscreen = window->isFullscreen();
|
pendingFullscreen = window->isFullscreen();
|
||||||
pendingVsync = window->isVsyncEnabled();
|
pendingVsync = window->isVsyncEnabled();
|
||||||
|
pendingShadows = renderer ? renderer->areShadowsEnabled() : true;
|
||||||
pendingResIndex = 0;
|
pendingResIndex = 0;
|
||||||
int curW = window->getWidth();
|
int curW = window->getWidth();
|
||||||
int curH = window->getHeight();
|
int curH = window->getHeight();
|
||||||
|
|
@ -1824,6 +1833,7 @@ void GameScreen::renderSettingsWindow() {
|
||||||
ImGui::Text("Video");
|
ImGui::Text("Video");
|
||||||
ImGui::Checkbox("Fullscreen", &pendingFullscreen);
|
ImGui::Checkbox("Fullscreen", &pendingFullscreen);
|
||||||
ImGui::Checkbox("VSync", &pendingVsync);
|
ImGui::Checkbox("VSync", &pendingVsync);
|
||||||
|
ImGui::Checkbox("Shadows", &pendingShadows);
|
||||||
|
|
||||||
const char* resLabel = "Resolution";
|
const char* resLabel = "Resolution";
|
||||||
const char* resItems[kResCount];
|
const char* resItems[kResCount];
|
||||||
|
|
@ -1839,6 +1849,9 @@ void GameScreen::renderSettingsWindow() {
|
||||||
window->setVsync(pendingVsync);
|
window->setVsync(pendingVsync);
|
||||||
window->setFullscreen(pendingFullscreen);
|
window->setFullscreen(pendingFullscreen);
|
||||||
window->applyResolution(kResolutions[pendingResIndex][0], kResolutions[pendingResIndex][1]);
|
window->applyResolution(kResolutions[pendingResIndex][0], kResolutions[pendingResIndex][1]);
|
||||||
|
if (renderer) {
|
||||||
|
renderer->setShadowsEnabled(pendingShadows);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ImGui::Button("Close", ImVec2(-1, 0))) {
|
if (ImGui::Button("Close", ImVec2(-1, 0))) {
|
||||||
showSettingsWindow = false;
|
showSettingsWindow = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue