|
RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
|
Caller-owned deterministic property tracks. More...
#include <stddef.h>#include <stdint.h>#include "motion.h"#include "particle.h"#include "layer.h"Data Structures | |
| struct | rmgui_track_key_t |
| A key at time_ms; ease belongs to the segment ending at this key. More... | |
| struct | rmgui_track_spec_t |
| Immutable borrowed recipe. More... | |
| struct | rmgui_track_t |
| Caller-owned slot. More... | |
| struct | rmgui_track_event_t |
| Polled completion, also a particle emission hook. More... | |
| struct | rmgui_tracks_t |
| Caller-owned arrays, disjoint from this pool and borrowed recipes, with byte extents <= SIZE_MAX. More... | |
| struct | rmgui_track_binding_t |
| A host/style trigger maps an id to a borrowed track set. More... | |
| struct | rmgui_track_feel_recipe_t |
| Read-only example authoring data. More... | |
Functions | |
| int | rmgui_tracks_init (rmgui_tracks_t *tracks, rmgui_track_t *slots, size_t capacity, rmgui_track_event_t *events, size_t event_capacity) |
| Returns 0 or -1 (NULL, invalid storage extent); failure changes nothing. | |
| int | rmgui_tracks_play (rmgui_tracks_t *tracks, const rmgui_track_spec_t *specs, size_t count, rmgui_track_group_t group, size_t *handles) |
| Plays a whole group atomically, lowest free slots first. | |
| int | rmgui_tracks_trigger (rmgui_tracks_t *tracks, const rmgui_track_binding_t *bindings, size_t count, uint32_t trigger) |
| Plays the first matching binding; -1 for NULL, missing id or play refusal. | |
| int | rmgui_tracks_step (rmgui_tracks_t *tracks, uint16_t dt_ms) |
| Advances by dt_ms at nonnegative Q16 time_scale. | |
| int32_t | rmgui_tracks_value (const rmgui_tracks_t *tracks, uint32_t channel, int32_t base_q16) |
| Returns a mixed channel starting at base, in chronological play order. | |
| int | rmgui_tracks_retarget (rmgui_tracks_t *tracks, size_t slot, int32_t target_q16, uint32_t duration_ms) |
| Retarget converts a live slot to a spring from its exact current value and velocity; preserves velocity even for interrupted tweens. | |
| int | rmgui_tracks_seek (rmgui_tracks_t *tracks, size_t slot, uint32_t age_ms) |
| Replays a slot from its start at absolute age without emitting events. | |
| int | rmgui_tracks_clear (rmgui_tracks_t *tracks, size_t slot) |
| Clears one occupied slot, freeing capacity. | |
| int | rmgui_tracks_finish (rmgui_tracks_t *tracks) |
| Finish every live slot, including paused and infinite tracks, for reduced motion. | |
| int | rmgui_tracks_stagger (size_t index, size_t count, uint32_t step_ms, rmgui_track_origin_t origin, uint32_t *delay_ms) |
| Computes delay; -1 for NULL, invalid index/origin, or uint32 overflow. | |
| int | rmgui_tracks_layer (const rmgui_tracks_t *tracks, rmgui_layer_transform_t *transform, rmgui_layer_shadow_t *shadow, rmgui_layer_shadow_t *glow, rmgui_color_t *tint) |
| Maps built-in channels onto caller-provided base layer/shadow/glow/tint. | |
| const rmgui_track_feel_recipe_t * | rmgui_tracks_feel_recipe (rmgui_track_feel_t feel) |
| Borrow the static recipe for feel; NULL for an invalid feel. | |
| int | rmgui_tracks_feel (rmgui_track_spec_t *out, rmgui_track_feel_t feel, uint32_t channel, int32_t from_q16, int32_t to_q16, uint32_t duration_ms) |
| Fills one recipe, no playback. | |
| int32_t | rmgui_tracks_number (int32_t value_q16, int32_t *digit_roll_q16) |
| Integer ticker value (floor toward -infinity); digit_roll receives the positive fractional Q16 remainder, usable as a vertical digit offset. | |
Caller-owned deterministic property tracks.
No allocation, clock or callbacks.
Scalar Q16 channels.
Colours use four independent components in [0, ONE]. Rotation and sweep use turns; distances use pixels. User ids start at USER.
Built-in ids; hosts may also use any uint32 id.
| enum rmgui_track_blend_t |
| enum rmgui_track_kind_t |
| enum rmgui_track_group_t |
| enum rmgui_track_origin_t |
| enum rmgui_track_feel_t |
Game-feel recipes are ordinary editable track specs.
Flash/pop use yoyo easing; punch uses a spring kick; the rest use easing/noise.
| int rmgui_tracks_init | ( | rmgui_tracks_t * | tracks, |
| rmgui_track_t * | slots, | ||
| size_t | capacity, | ||
| rmgui_track_event_t * | events, | ||
| size_t | event_capacity ) |
Returns 0 or -1 (NULL, invalid storage extent); failure changes nothing.
Zero capacities are valid with non-NULL storage. Clears slots and events.
| int rmgui_tracks_play | ( | rmgui_tracks_t * | tracks, |
| const rmgui_track_spec_t * | specs, | ||
| size_t | count, | ||
| rmgui_track_group_t | group, | ||
| size_t * | handles ) |
Plays a whole group atomically, lowest free slots first.
Optional disjoint handles receives count slot indexes, valid until clear/unheld completion. -1 on malformed recipes, capacity, timing or uint64 play-order exhaustion; every output is unchanged. Infinite repeats cannot be sequenced.
| int rmgui_tracks_trigger | ( | rmgui_tracks_t * | tracks, |
| const rmgui_track_binding_t * | bindings, | ||
| size_t | count, | ||
| uint32_t | trigger ) |
Plays the first matching binding; -1 for NULL, missing id or play refusal.
| int rmgui_tracks_step | ( | rmgui_tracks_t * | tracks, |
| uint16_t | dt_ms ) |
Advances by dt_ms at nonnegative Q16 time_scale.
Pool pause stops time. Event capacity is preflighted: -1 leaves the entire pool unchanged. Time is saturated at UINT64_MAX. Returns 0 on success.
| int32_t rmgui_tracks_value | ( | const rmgui_tracks_t * | tracks, |
| uint32_t | channel, | ||
| int32_t | base_q16 ) |
Returns a mixed channel starting at base, in chronological play order.
Delayed, non-held completed and cleared tracks do not contribute. NULL returns base. Saturating arithmetic is target-independent.
| int rmgui_tracks_retarget | ( | rmgui_tracks_t * | tracks, |
| size_t | slot, | ||
| int32_t | target_q16, | ||
| uint32_t | duration_ms ) |
Retarget converts a live slot to a spring from its exact current value and velocity; preserves velocity even for interrupted tweens.
Reuses its constants, or stiffness 180/damping 20. Removes repeats/delay/yoyo. -1 on NULL, invalid slot or zero duration; otherwise 0.
| int rmgui_tracks_seek | ( | rmgui_tracks_t * | tracks, |
| size_t | slot, | ||
| uint32_t | age_ms ) |
Replays a slot from its start at absolute age without emitting events.
O(age) for spring; other kinds O(key_count). Retarget sets a new origin. -1 for NULL/invalid slot; otherwise 0.
| int rmgui_tracks_clear | ( | rmgui_tracks_t * | tracks, |
| size_t | slot ) |
Clears one occupied slot, freeing capacity.
-1 on NULL/invalid slot.
| int rmgui_tracks_finish | ( | rmgui_tracks_t * | tracks | ) |
Finish every live slot, including paused and infinite tracks, for reduced motion.
Springs snap exactly to target; shakes snap to zero; other kinds use their final key/endpoint (finite yoyo preserves its final direction; infinite loops use the first cycle's endpoint). Queues one completion per live slot and applies hold as normal. -1 for NULL/invalid pool or insufficient event capacity, leaving all storage unchanged; otherwise 0. Hosts call this after play and when reduced-motion preference changes, instead of stepping.
| int rmgui_tracks_stagger | ( | size_t | index, |
| size_t | count, | ||
| uint32_t | step_ms, | ||
| rmgui_track_origin_t | origin, | ||
| uint32_t * | delay_ms ) |
Computes delay; -1 for NULL, invalid index/origin, or uint32 overflow.
Failure leaves *delay_ms unchanged.
| int rmgui_tracks_layer | ( | const rmgui_tracks_t * | tracks, |
| rmgui_layer_transform_t * | transform, | ||
| rmgui_layer_shadow_t * | shadow, | ||
| rmgui_layer_shadow_t * | glow, | ||
| rmgui_color_t * | tint ) |
Maps built-in channels onto caller-provided base layer/shadow/glow/tint.
Distances round down to pixels, colours/opacity clamp to [0,255]; scales clamp to at least 1/65536 and each corner radius to at least zero. Radius channels apply independently to both shadow and glow, retaining each base. Every pointer is required; -1 for NULL with all outputs unchanged, otherwise 0. Does not paint or allocate.
| const rmgui_track_feel_recipe_t * rmgui_tracks_feel_recipe | ( | rmgui_track_feel_t | feel | ) |
Borrow the static recipe for feel; NULL for an invalid feel.
| int rmgui_tracks_feel | ( | rmgui_track_spec_t * | out, |
| rmgui_track_feel_t | feel, | ||
| uint32_t | channel, | ||
| int32_t | from_q16, | ||
| int32_t | to_q16, | ||
| uint32_t | duration_ms ) |
Fills one recipe, no playback.
from/to use channel Q16 units; for shake to is frequency. Ticker values are Q16 integers (+-32768). -1 on NULL, invalid kind, duration zero, or flash/pop duration < 2, unchanged output. Flash/pop use two cycles of floor(duration_ms / 2) milliseconds.
| int32_t rmgui_tracks_number | ( | int32_t | value_q16, |
| int32_t * | digit_roll_q16 ) |
Integer ticker value (floor toward -infinity); digit_roll receives the positive fractional Q16 remainder, usable as a vertical digit offset.
NULL digit_roll is allowed. No locale or formatting is imposed.