Add debug sliders for vlj
This commit is contained in:
parent
b939d06be5
commit
2e53328847
6
data/gui/debug_slider.stkgui
Normal file
6
data/gui/debug_slider.stkgui
Normal file
@ -0,0 +1,6 @@
|
||||
<stkgui>
|
||||
<div x="2%" y="10%" width="96%" height="80%" layout="vertical-row" >
|
||||
<label id="title" width="100%"/>
|
||||
<gauge id="value_slider" min_value="0" max_value="100" width="100%" />
|
||||
</div>
|
||||
</stkgui>
|
@ -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;
|
||||
|
@ -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); }
|
||||
};
|
||||
|
||||
|
@ -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)
|
||||
|
86
src/states_screens/dialogs/debug_slider.cpp
Normal file
86
src/states_screens/dialogs/debug_slider.cpp
Normal file
@ -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<LabelWidget>("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<SpinnerWidget>("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)
|
||||
{
|
||||
}
|
51
src/states_screens/dialogs/debug_slider.hpp
Normal file
51
src/states_screens/dialogs/debug_slider.hpp
Normal file
@ -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
|
@ -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 <IGUIEnvironment.h>
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user