acron.governor

Pixel budget + frame-time governor: resolution as a spendable resource.

Three mechanisms. The arithmetic is a game’s to configure, not the package’s to decide: every threshold is a constructor argument, and the values that default them are a proven 60 Hz tuning (see Governor) rather than a law — a game with a different frame budget passes its own.

  • pixel_scale() — cap total framebuffer PIXELS, not any ratio. A hi-dpi display doubles every window dimension; capping pixels keeps the same framebuffer cost on every display. The cap scales an offscreen scene buffer down, never the window.

  • Governor — arithmetic over frame times that decides how much of the budget to actually spend: trades resolution for a steady frame rate before the player notices, and gives it back when there is headroom. Deliberately not a Acron task — a suite drives it with a list of frame times and no window at all.

  • force_scene_scale() — where a scale actually lands on a FilterManager: force the scene buffer to a fraction of the window. The manager refits its buffers to the window on every window event, so the forced size must be re-asserted after a resize — call this again with the recomputed scale.

Governor(*[, adaptive, scale, period, ...])

Rolling frame-time governor.

Global Functions

force_scene_scale(manager, win, scale: float, current: tuple[int, int]) → tuple[int, int] | None

Force a FilterManager’s scene buffer to scale of the window.

Returns the new (w, h) when the buffer was re-fitted, None when the size did not change. The buffers must have been created resizeable (render_scene_into does this); the final pass keeps drawing over the whole window — only the buffer the scene goes into moves.

pixel_scale(width: int, height: int, budget_pixels: float, render_scale: float = 1.0, floor: float = 0.25) → float

Framebuffer scale that keeps a pixel budget.

render_scale is the governor’s multiplier on top of it: the budget decides the ceiling, the governor trades below it, and the product is floored so no display can talk the framebuffer down to nothing.