Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627package sim
// Fixed is the authoritative numeric type for sim-space positions. Keeping this// distinct from raw integers makes accidental mixing of pixels, ticks, and fixed// simulation units a compile-time error instead of a replay bug.Fixed :: distinct i32
// Vec2_Fixed stores replay-relevant positions and deltas. It is deliberately// integer-only; rendering can convert to floats later at the sim/render boundary.Vec2_Fixed :: struct { x: Fixed, y: Fixed,}
// Vec2_Q is reserved for quantized command vectors such as aim/controller input.// It keeps persistent commands compact and canonical without storing floats.Vec2_Q :: struct { x: i16, y: i16,}
// Convert whole simulation units into the fixed-point representation. This is a// shift because FIXED_ONE is a power of two, avoiding multiplication/division.fixed_from_whole :: proc(value: i32) -> Fixed { return Fixed(value << FIXED_SHIFT)}