Fixed menu

This commit is contained in:
2025-12-06 18:18:27 +01:00
parent 12110bd8b4
commit 8a549d14dc
3 changed files with 44 additions and 16 deletions

View File

@ -77,13 +77,28 @@ void SpaceWarp::setAutoPilotEnabled(bool enabled) {
}
void SpaceWarp::scheduleNewAutoTarget() {
motionTarget.forwardScale = randomRange(0.82f, 1.28f);
if (randomRange(0.0f, 1.0f) < 0.12f) {
motionTarget.forwardScale = -randomRange(0.35f, 0.85f);
// Autopilot behavior:
// - 90% of the time: gentle forward flight with small lateral/vertical drift
// - 10% of the time: short lateral "bank" burst (stronger lateral speed) for a while
float choice = randomRange(0.0f, 1.0f);
if (choice < 0.90f) {
// Normal forward flight
motionTarget.forwardScale = randomRange(0.95f, 1.12f);
motionTarget.lateralSpeed = randomRange(-0.18f, 0.18f);
motionTarget.verticalSpeed = randomRange(-0.12f, 0.12f);
// Longer interval between aggressive maneuvers
autoTimer = randomRange(autoMinInterval, autoMaxInterval);
} else {
// Occasional lateral bank burst
motionTarget.forwardScale = randomRange(0.90f, 1.10f);
// Pick left or right burst
float dir = (randomRange(0.0f, 1.0f) < 0.5f) ? -1.0f : 1.0f;
motionTarget.lateralSpeed = dir * randomRange(0.70f, 1.35f);
// Allow modest vertical bias during a bank
motionTarget.verticalSpeed = randomRange(-0.35f, 0.35f);
// Shorter duration for the burst so it feels like a brief maneuver
autoTimer = randomRange(1.0f, 3.0f);
}
motionTarget.lateralSpeed = randomRange(-1.35f, 1.35f);
motionTarget.verticalSpeed = randomRange(-0.75f, 0.75f);
autoTimer = randomRange(autoMinInterval, autoMaxInterval);
}
void SpaceWarp::spawnComet() {

View File

@ -108,7 +108,11 @@ void UIRenderer::drawButton(SDL_Renderer* renderer, FontAtlas* font, float cx, f
font->measure(label, textScale, textW, textH);
float tx = x + (w - static_cast<float>(textW)) * 0.5f;
// Adjust vertical position for better alignment with background buttons
float ty = y + (h - static_cast<float>(textH)) * 0.5f + 2.0f;
// Vertically center text precisely within the button
// Vertically center text precisely within the button, then nudge down slightly
// to improve optical balance relative to icons and button art.
const float textNudge = 3.0f; // tweak this value to move labels up/down
float ty = y + (h - static_cast<float>(textH)) * 0.5f + textNudge;
// Choose text color based on selection state
SDL_Color textColor = {255, 255, 255, 255}; // Default white