| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Box2D.RecPlayer
Synopsis
- create :: Ptr () -> Int -> Int -> IO (Ptr RecPlayer)
- stepFrame :: Ptr RecPlayer -> IO Bool
- getWorldId :: Ptr RecPlayer -> IO WorldId
- restart :: Ptr RecPlayer -> IO ()
- seekFrame :: Ptr RecPlayer -> Int -> IO ()
- getFrame :: Ptr RecPlayer -> IO Int
- getInfo :: Ptr RecPlayer -> Ptr RecPlayerInfo -> IO ()
- isAtEnd :: Ptr RecPlayer -> IO Bool
- hasDiverged :: Ptr RecPlayer -> IO Bool
- getDivergeFrame :: Ptr RecPlayer -> IO Int
- setKeyframePolicy :: Ptr RecPlayer -> CSize -> Int -> IO ()
- getKeyframeBudget :: Ptr RecPlayer -> IO CSize
- getKeyframeMinInterval :: Ptr RecPlayer -> IO Int
- getKeyframeInterval :: Ptr RecPlayer -> IO Int
- getKeyframeBytes :: Ptr RecPlayer -> IO CSize
- destroy :: Ptr RecPlayer -> IO ()
- drawFrameQueries :: Ptr RecPlayer -> Ptr DebugDraw -> Int -> IO ()
- getFrameQueryCount :: Ptr RecPlayer -> IO Int
- getFrameQuery :: Ptr RecPlayer -> Int -> Ptr RecQueryInfo -> IO ()
- getFrameQueryHit :: Ptr RecPlayer -> Int -> Int -> Ptr RecQueryHit -> IO ()
- getBodyCount :: Ptr RecPlayer -> IO Int
- getBodyId :: Ptr RecPlayer -> Int -> IO BodyId
Documentation
Arguments
| :: Ptr () |
|
| -> Int |
|
| -> Int |
|
| -> IO (Ptr RecPlayer) |
Open a recording for incremental playback and replay up to the first step. The player copies the bytes, so you may free or destroy the source buffer immediately after this call.
Returns: A player handle, or NULL if the recording is malformed
Binds b2RecPlayer_Create.
stepFrame :: Ptr RecPlayer -> IO Bool Source #
Advance the replay by one recorded step.
Returns: true if a step executed, false once the end of the recording is reached
Binds b2RecPlayer_StepFrame.
getWorldId :: Ptr RecPlayer -> IO WorldId Source #
Get the id of the replayed world.
Binds b2RecPlayer_GetWorldId.
restart :: Ptr RecPlayer -> IO () Source #
Rewind the player to the first step, recreating the replay world from the file.
Binds b2RecPlayer_Restart.
Seek to a recorded step. Seeking backward rewinds and re-runs from the start, so the cost grows with the target frame. Clamps to the recording bounds.
Binds b2RecPlayer_SeekFrame.
getFrame :: Ptr RecPlayer -> IO Int Source #
Get the number of steps replayed so far.
Binds b2RecPlayer_GetFrame.
Arguments
| :: Ptr RecPlayer | |
| -> Ptr RecPlayerInfo | Result buffer. |
| -> IO () |
Get static metadata for the recording (frame count, recorded tuning, time).
Binds b2RecPlayer_GetInfo.
isAtEnd :: Ptr RecPlayer -> IO Bool Source #
Returns true once the end of the recording has been reached.
Binds b2RecPlayer_IsAtEnd.
hasDiverged :: Ptr RecPlayer -> IO Bool Source #
Returns true if a recorded state hash failed to reproduce, meaning replay diverged.
Binds b2RecPlayer_HasDiverged.
getDivergeFrame :: Ptr RecPlayer -> IO Int Source #
Get the first step at which replay diverged, or -1 if it has not diverged.
Binds b2RecPlayer_GetDivergeFrame.
Arguments
| :: Ptr RecPlayer |
|
| -> CSize |
|
| -> Int |
|
| -> IO () |
Tune the keyframe ring used to speed up backward seeking. A keyframe is a periodic snapshot the player restores from instead of replaying from the start, trading memory for seek speed.
Binds b2RecPlayer_SetKeyframePolicy.
getKeyframeBudget :: Ptr RecPlayer -> IO CSize Source #
Get the keyframe memory budget in bytes.
Binds b2RecPlayer_GetKeyframeBudget.
getKeyframeMinInterval :: Ptr RecPlayer -> IO Int Source #
Get the finest keyframe spacing in frames.
Binds b2RecPlayer_GetKeyframeMinInterval.
getKeyframeInterval :: Ptr RecPlayer -> IO Int Source #
Get the current keyframe spacing in frames. Starts at the min interval and doubles as the ring evicts to stay under budget, so it reflects the effective backward-seek granularity right now.
Binds b2RecPlayer_GetKeyframeInterval.
getKeyframeBytes :: Ptr RecPlayer -> IO CSize Source #
Get the memory currently held by keyframe snapshots, in bytes.
Binds b2RecPlayer_GetKeyframeBytes.
destroy :: Ptr RecPlayer -> IO () Source #
Close a player and free its replay world and file buffer.
Binds b2RecPlayer_Destroy.
Arguments
| :: Ptr RecPlayer |
|
| -> Ptr DebugDraw |
|
| -> Int |
|
| -> IO () |
Draw spatial queries recorded during the most recently replayed frame. Call after b2World_Draw so queries are layered on top of the world.
Binds b2RecPlayer_DrawFrameQueries.
getFrameQueryCount :: Ptr RecPlayer -> IO Int Source #
Get the number of spatial queries recorded for the most recently replayed frame.
Binds b2RecPlayer_GetFrameQueryCount.
Get a recorded query from the most recently replayed frame by index.
Binds b2RecPlayer_GetFrameQuery.
Get one result of a recorded query from the most recently replayed frame.
Binds b2RecPlayer_GetFrameQueryHit.