Skip to main content

Crate sim_logic

Crate sim_logic 

Source
Expand description

A code-first application and logic layer for Sim;Engine.

Sim;Logic owns the ordinary application loop around an ECS world: staged systems, bounded structural spawn/insert/remove/despawn commands, typed input, fixed-step time, application-owned resources, World replacement, application-requested exit, and extraction into Sim;Engine scenes.

§Where to start

Use prelude for application setup, then app::Application to register World factories and Systems. headless::HeadlessRunner advances the same runtime without a window or GPU. See the usage guides for a complete headless program and desktop examples.

§Optional features

  • desktop (default): window hosting and the Sim;Engine GPU bridge.
  • fonts: CPU font loading, shaping and rasterization through Engine.
  • headless-text: managed CPU text preparation, including fonts.
  • text: retained GPU text, including headless-text but not window hosting.
  • audio: single-source device output through Rodio.
  • easter-eggs: the bundled Ferris image helper.

Disable default features for the core headless runtime. Systems execute sequentially; only one World is active. Domain models, gameplay, layout and collision response remain application code, not renderer state.

Re-exports§

pub use easter_eggs::CrabDrawError;
pub use easter_eggs::draw_crab;
pub use bevy_ecs;

Modules§

app
Application configuration and immutable registry construction.
assets
Immutable CPU assets owned by an application across World replacement.
audio
Optional application-owned output for one streaming mono PCM source.
collision
Basic collision shapes and live overlap queries.
commands
Bounded managed structural, World-transition, and application-control commands.
desktop
One-window desktop adapter for the shared Sim;Logic frame driver.
easter_eggs
Optional Ferris mascot; ordinary managed images do all the actual drawing.
events
Count-bounded typed events visible only within one System-stage invocation.
fonts
Engine’s CPU-only font loading, shaping and reusable layout primitives. Enable fonts without default features to use these without a GPU or window.
headless
Renderer-independent application runner and its public frame diagnostics.
identity
Opaque runtime identities.
input
Typed, platform-independent keyboard and pointer input.
motion
Opt-in fixed-step motion components and systems.
prelude
Commonly used Sim;Logic and ECS types.
query
Generation-checked component queries for managed Systems.
render
Renderer-independent limits for visual extraction and presentation.
resources
Application-owned typed state that survives World replacement.
screen
Managed presentation geometry in logical screen pixels.
system
Sequential, per-World System construction and execution.
text
Optional single-line screen labels using Sim;Engine’s font implementation.
three_d
Opt-in, bounded cuboids and host-built surface meshes.
time
Validated frame and fixed-step timekeeping.
transition
No-payload World replacement helpers and deterministic arbitration.
ui
Explicit, headless interaction helpers for application-owned UI.
visual
Standard visual components for the first Sim;Logic slice.
window
Optional window commands, independent of windowing and rendering crates.
world
Isolated managed World construction.

Structs§

ExtractedFrame
Complete renderer-independent visual snapshot for one World generation.
Layer
Draw layer used to order scene commands.
ResolvedCircle
One fully resolved circle retained for headless parity and diagnostics.
ResolvedLine
One fully resolved anchored line retained for headless parity and diagnostics.
ResolvedRectangle
One fully resolved rectangle retained for headless parity and diagnostics.
ResolvedScreenImage
One immutable screen-image description in a published CPU snapshot.
ResolvedScreenRectangle
One screen-fixed rectangle retained for headless inspection.
ResolvedScreenText
One prepared screen label retained by a complete CPU snapshot.
SceneBudget
Explicit upper bounds for engine-owned ordinary-scene work.
ScreenExtractionUpdates
CPU screen extraction work, not tessellation, upload or GPU timing.
Stroke
Stroke color and width for lines and shape outlines.
StrokeDashPattern2d
Fixed-size, allocation-free dash pattern in source path-coordinate units.
StrokeMarker2d
Reusable arrow marker definition for a line endpoint.
StrokeStyle2d
Complete bounded styling for open 2D lines and polylines.

Enums§

ComponentApprovalError
A component or bundle cannot enter the frozen managed component set.
ExtractionError
Structured reason why a new CPU visual snapshot was not published.
LifecycleHook
A Bevy lifecycle hook excluded from managed first-slice components.
ResolvedScreenPrimitive
One sampled screen primitive. Images and labels remain separate retained sources.
SceneBudgetResource
Work category constrained by a SceneBudget.
SceneError
Reason a command or temporary scene state was rejected.
ScreenDraw
One ordered screen source, after all world content.
StrokeCap2d
Presentation used at an open line or dash endpoint.
StrokeJoin2d
Presentation used where two visible polyline segments meet.
StrokeMarkerAnchor2d
Placement of a logical-pixel arrow relative to its mathematical path endpoint.
StrokeStyleError
Invalid bounded line-style configuration.
StrokeWidthMode2d
Coordinate space used by a line or polyline stroke width.

Traits§

ComponentTuple
A flat tuple of component types approved together before application start.

Type Aliases§

LogicResult
Convenience result for application code and fallible Systems that combine unrelated owned error types with ?.