diff --git a/readme.txt b/readme.txt index 4b33ffa..3a1e619 100644 --- a/readme.txt +++ b/readme.txt @@ -36,12 +36,14 @@ AccBackward [S] AdjustTargetAcc[Shift] - hold in combination with AccForward/AccBackward to change the target speed that will be held Brake[Tab] - Set the target speed to zero -Fire[LeftMouse] - fires all weapons targeting the ray of the cursor +Fire[LeftMouse] - fires weapons in the first group targeting the ray of the cursor +FireOther[RightMouse] - fires weapons in the second group RollCW[Q] - rolls the ship around the forward axis RollCCW[E] Inventory [I] - opens/closes the inventory SwitchTactical[Space] - once unlocked switches to the tactical targeting mode that allows usage of special weapons +LockTarget[R] - locks on a ship closest to the center of the screen Pause[P] - opens the pause menu MECHANICS ############################## diff --git a/src/gamestates/basicmenustate.hpp b/src/gamestates/basicmenustate.hpp index 100243c..c831f44 100644 --- a/src/gamestates/basicmenustate.hpp +++ b/src/gamestates/basicmenustate.hpp @@ -14,12 +14,18 @@ namespace GameStates { BasicMenuState() : m_grid(ei::Vec3(0.f, 0.f, 30.f), Utils::Color32F(0.f, 1.f, 0.f, 0.5f), 3.5f, 3.5f, 80.f, - Game::GridComponent::TransitionInfo(20000.f, 1.f, &Game::GridComponent::Random)) + Game::GridComponent::TransitionInfo(20000.f, 1.f, &Game::GridComponent::Random)), + m_oldCamera(Control::g_camera) { m_grid.Rotate(ei::Quaternion(ei::normalize(ei::Vec3(1.f, 0.f, 0.f)), ei::PI * 0.5f)); m_grid.Process(0.f); } + ~BasicMenuState() + { + Control::g_camera = m_oldCamera; + } + void Process(float _deltaTime) override { m_grid.ProcessComponent(_deltaTime); @@ -33,6 +39,8 @@ namespace GameStates { void OnActivate() override { using namespace Control; + m_oldCamera = g_camera; + g_camera.SetPosition(ei::Vec3(0.f, 0.f, -25.f)); g_camera.SetRotation(ei::qidentity()); g_camera.FixRotation(g_camera.GetRotation(), g_camera.GetPosition()); @@ -44,5 +52,6 @@ namespace GameStates { } private: Game::Grid m_grid; + Control::Camera m_oldCamera; }; } \ No newline at end of file diff --git a/src/gamestates/huds/settingshud.cpp b/src/gamestates/huds/settingshud.cpp index 214cded..dde08f7 100644 --- a/src/gamestates/huds/settingshud.cpp +++ b/src/gamestates/huds/settingshud.cpp @@ -30,10 +30,18 @@ namespace GameStates { label2.SetDefaultSize(0.6f); // label2.SetPosition(Vec2(-label2.GetRectangle().x, 0.f)); - m_masterVolume = &CreateScreenElement(PixelOffset(0, -20), PixelOffset(140, 50), DefP::TopLeft, Anchor(DefP::BotLeft, m_frameCountTarget)); - TextRender& label3 = CreateScreenElement(Vec2(0.f), Anchor(DefP::MidLeft, m_masterVolume), nullptr, "master volume: ", DefP::MidRight); + m_brightness = &CreateScreenElement(PixelOffset(0, -20), PixelOffset(140, 50), DefP::TopLeft, Anchor(DefP::BotLeft, m_frameCountTarget)); + TextRender& label3 = CreateScreenElement(Vec2(0.f), Anchor(DefP::MidLeft, m_brightness), nullptr, "brightness: ", DefP::MidRight); label3.SetDefaultSize(0.6f); + m_contrast = &CreateScreenElement(PixelOffset(0, -20), PixelOffset(140, 50), DefP::TopLeft, Anchor(DefP::BotLeft, m_brightness)); + TextRender& label4 = CreateScreenElement(Vec2(0.f), Anchor(DefP::MidLeft, m_contrast), nullptr, "contrast: ", DefP::MidRight); + label4.SetDefaultSize(0.6f); + + m_masterVolume = &CreateScreenElement(PixelOffset(0, -20), PixelOffset(140, 50), DefP::TopLeft, Anchor(DefP::BotLeft, m_contrast)); + TextRender& label5 = CreateScreenElement(Vec2(0.f), Anchor(DefP::MidLeft, m_masterVolume), nullptr, "master volume: ", DefP::MidRight); + label5.SetDefaultSize(0.6f); + TextRender& note = CreateScreenElement(Vec2(0.f), Anchor(DefP::TopLeft, m_applyButton), nullptr, "|changes to video settings require a restart", DefP::BotLeft); note.SetDefaultSize(18_px); } diff --git a/src/gamestates/huds/settingshud.hpp b/src/gamestates/huds/settingshud.hpp index 4e8d4f3..117ce5a 100644 --- a/src/gamestates/huds/settingshud.hpp +++ b/src/gamestates/huds/settingshud.hpp @@ -18,6 +18,9 @@ namespace GameStates { Graphic::Button* m_fullScreenButton; Graphic::EditField* m_frameCountTarget; + Graphic::EditField* m_brightness; + Graphic::EditField* m_contrast; + Graphic::EditField* m_masterVolume; friend class SettingsState; diff --git a/src/gamestates/settingsstate.cpp b/src/gamestates/settingsstate.cpp index 1621160..78c218a 100644 --- a/src/gamestates/settingsstate.cpp +++ b/src/gamestates/settingsstate.cpp @@ -2,6 +2,7 @@ #include "control/input.hpp" #include "GLFW/glfw3.h" #include "graphic/core/device.hpp" +#include "graphic/core/uniformbuffer.hpp" #include "control/playercontroller.hpp" #include "game.hpp" #include "gameplay/elements/audiocomponent.hpp" @@ -25,7 +26,7 @@ namespace GameStates { auto& cgraphics = config["Graphics"s]; // load current values and display - std::string s = std::to_string(config["Graphics"s]["TargetFPS"s].Get(144.f)); + std::string s = std::to_string(cgraphics["TargetFPS"s].Get(144.f)); s.resize(5); m_hud.m_frameCountTarget->SetText(s); @@ -33,6 +34,14 @@ namespace GameStates { s.resize(5); m_hud.m_mouseSensitivity->SetText(s); + s = std::to_string(cgraphics["Brightness"s].Get(0.f)); + s.resize(5); + m_hud.m_brightness->SetText(s); + + s = std::to_string(cgraphics["Contrast"s].Get(1.f)); + s.resize(5); + m_hud.m_contrast->SetText(s); + // volume s = std::to_string(Game::AudioSystem::GetVolume()); s.resize(5); @@ -87,6 +96,17 @@ namespace GameStates { f = std::stof(m_hud.m_masterVolume->GetText()); Game::AudioSystem::SetVolume(f); + // brightness params can be updated live + const float brightness = std::stof(m_hud.m_brightness->GetText()); + cgraphics["Brightness"s] = (double)brightness; + + const float contrast = std::stof(m_hud.m_contrast->GetText()); + cgraphics["Contrast"s] = (double)contrast; + + Graphic::UniformBuffer& ubo = Graphic::Resources::GetUBO(Graphic::UniformBuffers::BRIGHTNESS_PARAMS); + ubo["Brightness"] = brightness; + ubo["Contrast"] = contrast; + f = std::stof(m_hud.m_frameCountTarget->GetText()); f = std::clamp(f, 30.f, 10000.f); cgraphics["TargetFPS"s] = (double)std::clamp(f, 30.f, 10000.f);