-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
UIAll things user interface relatedAll things user interface relatedenhancementNew feature or requestNew feature or requestlambda-rsIssues pertaining to the core frameworkIssues pertaining to the core framework
Description
Overview
Define the base widget trait that all UI elements implement and establish the
rendering model for UI components.
Current State
No response
Scope
Goals:
Widgettrait defining common interface- Widget bounds and layout rect
- Basic rendering abstraction
- Hit testing for input handling
Non-Goals:
- Specific widget types
- Layout system
- Styling
Proposed API
// crates/lambda-rs/src/ui/widget.rs
pub struct Rect {
pub x: f32,
pub y: f32,
pub width: f32,
pub height: f32,
}
impl Rect {
pub fn contains(&self, x: f32, y: f32) -> bool;
}
pub trait Widget {
fn bounds(&self) -> Rect;
fn set_bounds(&mut self, rect: Rect);
fn render(&self, ctx: &mut UiRenderContext) -> Vec<RenderCommand>;
fn hit_test(&self, x: f32, y: f32) -> bool;
}
pub struct UiRenderContext<'a> {
render_context: &'a mut RenderContext,
// UI-specific state
}Acceptance Criteria
- Widget trait is object-safe (can use dyn Widget)
- Bounds stored and queryable
- Hit test uses bounds by default
- Render returns commands for drawing
- Trait extensible for specific widgets
Affected Crates
lambda-rs
Notes
- Consider immediate-mode alternative (egui integration)
Metadata
Metadata
Assignees
Labels
UIAll things user interface relatedAll things user interface relatedenhancementNew feature or requestNew feature or requestlambda-rsIssues pertaining to the core frameworkIssues pertaining to the core framework