feat: add custom background rendering and speed scaling features for snake gameplay

This commit is contained in:
phillip committed 2026-10-03 20:58:33 +02:00
1 parent 93c0a44027
commit 60bf111400
13 files changed
+711 -26

No files matched your search

+11
View File
@@ -1,4 +1,5 @@
#include "game_render.h"
#include "game_logic.h"
#include <array>
#include <cstdint>
@@ -188,6 +189,13 @@ void draw_stats(const GameState &state, RenderAssets &assets, bool internals,
iprintf("\x1b[4;0Hx=%i\ny=%i", state.snake.front()[0],
state.snake.front()[1]);
}
const uint16_t freq_mhz = calculate_timer_freq_mhz(state);
const uint8_t intensity = calculate_intensity_31(state);
iprintf("\x1b[6;0HApples: %i ", state.applesEaten);
iprintf("\x1b[7;0HSpeed: %u.%01u Hz (%u%%) ",
static_cast<unsigned int>(freq_mhz / 1000U),
static_cast<unsigned int>((freq_mhz % 1000U) / 100U),
static_cast<unsigned int>((static_cast<uint32_t>(intensity) * 100U) / 31U));
}
HudCache &cache = assets.hudCache;
@@ -255,6 +263,9 @@ void draw_menu(const GameState &state, RenderAssets &assets,
consoleSelect(assets.bottomScreen);
consoleClear();
iprintf("\x1b[10;5H* SNAKE WITH A TWIST *");
iprintf("\x1b[12;8Hby Phillip Kuehne");
iprintf("\x1b[18;4HPress START or A to begin");
consoleSelect(assets.topScreen);
consoleClear();