1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:37:35 +00:00

Solitaire: Add key combo to dump the state of the layout

Useful for chasing down bugs.
This commit is contained in:
Timothy Flynn 2021-05-15 22:13:11 -04:00 committed by Andreas Kling
parent ce030ca584
commit ddb278ab85
5 changed files with 85 additions and 1 deletions

View file

@ -5,6 +5,7 @@
*/
#include "Game.h"
#include <AK/Debug.h>
#include <LibGUI/Painter.h>
#include <LibGfx/Palette.h>
#include <time.h>
@ -139,6 +140,8 @@ void Game::keydown_event(GUI::KeyEvent& event)
if (event.shift() && (event.key() == KeyCode::Key_F12))
start_game_over_animation();
else if (event.shift() && (event.key() == KeyCode::Key_F11))
dump_layout();
}
void Game::mousedown_event(GUI::MouseEvent& event)
@ -466,4 +469,13 @@ void Game::paint_event(GUI::PaintEvent& event)
}
}
void Game::dump_layout() const
{
if constexpr (SOLITAIRE_DEBUG) {
dbgln("------------------------------");
for (const auto& stack : m_stacks)
dbgln("{}", stack);
}
}
}