This commit is contained in:
2026-07-14 12:04:07 -04:00
parent ff61fbfc90
commit 7747eeae7c
5 changed files with 22 additions and 7 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
pub mod layout;
pub mod render;
pub mod widget;
pub mod unit;
pub mod widget;
+6
View File
@@ -41,6 +41,12 @@ impl From<(u16, u16)> for Point {
}
}
impl From<u16> for Point {
fn from(value: u16) -> Self {
Self { x: value, y: value }
}
}
impl From<Rect> for Point {
fn from(value: Rect) -> Self {
Self {
-5
View File
@@ -1,5 +0,0 @@
use crate::render::RenderScope;
pub trait Widget {
fn render(&self, scope: &mut RenderScope);
}
+11
View File
@@ -0,0 +1,11 @@
use crate::render::RenderScope;
pub trait Widget {
fn render(&self, scope: &mut RenderScope);
}
impl Widget for str {
fn render(&self, scope: &mut RenderScope) {
scope.draw_text(0, self);
}
}
+4 -1
View File
@@ -1,4 +1,7 @@
use pulse_ui::layout::{LayoutItem, Rect, Size, layout};
use pulse_ui::{
layout::{LayoutItem, layout},
unit::{Rect, Size},
};
fn main() {
let layout = layout(vec![