stars directions

This commit is contained in:
2025-12-01 21:01:53 +01:00
parent 383b2e48ec
commit 294e935344
3 changed files with 151 additions and 5 deletions

View File

@ -25,6 +25,20 @@ struct SpaceWarpSettings {
float maxTrailLength = 36.0f; // clamp length of each streak in pixels
};
struct SpaceWarpFlightMotion {
float forwardScale = 1.0f; // multiplier applied to each star's forward velocity (negative = backwards)
float lateralSpeed = 0.0f; // normalized horizontal drift speed (left/right)
float verticalSpeed = 0.0f; // normalized vertical drift speed (up/down)
};
enum class SpaceWarpFlightMode {
Forward = 0,
BankLeft,
BankRight,
Reverse,
Custom
};
class SpaceWarp {
public:
SpaceWarp();
@ -34,6 +48,12 @@ public:
void draw(SDL_Renderer* renderer, float alphaScale = 1.0f);
void setSettings(const SpaceWarpSettings& newSettings);
const SpaceWarpSettings& getSettings() const { return settings; }
void setFlightMode(SpaceWarpFlightMode mode);
SpaceWarpFlightMode getFlightMode() const { return flightMode; }
void setFlightMotion(const SpaceWarpFlightMotion& motion); // overrides mode with Custom
const SpaceWarpFlightMotion& getFlightMotion() const { return motion; }
void setAutoPilotEnabled(bool enabled);
bool isAutoPilotEnabled() const { return autoPilotEnabled; }
private:
struct WarpStar {
@ -63,7 +83,16 @@ private:
float warpFactor = 520.0f;
SpaceWarpSettings settings{};
SpaceWarpFlightMotion motion{};
SpaceWarpFlightMode flightMode = SpaceWarpFlightMode::Forward;
bool autoPilotEnabled = false;
float autoTimer = 0.0f;
float autoMinInterval = 3.5f;
float autoMaxInterval = 7.5f;
SpaceWarpFlightMotion motionTarget{};
float minDepth = 2.0f;
float maxDepth = 320.0f;
void scheduleNewAutoTarget();
};