Files
llimphi/llimphi-icons/examples/app_icons_gallery.rs
T
Sergio ccab39f140 refresh: stack al día (vello 0.7 / wgpu 27 / parley 0.6) + motor 3D voxel
Re-sincroniza las fuentes desde el monorepo (estaba en vello 0.5/wgpu 24 y con la
estructura vieja de eventloop) y suma el 3D:

- bump del workspace a vello 0.7 / wgpu 27 / parley 0.6, + accesskit 0.24 /
  accesskit_winit 0.33 / vello_hybrid 0.0.9.
- nuevos crates: llimphi-3d (voxels ray-march + mallas en un depth compartido,
  montable dentro de un View 2D vía set_viewport+scissor) y llimphi-voxel
  (world-gen, personajes, director de escenas) + shared/foreign-vox (puente .vox).
- README: sección "Not just 2D — a 3D voxel engine" + GIF (docs/llimphi_voxel.gif).
- excluido modules/allichay (arrastra deps fuera del alcance del front-door).
- cargo check --workspace: verde.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 14:40:00 +00:00

137 lines
3.7 KiB
Rust

//! Galería de los iconos de marca de todas las apps de tawasuyu.
//!
//! Pinta los 29 [`AppIcon`] en una grilla, cada uno en su color de marca
//! con su nombre debajo. Sirve para eyeballear de un vistazo que el set
//! es coherente (mismo peso de trazo, mismo aire) y que cada glifo es
//! reconocible.
//!
//! `cargo run -p llimphi-icons --example app_icons_gallery --release`
use llimphi_icons::app_icons::{app_icon_view, AppIcon, ALL};
use llimphi_ui::llimphi_layout::taffy::prelude::{
auto, length, percent, AlignItems, FlexDirection, JustifyContent, Size, Style,
};
use llimphi_ui::llimphi_layout::taffy::Rect;
use llimphi_ui::llimphi_raster::peniko::Color;
use llimphi_ui::llimphi_text::Alignment;
use llimphi_ui::{App, Handle, View};
const COLS: usize = 6;
const BG: Color = Color::from_rgb8(18, 20, 24);
const CELL: Color = Color::from_rgb8(28, 31, 38);
const LABEL: Color = Color::from_rgb8(196, 202, 212);
struct Model;
#[derive(Clone)]
enum Msg {}
fn cell(icon: AppIcon) -> View<Msg> {
// Recuadro del glifo (cuadrado, el icono se escala al lado menor).
let icon_box = View::new(Style {
size: Size {
width: length(52.0_f32),
height: length(52.0_f32),
},
flex_shrink: 0.0,
..Default::default()
})
.children(vec![app_icon_view(icon, 2.0)]);
let label = View::new(Style {
size: Size {
width: percent(1.0_f32),
height: length(16.0_f32),
},
..Default::default()
})
.text_aligned(icon.name().to_string(), 11.0, LABEL, Alignment::Center);
View::new(Style {
size: Size {
width: length(118.0_f32),
height: length(96.0_f32),
},
flex_direction: FlexDirection::Column,
align_items: Some(AlignItems::Center),
justify_content: Some(JustifyContent::Center),
gap: Size {
width: length(0.0_f32),
height: length(8.0_f32),
},
..Default::default()
})
.fill(CELL)
.radius(12.0)
.children(vec![icon_box, label])
}
fn row(icons: &[AppIcon]) -> View<Msg> {
View::new(Style {
size: Size {
width: auto(),
height: auto(),
},
flex_direction: FlexDirection::Row,
gap: Size {
width: length(14.0_f32),
height: length(0.0_f32),
},
..Default::default()
})
.children(icons.iter().copied().map(cell).collect())
}
struct Gallery;
impl App for Gallery {
type Model = Model;
type Msg = Msg;
fn title() -> &'static str {
"llimphi-icons · galería de apps"
}
fn initial_size() -> (u32, u32) {
(820, 620)
}
fn init(_: &Handle<Msg>) -> Model {
Model
}
fn update(_model: Model, msg: Msg, _: &Handle<Msg>) -> Model {
match msg {}
}
fn view(_: &Model) -> View<Msg> {
let rows: Vec<View<Msg>> = ALL.chunks(COLS).map(row).collect();
View::new(Style {
size: Size {
width: percent(1.0_f32),
height: percent(1.0_f32),
},
flex_direction: FlexDirection::Column,
align_items: Some(AlignItems::Center),
justify_content: Some(JustifyContent::Center),
gap: Size {
width: length(0.0_f32),
height: length(14.0_f32),
},
padding: Rect {
left: length(20.0_f32),
right: length(20.0_f32),
top: length(20.0_f32),
bottom: length(20.0_f32),
},
..Default::default()
})
.fill(BG)
.children(rows)
}
}
fn main() {
llimphi_ui::run::<Gallery>();
}