mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:08:12 +00:00
Snake: Update snake skin color interactively while picking
The snake now changes color while interacting with `GUI::ColorPicker`
This commit is contained in:
parent
0388bb019f
commit
d1f6540196
2 changed files with 6 additions and 4 deletions
|
@ -108,11 +108,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto was_paused = game.is_paused();
|
||||
if (!was_paused)
|
||||
game.pause();
|
||||
auto dialog = GUI::ColorPicker::construct(Gfx::Color::White, window);
|
||||
if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
auto dialog = GUI::ColorPicker::construct(game.get_skin_color(), window);
|
||||
dialog->on_color_changed = [&game](Gfx::Color color) {
|
||||
game.set_skin_color(color);
|
||||
};
|
||||
if (dialog->exec() == GUI::Dialog::ExecResult::OK)
|
||||
Config::write_u32("Snake"sv, "Snake"sv, "BaseColor"sv, dialog->color().value());
|
||||
game.set_skin_color(dialog->color());
|
||||
}
|
||||
if (!was_paused)
|
||||
game.start();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue