Skip to main content

Crate noesis_bevy

Crate noesis_bevy 

Source
Expand description

Bevy plugin for the Noesis GUI SDK.

Drives libNoesis.so through the noesis_runtime FFI crate and implements Noesis::RenderDevice on top of Bevy’s wgpu device. UIs render into an offscreen wgpu texture and composite into the Bevy frame.

Add NoesisPlugin to initialize the runtime, then host XAML through a NoesisView camera.

Re-exports§

pub use animation::AnimationSpec;
pub use animation::NoesisAnimation;
pub use animation::NoesisAnimationPlugin;
pub use bake::NoesisLabelBaker;
pub use bake::NoesisLabelBakerPlugin;
pub use binding::NoesisBinding;
pub use binding::NoesisBindingPlugin;
pub use binding::SourceSpec;
pub use brushes::BrushReadback;
pub use brushes::BrushSpec;
pub use brushes::BrushTarget;
pub use brushes::GradientStop;
pub use brushes::NoesisBrushChanged;
pub use brushes::NoesisBrushes;
pub use brushes::NoesisBrushesPlugin;
pub use classes::NoesisClassPlugin;
pub use classes::NoesisClassRegistry;
pub use clip::NoesisClip;
pub use clip::NoesisClipPlugin;
pub use commands::CommandForwarder;
pub use commands::CommandsDef;
pub use commands::NoesisCommandInvoked;
pub use commands::NoesisCommands;
pub use commands::NoesisCommandsPlugin;
pub use commands::SharedCommandQueue;
pub use diagnostics::NoesisDiagnostics;
pub use diagnostics::NoesisDiagnosticsPlugin;
pub use dp::DpKind;
pub use dp::DpValue;
pub use dp::DpWatch;
pub use dp::NoesisDp;
pub use dp::NoesisDpChanged;
pub use dp::NoesisDpPlugin;
pub use events::ClickWatchEntry;
pub use events::KeyDownWatchEntry;
pub use events::NoesisClickWatch;
pub use events::NoesisClicked;
pub use events::NoesisEventsPlugin;
pub use events::NoesisKeyDown;
pub use events::NoesisKeyDownWatch;
pub use events::SharedClickQueue;
pub use events::SharedKeyDownQueue;
pub use events::UiClicked;
pub use events::UiKeyDown;
pub use focus::NoesisFocus;
pub use focus::NoesisFocusPlugin;
pub use focus_input::FocusMove;
pub use focus_input::FocusPredict;
pub use focus_input::KeyBindingSpec;
pub use focus_input::NoesisFocusBindingFired;
pub use focus_input::NoesisFocusControl;
pub use focus_input::NoesisFocusControlPlugin;
pub use focus_input::NoesisFocusPredicted;
pub use font::BevyFontProvider;
pub use font::FontAsset;
pub use font::FontAssetLoader;
pub use font::FontAssetPlugin;
pub use font::FontRegistry;
pub use geometry::NoesisGeometry;
pub use geometry::NoesisGeometryPlugin;
pub use headless::NoesisHeadlessPlugin;
pub use image::BevyTextureProvider;
pub use image::ImageAsset;
pub use image::ImageAssetLoader;
pub use image::ImageAssetPlugin;
pub use image::ImageRegistry;
pub use imaging::ImageBitmap;
pub use imaging::ImageReadback;
pub use imaging::NoesisImageChanged;
pub use imaging::NoesisImaging;
pub use imaging::NoesisImagingPlugin;
pub use inlines::InlineSpec;
pub use inlines::InlinesReadback;
pub use inlines::NoesisInlines;
pub use inlines::NoesisInlinesChanged;
pub use inlines::NoesisInlinesPlugin;
pub use input::NoesisInputEvent;
pub use input::NoesisInputPlugin;
pub use input::NoesisInputQueue;
pub use input::NoesisPointerOverUi;
pub use input::TargetedInput;
pub use integration::NoesisCursorRequested;
pub use integration::NoesisIntegrationPlugin;
pub use integration::NoesisOpenUrl;
pub use integration::NoesisPlayAudio;
pub use items::CollectionViewOp;
pub use items::ItemValue;
pub use items::ItemsBinding;
pub use items::NoesisItems;
pub use items::NoesisItemsCurrent;
pub use items::NoesisItemsPlugin;
pub use items::ObjectRow;
pub use items::ObjectSource;
pub use layout::Margin;
pub use layout::NoesisLayout;
pub use layout::NoesisLayoutPlugin;
pub use list::ListRows;
pub use list::ListSort;
pub use list::ListedIn;
pub use list::NoesisListAppExt;
pub use list::NoesisListOps;
pub use list::NoesisListPlugin;
pub use list::NoesisListSelection;
pub use list::NoesisListSet;
pub use list::NoesisRowSelected;
pub use list::Selected;
pub use list::UiList;
pub use markup::NoesisMarkupExtensionPlugin;
pub use markup::NoesisMarkupExtensionRegistry;
pub use panel::NoesisPanelAppExt;
pub use panel::NoesisPanelPlugin;
pub use panel::NoesisPanelSet;
pub use panel::NoesisPanelText;
pub use panel::NoesisPanelTextChanged;
pub use panel::SealPanel;
pub use panel::UiPanel;
pub use plain_vm::NoesisViewModel;
pub use plain_vm::NoesisViewModelAppExt;
pub use render::NoesisCamera;
pub use render::NoesisIntermediate;
pub use render::NoesisRenderPlugin;
pub use render::NoesisSet;
pub use render::NoesisView;
pub use resources::NoesisResources;
pub use resources::NoesisResourcesInstalled;
pub use resources::NoesisResourcesPlugin;
pub use resources::ResourceEntry;
pub use routed_events::EventWatchEntry;
pub use routed_events::NoesisEventWatch;
pub use routed_events::NoesisRoutedEvent;
pub use routed_events::NoesisRoutedEventsPlugin;
pub use routed_events::RoutedEventSnapshot;
pub use routed_events::SharedRoutedEventQueue;
pub use routed_events::UiRoutedEvent;
pub use shapes::NoesisShapes;
pub use shapes::NoesisShapesPlugin;
pub use shapes::ShapeKind;
pub use shapes::ShapeSpec;
pub use styles::DataTriggerSpec;
pub use styles::MultiTriggerSpec;
pub use styles::NoesisStyles;
pub use styles::NoesisStylesPlugin;
pub use styles::PropertyTrigger;
pub use styles::StyleSpec;
pub use svg::NoesisSvg;
pub use svg::NoesisSvgChanged;
pub use svg::NoesisSvgPlugin;
pub use text::NoesisText;
pub use text::NoesisTextChanged;
pub use text::NoesisTextPlugin;
pub use theme::NoesisDefaultThemePlugin;
pub use transforms::NoesisTransform;
pub use transforms::NoesisTransformChanged;
pub use transforms::NoesisTransformPlugin;
pub use transforms::TransformSpec;
pub use transforms3d::Matrix3DSpec;
pub use transforms3d::NoesisMatrixTransform3DChanged;
pub use transforms3d::NoesisTransform3D;
pub use transforms3d::NoesisTransform3DChanged;
pub use transforms3d::NoesisTransform3DPlugin;
pub use transforms3d::Transform3DSpec;
pub use typography::FontStyling;
pub use typography::NoesisTypography;
pub use typography::NoesisTypographyChanged;
pub use typography::NoesisTypographyPlugin;
pub use typography::TypographyField;
pub use typography::TypographyValue;
pub use typography::TypographyWatch;
pub use ui::NoesisUi;
pub use viewmodel::NoesisViewModelChanged;
pub use viewmodel::NoesisViewModelPlugin;
pub use viewmodel::NoesisVm;
pub use viewmodel::SharedVmChangedQueue;
pub use viewmodel::ViewModelChangeForwarder;
pub use viewmodel::ViewModelDef;
pub use viewmodel::VmValue;
pub use visibility::NoesisVisibility;
pub use visibility::NoesisVisibilityPlugin;
pub use visual_state::NoesisVisualState;
pub use visual_state::NoesisVisualStatePlugin;
pub use visual_state::StateRequest;
pub use window_compat::NoesisWindowCompatPlugin;
pub use window_compat::WINDOW_CLASS;
pub use xaml::BevyXamlProvider;
pub use xaml::XamlAsset;
pub use xaml::XamlAssetLoader;
pub use xaml::XamlAssetPlugin;
pub use xaml::XamlRegistry;

Modules§

animation
Per-view code-built property animations: the runtime-driven counterpart to a XAML <Storyboard>/<DoubleAnimation> declared inline in a ControlTemplate or Style.Triggers.
bake
Bake an XAML view to an offscreen Handle<Image>.
binding
Per-view value-converter / multi-binding bridge: install a code-built {Binding}, driven by a Rust ValueConverter / MultiValueConverter, onto a named element’s dependency property.
brushes
Per-view code-built brush bridge: paint named XAML elements with brushes constructed in Rust, no XAML authoring required. The brush counterpart of the crate::dp / crate::geometry write bridges.
classes
Register Rust-backed XAML classes (<myns:Foo>) with Noesis from Bevy systems.
clip
Per-view clip bridge: imperative polygon clips against named XAML elements on a single NoesisView. The clip counterpart of crate::geometry — where that assigns a Path’s Data, this assigns any element’s UIElement::Clip.
commands
Per-view Rust-owned ICommand bridge.
diagnostics
App-level diagnostics bridge: surface Noesis’s process-global allocator counters as a Bevy resource and route its error handler into Bevy’s log.
dp
Per-view generic dependency-property get/set bridge, keyed by (x:Name, property).
events
Per-view routed-event bridge: surface BaseButton::Click and UIElement::KeyDown from named elements of a single crate::NoesisView as both Bevy messages and Bevy EntityEvents (observers).
focus
Per-view keyboard-focus bridge: give a named XAML element keyboard focus on a single crate::NoesisView.
focus_input
Per-view focus-navigation and input-binding bridge: the directional, engagement, and key-chord layer on top of the one-shot crate::NoesisFocus bridge.
font
Font-asset plumbing for the Bevy plugin.
geometry
Per-view geometry bridge: imperative vector polyline writes against named XAML Path elements on a single NoesisView. The geometry counterpart of crate::text.
headless
Headless harness entry point for tests and CI.
image
Image-asset plumbing for the ImageBrush / Image loader.
imaging
Per-view code-built imaging bridge: drive a named <Image>’s pixels from a Rust-provided bitmap (RGBA8 + size), no image file on disk required. The imaging counterpart of the crate::brushes / crate::geometry write bridges.
inlines
Per-view formatted text bridge: give a named TextBlock rich inline content (Run / Bold / Italic / Underline / Span / Hyperlink / LineBreak) from Bevy, then read the resulting live structure back.
input
Bevy → Noesis input forwarding.
integration
App-level system-integration bridge.
items
Per-view ItemsSource bridge: populate XAML list controls (ComboBox / ListBox / ItemsControl) from a Bevy app, with typed items.
layout
Per-view Margin writes against named XAML elements: the positioning primitive for floating panels (context menus, popups, tooltips) that must follow gameplay coordinates.
list
Primitive 2: list = query. The rows of a XAML list control are Bevy entities: spawn an entity carrying a row-data component and a ListedIn membership, and it appears as a row; despawn it and the row leaves. The bound ObservableCollection is reconciled from the query keyed by Entity, emitting the minimal Add / Remove / Update / Move op sequence (never a Clear/Reset in steady state), so a control’s selection and scroll position survive every edit.
markup
Custom MarkupExtension registration for Bevy.
panel
Primitive 1: panel = entity. A UiPanel is a Bevy entity that mounts a sub-XAML fragment as a hosted child of a NoesisView scene; the bound components on that same entity are its DataContext.
plain_vm
Per-view plain-struct ViewModel bridge: bind a plain Bevy Component to a view’s XAML {Binding field_name} by field name, two-way.
reconcile
“Diff in parallel, push serially”: the reconcile convention the data-driven bridges (list reconcile, panel/DataContext reconcile) are built on.
render
Render integration: drives each NoesisView camera’s UI and composites it into the Bevy frame.
render_device
wgpu-backed render device for Noesis. This module pulls in no Bevy types, so you can drive it with a hand-built wgpu instance in tests.
resources
App-level application-resources bridge. Registers Rust-built resources (code-built brushes, scalar values) and merged <ResourceDictionary> XAML into the process-global application resources, so XAML {StaticResource Key} references resolve them without authoring a theme file on disk.
routed_events
Per-view generic routed-event bridge: surface any RoutedEvent (mouse, key, focus, drag, manipulation, lifecycle bubbling, …) from named elements of a single crate::NoesisView as Bevy messages.
shapes
Per-view shapes bridge: build a Noesis vector Shape (Rectangle, Ellipse, or Line) entirely in Rust and assign it as the content of a named XAML container element on a single NoesisView.
styles
Per-view code-built Style bridge: restyle named XAML elements with a Noesis::Style constructed in Rust, no XAML authoring required. The style counterpart of the crate::dp / crate::brushes write bridges.
svg
Per-view SVG bridge: drive a named XAML element from an SVG path-data source string parsed in Rust. The SVG counterpart of the crate::geometry polyline bridge.
text
Per-view Text bridge: write and observe the Text of named XAML elements (TextBox / TextBlock) on a single crate::NoesisView.
theme
Opt-in loader for Noesis’s shipped control theme.
transforms
Per-view RenderTransform writes against named XAML elements: the post-layout scale / skew / rotate / translate that drives UI motion (a button that pops on hover, a panel that slides in, a spinning loader) without touching layout.
transforms3d
Per-view 3D transform writes against named XAML elements: the UIElement.Transform3D attached behaviour (WinUI/Noesis) that rotates, scales and translates an element in 3D space about a center, with the implicit projection camera supplying perspective. Distinct from the 2D RenderTransform bridge (crate::transforms): that one sets RenderTransform, this one sets Transform3D.
typography
Per-view typography bridge: restyle the TextElement font properties (size, family, weight, style, stretch) of named XAML elements on a single NoesisView.
ui
NoesisUi: ergonomic access to the single NoesisView in a one-UI app.
viewmodel
Per-view Rust-owned ViewModel / DataContext bridge.
visibility
Per-view visibility bridge: show or hide named XAML elements on a single NoesisView.
visual_state
Per-view VisualStateManager::GoToState writes against named XAML controls: the code-driven counterpart to a ControlTemplate’s trigger-driven visual states (e.g. a control’s CommonStates: Normal / MouseOver / Pressed / Disabled, or app-authored groups).
window_compat
Window root-element compatibility shim.
xaml
XAML asset plumbing: feeds Bevy-loaded XAML bytes to Noesis’s parser.

Structs§

ConvertArg
A borrowed, boxed binding value handed to a ValueConverter. None-valued (the bound source produced null / the control supplied no parameter) reports is_none; the typed accessors return None when the boxed runtime type doesn’t match.
ModifierKeys
A typed bitset of Noesis::ModifierKeys: the chord modifiers held down (Alt / Control / Shift / Windows). Compose with Self::with / FromIterator and test with Self::contains.
NoesisLicense
Per-developer Indie license credentials.
NoesisPlugin
Bevy plugin that initializes Noesis at app startup and shuts it down when the App is dropped.
PlainValueRef
A borrowed, boxed value handed to a PlainSetHandler (a TwoWay writeback). The typed accessors return None when the boxed runtime type doesn’t match / the value is null.

Enums§

BindingMode
How a Binding propagates values between source and target. Mirrors Noesis::BindingMode.
Converted
A value a ValueConverter produces. The trampoline re-boxes it into the Noesis::BaseComponent* the binding engine expects.
CursorType
Built-in cursor kind Noesis asks the host to display. Re-exported from the runtime so consumers can match on NoesisCursorRequested::cursor without depending on noesis_runtime directly. Built-in cursor types, mirroring Noesis::CursorType in NsGui/Cursor.h. The discriminants match the C++ enum exactly so the value read back from a live Cursor round-trips.
FocusNavigationDirection
Mirror of Noesis::FocusNavigationDirection: the direction for FrameworkElement::move_focus / FrameworkElement::predict_focus. Next / Previous / First / Last are tab-order traversal (not supported by predict_focus), while Left / Right / Up / Down are directional.
FontStretch
Noesis::FontStretch.
FontStyle
Noesis::FontStyle.
FontWeight
Noesis::FontWeight. The numeric value is the weight (e.g. Normal = 400, Bold = 700), matching the OpenType usWeightClass.
Key
Common subset of Noesis::Key from NsGui/InputEnums.h. Values are the C++ enum ordinals, validated by static_assert in noesis_view.cpp. View::key_down takes this typed enum, so a key outside the subset can’t be sent until it is added here — add the variant (with a matching assert in C++) to centralize the mapping.
MouseButton
Mirror of Noesis::MouseButton from NsGui/InputEnums.h. Ordinals validated at C++ compile time via static_assert in noesis_view.cpp.
PlainType
Content type of a reflected plain-VM property. Mirrors noesis_plain_type in cpp/noesis_shim.h; the ordinal is the FFI tag.
PlainValue
A value to push into a plain-VM property. The crate boxes it into the BaseComponent* the binding engine reads.
RoutedEvent
A documented Noesis::RoutedEvent accepted by subscribe_event. Each variant maps to a curated entry in the C++ event table (noesis_events.cpp), so the typed accessors on EventArgs know which concrete arg struct fired. Use subscribe_event_by_name for arbitrary/custom events not listed here.
TextDecorations
Re-exported from noesis_runtime: the TextDecorations an inline can carry (see InlineSpec::decorated). The TextDecorations an Inline can carry, mirroring Noesis::TextDecorations.

Traits§

MultiValueConverter
Rust-side multi-value conversion logic: combine the source values of the child bindings into one target value. Returning None signals UnsetValue (the binding falls back to its FallbackValue / the property default).
ValueConverter
Rust-side conversion logic. convert maps a binding source value to the target; convert_back (only reached on a TwoWay / OneWayToSource binding) maps a target value back to the source. Returning None signals UnsetValue.

Functions§

get_culture
Return the active default culture’s BCP-47 name. Defaults to "en-US" before any set_culture call.
open_url
Ask Noesis to open url. Invokes the registered open-URL callback synchronously; a no-op if none is registered.
play_audio
Ask Noesis to play the sound at uri at volume. Invokes the registered play-audio callback synchronously; a no-op if none is registered.
set_culture
Set the default culture by BCP-47 name (e.g. "en-US", "fr-FR"). The name backs Noesis’s number / currency / date formatting. Round-trips through get_culture. The C++ shim keeps the name alive in a static buffer for the process lifetime.

Derive Macros§

NoesisViewModel
Derive macro for NoesisViewModel: binds a plain struct’s fields by name.