diff --git a/data/gui/debug_slider.stkgui b/data/gui/debug_slider.stkgui new file mode 100644 index 000000000..c4d25a954 --- /dev/null +++ b/data/gui/debug_slider.stkgui @@ -0,0 +1,6 @@ + +
+
+
diff --git a/src/guiengine/modaldialog.cpp b/src/guiengine/modaldialog.cpp index 462eda295..56ab935ed 100644 --- a/src/guiengine/modaldialog.cpp +++ b/src/guiengine/modaldialog.cpp @@ -52,6 +52,7 @@ ModalDialog::ModalDialog(const float percentWidth, const float percentHeight, { m_dialog_location = location; m_init = false; + m_fade_background = true; m_percent_width = percentWidth; m_percent_height = percentHeight; m_irrlicht_window = NULL; diff --git a/src/guiengine/modaldialog.hpp b/src/guiengine/modaldialog.hpp index e5e81e4b1..4ffddfbb7 100644 --- a/src/guiengine/modaldialog.hpp +++ b/src/guiengine/modaldialog.hpp @@ -61,10 +61,10 @@ namespace GUIEngine float m_percent_width, m_percent_height; bool m_init; - protected: irr::gui::IGUIWindow* m_irrlicht_window; irr::core::rect< irr::s32 > m_area; + bool m_fade_background; InputManager::InputDriverMode m_previous_mode; @@ -136,6 +136,8 @@ namespace GUIEngine */ virtual int getHeight() { return m_area.getHeight(); } + bool fadeBackground() const { return m_fade_background; } + bool isMyIrrChild(irr::gui::IGUIElement* widget) const { return m_irrlicht_window->isMyChild(widget); } }; diff --git a/src/guiengine/skin.cpp b/src/guiengine/skin.cpp index fd28f3af0..e0d015a90 100644 --- a/src/guiengine/skin.cpp +++ b/src/guiengine/skin.cpp @@ -2177,7 +2177,8 @@ core::recti Skin::draw3DWindowBackground(IGUIElement *element, { if (ModalDialog::getCurrent() == NULL) return rect; - drawBGFadeColor(); + if (ModalDialog::getCurrent()->fadeBackground()) + drawBGFadeColor(); // draw frame if (m_dialog_size < 1.0f) diff --git a/src/states_screens/dialogs/debug_slider.cpp b/src/states_screens/dialogs/debug_slider.cpp new file mode 100644 index 000000000..4c5b02c57 --- /dev/null +++ b/src/states_screens/dialogs/debug_slider.cpp @@ -0,0 +1,86 @@ +// SuperTuxKart - a fun racing game with go-kart +// Copyright (C) 2010-2013 Marianne Gagnon +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 3 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "states_screens/dialogs/debug_slider.hpp" + +#include "guiengine/engine.hpp" +#include "guiengine/screen.hpp" +#include "guiengine/widgets/button_widget.hpp" +#include "guiengine/widgets/label_widget.hpp" +#include "guiengine/widgets/spinner_widget.hpp" +#include "karts/abstract_kart.hpp" +#include "modes/world.hpp" +#include "states_screens/state_manager.hpp" +#include "utils/translation.hpp" + +using namespace GUIEngine; + +// ------------------------------------------------------------------------------------------------------ + +DebugSliderDialog::DebugSliderDialog(std::string id, irr::core::stringw msg) : + ModalDialog(0.85f, 0.25f, MODAL_DIALOG_LOCATION_BOTTOM) +{ + //if (StateManager::get()->getGameState() == GUIEngine::GAME) + //{ + // World::getWorld()->schedulePause(World::IN_GAME_MENU_PHASE); + //} + + m_id = id; + m_fade_background = false; + + loadFromFile("debug_slider.stkgui"); + + + LabelWidget* message = getWidget("title"); + message->setText( msg.c_str(), false ); +} + +// ------------------------------------------------------------------------------------------------------ + +DebugSliderDialog::~DebugSliderDialog() +{ + //if (StateManager::get()->getGameState() == GUIEngine::GAME) + //{ + // World::getWorld()->scheduleUnpause(); + //} +} + +// ------------------------------------------------------------------------------------------------------ + +void DebugSliderDialog::onEnterPressedInternal() +{ +} + +// ------------------------------------------------------------------------------------------------------ + +GUIEngine::EventPropagation DebugSliderDialog::processEvent(const std::string& eventSource) +{ + if (eventSource == "value_slider") + { + int value = getWidget("value_slider")->getValue(); + Log::info("DebugSlider", "Value for <%s> : %i", m_id.c_str(), value); + return GUIEngine::EVENT_BLOCK; + } + + return GUIEngine::EVENT_LET; +} + +// ------------------------------------------------------------------------------------------------------ + +void DebugSliderDialog::onUpdate(float dt) +{ +} diff --git a/src/states_screens/dialogs/debug_slider.hpp b/src/states_screens/dialogs/debug_slider.hpp new file mode 100644 index 000000000..8efa03858 --- /dev/null +++ b/src/states_screens/dialogs/debug_slider.hpp @@ -0,0 +1,51 @@ +// SuperTuxKart - a fun racing game with go-kart +// Copyright (C) 2010-2013 Marianne Gagnon +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 3 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef HEADER_DEBUG_SLIDER_DIALOG_HPP +#define HEADER_DEBUG_SLIDER_DIALOG_HPP + +#include "guiengine/modaldialog.hpp" +#include "utils/cpp2011.h" +#include "utils/leak_check.hpp" + +/** + * \brief For internal value tweaking + * \ingroup states_screens + */ +class DebugSliderDialog : public GUIEngine::ModalDialog +{ +private: + + std::string m_id; + +public: + + + DebugSliderDialog(std::string id, ::core::stringw msg); + + ~DebugSliderDialog(); + + virtual void onEnterPressedInternal() OVERRIDE; + virtual void onUpdate(float dt) OVERRIDE; + + + GUIEngine::EventPropagation processEvent(const std::string& eventSource); +}; + + +#endif diff --git a/src/utils/debug.cpp b/src/utils/debug.cpp index 574aebfba..533d036a2 100644 --- a/src/utils/debug.cpp +++ b/src/utils/debug.cpp @@ -29,6 +29,7 @@ #include "race/history.hpp" #include "main_loop.hpp" #include "replay/replay_recorder.hpp" +#include "states_screens/dialogs/debug_slider.hpp" #include "utils/log.hpp" #include "utils/profiler.hpp" #include @@ -77,7 +78,9 @@ enum DebugMenuCommand DEBUG_ATTACHMENT_BOMB, DEBUG_ATTACHMENT_ANVIL, DEBUG_TOGGLE_GUI, - DEBUG_THROTTLE_FPS + DEBUG_THROTTLE_FPS, + DEBUG_TWEAK_SHADER_EXPOSURE, + DEBUG_TWEAK_SHADER_LWHITE }; // ----------------------------------------------------------------------------- @@ -178,6 +181,11 @@ bool onEvent(const SEvent &event) sub->addItem(L"Anvil", DEBUG_ATTACHMENT_ANVIL); sub->addItem(L"Parachute", DEBUG_ATTACHMENT_PARACHUTE); + mnu->addItem(L"Adjust shaders >", -1, true, true); + sub = mnu->getSubMenu(3); + sub->addItem(L"Exposure", DEBUG_TWEAK_SHADER_EXPOSURE); + sub->addItem(L"LWhite", DEBUG_TWEAK_SHADER_LWHITE); + mnu->addItem(L"Profiler",DEBUG_PROFILER); if (UserConfigParams::m_profiler_enabled) mnu->addItem(L"Toggle capture profiler report", DEBUG_PROFILER_GENERATE_REPORT); @@ -369,15 +377,15 @@ bool onEvent(const SEvent &event) } else if (cmdID == DEBUG_ATTACHMENT_ANVIL) { - addAttachment(Attachment::ATTACH_ANVIL); + addAttachment(Attachment::ATTACH_ANVIL); } else if (cmdID == DEBUG_ATTACHMENT_BOMB) { - addAttachment(Attachment::ATTACH_BOMB); + addAttachment(Attachment::ATTACH_BOMB); } else if (cmdID == DEBUG_ATTACHMENT_PARACHUTE) { - addAttachment(Attachment::ATTACH_PARACHUTE); + addAttachment(Attachment::ATTACH_PARACHUTE); } else if (cmdID == DEBUG_TOGGLE_GUI) { @@ -394,6 +402,14 @@ bool onEvent(const SEvent &event) kart->getNode()->setVisible(gui->m_enabled); } } + else if (cmdID == DEBUG_TWEAK_SHADER_EXPOSURE) + { + new DebugSliderDialog("exposure", "Exposure"); + } + else if (cmdID == DEBUG_TWEAK_SHADER_LWHITE) + { + new DebugSliderDialog("lwhite", "LWhite"); + } } return false; // event has been handled