- add steam badge to title screen

- disable and hide exit and fullscreen buttons on some builds
- fix cake backward walk glitch at beginning of level 22
This commit is contained in:
Cocktail Frank 2024-05-09 03:12:21 -04:00
parent f998a2d75e
commit 8e20245733
8 changed files with 103 additions and 34 deletions

View File

@ -99,7 +99,9 @@
"social media click": false,
"highlight saturation": 1.0,
"highlight value": 0.5,
"loot offset": [0.0, 0.1]
"loot offset": [0.0, 0.1],
"steam button visible": false,
"exit enabled": true
},
"coin ui":
@ -151,16 +153,17 @@
"keys":
{
"fps": ["CTRL", "f"],
"skip forward": ["CTRL", "SHIFT", "right"],
"skip backward": ["CTRL", "SHIFT", "left"],
"memory": ["CTRL", "SHIFT", "m"],
"coords": ["CTRL", "SHIFT", "c"],
"up": [["up"], ["w"]],
"right": [["right"], ["d"]],
"down": [["down"], ["s"]],
"left": [["left"], ["a"]],
"pause": "escape",
"log video memory size": ["CTRL", "SHIFT", "m"]
"log video memory size": ["CTRL", "SHIFT", "m"],
"reset": [],
"skip forward": [],
"skip backward": [],
"memory": [],
"coords": []
},
"log":
@ -209,7 +212,8 @@
"flame": ["resource/flame/flame-1.png", "resource/flame/flame-2.png"],
"auto save": "resource/Autosave.png",
"demo message": "resource/Demo_message.png",
"coin missing": "resource/coin_missing.png"
"coin missing": "resource/coin_missing.png",
"steam button": "resource/steam_button.png"
},
"curve":
@ -355,20 +359,23 @@
"fullscreen scale": 0.07,
"fullscreen scale ratio": 0.75,
"fullscreen text text": "FULLSCREEN",
"fullscreen text translation home": [0.0, -0.69],
"fullscreen text translation pause": [0.0, 0.04],
"fullscreen text translation home": [0.0, -0.85],
"fullscreen text translation pause": [0.0, -0.16],
"fullscreen text dimensions": [850.0, 40.0],
"fullscreen text scale": 0.71,
"bgm text on": "BGM ON",
"bgm text off": "BGM OFF",
"bgm translation home": [0.0, -0.77],
"bgm translation pause": [0.0, -0.06],
"bgm translation home": [0.0, -0.69],
"bgm translation pause": [0.0, 0.04],
"sfx text on": "SFX ON",
"sfx text off": "SFX OFF",
"sfx translation home": [0.0, -0.85],
"sfx translation pause": [0.0, -0.16],
"sfx translation home": [0.0, -0.77],
"sfx translation pause": [0.0, -0.06],
"exit text": "EXIT GAME",
"exit translation": [0.0, -0.93]
"exit translation": [0.0, -0.93],
"steam translation": [1.25, -0.85],
"steam scale": 0.4,
"steam ratio": 0.1890831252
},
"world": [

2
lib/sb

@ -1 +1 @@
Subproject commit 0aafdb1ff0f942e0cc484d94611c9ae32f0075c6
Subproject commit bc9cef8674010ccdc60dd2ebd578a70773c9132c

View File

@ -887,7 +887,7 @@
{
"curve": [
[ 20.0, 113.0], [ 0.0, 113.0], [ 83.0, 113.0], [ 83.0, 113.0], [ 83.0, 113.0], [ 151.0, 30.0],
[ 20.0, 113.0], [ 20.0, 113.0], [ 83.0, 113.0], [ 83.0, 113.0], [ 83.0, 113.0], [ 151.0, 30.0],
[ 151.0, 30.0], [ 151.0, 30.0], [ 205.0, 116.0], [ 206.0, 116.0], [ 207.0, 116.0], [ 326.0, 116.0],
[ 326.0, 116.0], [ 326.0, 116.0], [ 381.0, 30.0], [ 381.0, 30.0], [ 381.0, 30.0], [ 440.0, 116.0],
[ 440.0, 116.0], [ 440.0, 116.0], [ 568.0, 116.0], [ 568.0, 116.0], [ 568.0, 116.0], [ 624.0, 30.0],

BIN
resource/steam_button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -476,6 +476,16 @@ void Cakefoot::set_up_buttons()
button.at(name).state(pressed);
}
/* Disable buttons if necessary */
if (!configuration()("display", "fullscreen enabled"))
{
button.at("fullscreen text").enabled(false);
}
if (!configuration()("display", "exit enabled"))
{
button.at("exit").enabled(false);
}
/* Replace start text texture with arcade prompt image if requested in config */
if (configuration()("display", "use arcade prompt"))
{
@ -898,8 +908,13 @@ void Cakefoot::set_up_buttons()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
sb::Plane diskmem_plane;
diskmem_plane.texture(diskmem_texture);
glm::vec3 diskmem_translation = configuration()("display", "social diskmem translation");
if (configuration()("display", "steam button visible"))
{
diskmem_translation.y += 0.23f;
}
button.at("diskmem") = sb::Pad<>{
diskmem_plane, configuration()("display", "social diskmem translation"), configuration()("display", "social single scale"),
diskmem_plane, diskmem_translation, configuration()("display", "social single scale"),
configuration()("display", "social single ratio")};
button.at("diskmem").on_state_change([&](bool state){
#if defined(EMSCRIPTEN) && !defined(__COOLMATH__)
@ -919,8 +934,13 @@ void Cakefoot::set_up_buttons()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
sb::Plane azuria_sky_plane;
azuria_sky_plane.texture(azuria_sky_texture);
glm::vec3 azuria_sky_translation = configuration()("display", "social azuria sky translation");
if (configuration()("display", "steam button visible"))
{
azuria_sky_translation.y += 0.23f;
}
button.at("azuria sky") = sb::Pad<>{
azuria_sky_plane, configuration()("display", "social azuria sky translation"), configuration()("display", "social single scale"),
azuria_sky_plane, azuria_sky_translation, configuration()("display", "social single scale"),
configuration()("display", "social single ratio")};
button.at("azuria sky").on_state_change([&](bool state){
#if defined(EMSCRIPTEN) && !defined(__COOLMATH__)
@ -934,6 +954,16 @@ void Cakefoot::set_up_buttons()
}, configuration()("display", "social azuria sky url").get<std::string>().c_str());
#endif
});
/* Set up steam button */
sb::Texture steam_texture {configuration()("texture", "steam button").get<std::string>()};
steam_texture.filter(GL_LINEAR);
steam_texture.load();
sb::Plane steam_plane;
steam_plane.texture(steam_texture);
button.at("steam") = sb::Pad<>{
steam_plane, configuration()("button", "steam translation"), configuration()("button", "steam scale"),
configuration()("button", "steam ratio")};
}
void Cakefoot::toggle_challenge()
@ -1083,27 +1113,31 @@ void Cakefoot::set_up_hud()
/* Style the social buttons */
sb::Texture social_texture {configuration()("display", "social texture").get<std::string>()};
social_texture.filter(GL_LINEAR);
social_texture.load();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
social.texture(social_texture);
std::string social_translation;
std::string social_translation_key;
if (configuration()("display", "qr display"))
{
if (configuration()("display", "arcade only"))
{
social_translation = "social arcade translation";
social_translation_key = "social arcade translation";
}
else
{
social_translation = "social qr translation";
social_translation_key = "social qr translation";
}
}
else
{
social_translation = "social web translation";
social_translation_key = "social web translation";
}
social.translate(configuration()("display", social_translation));
glm::vec3 social_translation {configuration()("display", social_translation_key)};
if (configuration()("display", "steam button visible"))
{
social_translation.y += 0.23f;
}
social.translate(social_translation);
social.scale(configuration()("display", "social scale"));
/* Set up auto save icon */
@ -2337,9 +2371,10 @@ void Cakefoot::respond(SDL_Event& event)
/* Check pause menu buttons */
else if (level_index > 0 && !unpaused_timer)
{
for (const std::string& button_name : {"resume", "reset", "fullscreen text", "bgm", "sfx"})
std::vector<std::string> names {"resume", "reset", "bgm", "sfx", "fullscreen text"};
for (const std::string& button_name : names)
{
if (button.at(button_name).collide(mouse_ndc, view, projection))
if (button.at(button_name).enabled() && button.at(button_name).collide(mouse_ndc, view, projection))
{
selected = button_name;
if (event.type == SDL_MOUSEBUTTONDOWN)
@ -2690,12 +2725,12 @@ std::string Cakefoot::nearest_button(
float closest_distance;
for (const auto& [name, pad] : pool)
{
/* Don't search against self */
if (name != subject)
/* Don't search against self or disabled buttons */
if (name != subject && pad.enabled())
{
/* Compare box positions of two buttons */
const sb::Box& box_a {button.at(subject).box()};
const sb::Box& box_b {button.at(name).box()};
const sb::Box& box_b {pad.box()};
/* Check distance based on direction */
if (direction == "up" || direction == "down")
@ -3190,7 +3225,15 @@ void Cakefoot::update(float timestamp)
}
else
{
names = {"challenge decrement", "challenge increment", "fullscreen text", "bgm", "sfx", "exit"};
names = {"challenge decrement", "challenge increment", "bgm", "sfx"};
if (configuration()("display", "fullscreen enabled"))
{
names.push_back("fullscreen text");
}
if (configuration()("display", "exit enabled"))
{
names.push_back("exit");
}
}
/* Draw buttons */
@ -3222,7 +3265,10 @@ void Cakefoot::update(float timestamp)
{
glUniform4fv(uniform.at("color addition"), 1, &rotating_hue.normal()[0]);
}
button.at(name).draw(uniform["mvp"], view, projection, uniform["texture enabled"]);
if (name != "fullscreen text" || configuration()("display", "fullscreen enabled"))
{
button.at(name).draw(uniform["mvp"], view, projection, uniform["texture enabled"]);
}
if (!flash_animation.playing())
{
glUniform4fv(uniform.at("color addition"), 1, &glm::vec4(0)[0]);
@ -3383,6 +3429,10 @@ void Cakefoot::update(float timestamp)
button.at("diskmem").draw(uniform.at("mvp"), view, projection, uniform.at("texture enabled"));
button.at("azuria sky").draw(uniform.at("mvp"), view, projection, uniform.at("texture enabled"));
}
if (configuration()("display", "steam button visible"))
{
button.at("steam").draw(uniform.at("mvp"), view, projection, uniform.at("texture enabled"));
}
}
if (!configuration()("display", "social media click"))
{

View File

@ -244,7 +244,8 @@ private:
{"fullscreen text", sb::Pad<>()},
{"bgm", sb::Pad<>()},
{"sfx", sb::Pad<>()},
{"exit", sb::Pad<>()}
{"exit", sb::Pad<>()},
{"steam", sb::Pad<>()}
};
std::map<std::string, std::shared_ptr<TTF_Font>> fonts {
{"medium", font(configuration()("font", "medium", "path").get<std::string>(), configuration()("font", "medium", "size"))},

View File

@ -7,5 +7,14 @@
"log":
{
"enabled": true
},
"keys":
{
"reset": ["CTRL", "r"],
"skip forward": ["CTRL", "SHIFT", "right"],
"skip backward": ["CTRL", "SHIFT", "left"],
"memory": ["CTRL", "SHIFT", "m"],
"coords": ["CTRL", "SHIFT", "c"]
}
}

View File

@ -6,7 +6,9 @@
"use play button": true,
"scoreboard wrap": 3200,
"social media click": true,
"title": "Cakefoot 🍰😈 | Rage game | Wishlist now on Steam!"
"title": "Cakefoot 🍰😈 | Rage game | Wishlist now on Steam!",
"steam button visible": true,
"exit enabled": false
},
"shader":