Base+Snake: Capitalize snake skin names
In Snake, the menu for choosing a skin looked messy due to inconsistent capitalization. Two skins names were entirely lowercase. For the sprite-based skins, the menu takes the name of each skin's directory, so I have capitalized these. Capitalizing the original snake skin required more change than simply renaming a directory.
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
Before Width: | Height: | Size: 157 B After Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 152 B After Width: | Height: | Size: 152 B |
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 164 B |
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 153 B After Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 149 B |
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 123 B |
Before Width: | Height: | Size: 141 B After Width: | Height: | Size: 141 B |
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 120 B After Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 129 B |
|
@ -68,7 +68,7 @@ ErrorOr<NonnullRefPtr<Game>> Game::try_create()
|
||||||
}
|
}
|
||||||
|
|
||||||
auto color = Color::from_argb(Config::read_u32("Snake"sv, "Snake"sv, "BaseColor"sv, Color(Color::Green).value()));
|
auto color = Color::from_argb(Config::read_u32("Snake"sv, "Snake"sv, "BaseColor"sv, Color(Color::Green).value()));
|
||||||
auto skin_name = Config::read_string("Snake"sv, "Snake"sv, "SnakeSkin"sv, "classic"sv);
|
auto skin_name = Config::read_string("Snake"sv, "Snake"sv, "SnakeSkin"sv, "Classic"sv);
|
||||||
auto skin = TRY(SnakeSkin::create(skin_name, color));
|
auto skin = TRY(SnakeSkin::create(skin_name, color));
|
||||||
|
|
||||||
return adopt_nonnull_ref_or_enomem(new (nothrow) Game(move(food_bitmaps), color, skin_name, move(skin)));
|
return adopt_nonnull_ref_or_enomem(new (nothrow) Game(move(food_bitmaps), color, skin_name, move(skin)));
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Snake {
|
||||||
|
|
||||||
ErrorOr<NonnullOwnPtr<SnakeSkin>> SnakeSkin::create(StringView skin_name, Color color)
|
ErrorOr<NonnullOwnPtr<SnakeSkin>> SnakeSkin::create(StringView skin_name, Color color)
|
||||||
{
|
{
|
||||||
if (skin_name == "classic"sv)
|
if (skin_name == "Classic"sv)
|
||||||
return try_make<ClassicSkin>(color);
|
return try_make<ClassicSkin>(color);
|
||||||
|
|
||||||
// Try to find an image-based skin matching the name.
|
// Try to find an image-based skin matching the name.
|
||||||
|
|
|
@ -59,7 +59,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
game.set_focus(true);
|
game.set_focus(true);
|
||||||
|
|
||||||
auto high_score = Config::read_u32("Snake"sv, "Snake"sv, "HighScore"sv, 0);
|
auto high_score = Config::read_u32("Snake"sv, "Snake"sv, "HighScore"sv, 0);
|
||||||
auto snake_skin_name = Config::read_string("Snake"sv, "Snake"sv, "SnakeSkin"sv, "classic"sv);
|
auto snake_skin_name = Config::read_string("Snake"sv, "Snake"sv, "SnakeSkin"sv, "Classic"sv);
|
||||||
|
|
||||||
auto& statusbar = *widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar"sv);
|
auto& statusbar = *widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar"sv);
|
||||||
statusbar.set_text(0, "Score: 0"sv);
|
statusbar.set_text(0, "Score: 0"sv);
|
||||||
|
@ -110,7 +110,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
if (!was_paused)
|
if (!was_paused)
|
||||||
game.start();
|
game.start();
|
||||||
});
|
});
|
||||||
change_snake_color->set_enabled(snake_skin_name == "classic"sv);
|
change_snake_color->set_enabled(snake_skin_name == "Classic"sv);
|
||||||
TRY(game_menu->try_add_action(change_snake_color));
|
TRY(game_menu->try_add_action(change_snake_color));
|
||||||
|
|
||||||
GUI::ActionGroup skin_action_group;
|
GUI::ActionGroup skin_action_group;
|
||||||
|
@ -137,7 +137,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
TRY(add_skin_action(entry.name, false));
|
TRY(add_skin_action(entry.name, false));
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
}));
|
}));
|
||||||
TRY(add_skin_action("classic"sv, true));
|
TRY(add_skin_action("Classic"sv, true));
|
||||||
|
|
||||||
TRY(game_menu->try_add_separator());
|
TRY(game_menu->try_add_separator());
|
||||||
TRY(game_menu->try_add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
TRY(game_menu->try_add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
||||||
|
|