2D & UI primer #786
No reviewers
Labels
No labels
Context: Bug
Context: Enhancements
Platform: Android
Platform: Linux
Platform: Web
Platform: Windows
Platform: iOS
Platform: macOS
Target: CI
Target: CLI
Target: Dependency
Target: Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
SakulFlee/Orbital!786
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/primer_2d_ui"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add RenderOverlayResource::ensure() and IcedLayerRenderer::register() to eliminate the repeated check-then-insert boilerplate in Module::setup(). Before (every module): if ecs.get_resource::<RenderOverlayResource>().is_none() { ecs.insert_resource(RenderOverlayResource::new()); } if let Some(res) = ecs.get_resource_mut::<RenderOverlayResource>() { res.add_layer_renderer(Box::new(overlay)); } After: IcedLayerRenderer::new(state).register(ecs);Modules now declare UI intent by inserting IcedUiState into the ECS. IcedBridgeModule detects it and creates the renderer automatically. Before (module creates and registers renderer directly): let overlay = IcedLayerRenderer::new(state); ecs.insert_resource(RenderOverlayResource::new()); ecs.get_resource_mut::<RenderOverlayResource>() .unwrap() .add_layer_renderer(Box::new(overlay)); After (module just inserts state, bridge handles the rest): ecs.insert_resource(IcedUiState(state)); App::new() .add_module(MyModule) .add_module(IcedBridgeModule) .liftoff(event_loop, settings)Two issues when building generated projects from git dependency: 1. Template Cargo.toml files with {name} placeholders were being parsed as workspace members during git checkout resolution. Added workspace exclude for template directories. 2. Generated project depended on winit 0.30.0 from crates.io, but orbital re-exports the iced fork's winit. Two versions = type mismatch. Removed direct winit dep; use orbital::winit instead.Template Cargo.toml files with {name} placeholders were being parsed by cargo when resolving the Orbital workspace from a git dependency. Removed the files entirely; all three templates now share the same generate_cargo_toml() function. Also fixed make_desktop_main/make_android_main macros to use ::orbital::winit instead of ::winit, eliminating the need for generated projects to depend on winit directly.Shape overlay: - Moved square from cx+55 to cx+25 (closer to center) Iced renderer: - Reverted viewport Scale from {scale_factor, scale_factor} to {1.0, 1.0} - This matches original rendering behavior and prevents UI from growing - Cursor/event coordinate conversion (physical→logical) remains correct - Layout size conversion (physical→logical) remains correctScale factor conversion caused growing positional offset because layout was in logical space while viewport was in physical space (Scale {1.0}). Revert cursor, CursorMoved events, and layout size to physical pixels to match the viewport — consistent with the working iced_demo.Winit reports cursor/events/window size in physical pixels while iced layout and hit-testing work in logical pixels (physical / scale). The previous revert to physical + Scale{1,1} is only correct at 100% display scaling; at 150% every widget is offset proportionally to its distance from the top-left. Mirror the canonical iced integration example: convert cursor, CursorMoved events and layout size to logical, build the viewport with the real window scale. Conversion happens once at the iced boundary; engine resources stay physical. Also add temporary INFO-level [iced-trace] logging (push/update/panel messages) to verify event flow on real runs. To be removed once verified.