codecraft 0.1.1

A minimalist 3D game engine built on parts of Bevy (ECS, color) with wgpu and winit: OpenPBR materials, clustered lighting, an immediate-mode UI, audio and gamepad haptics
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use bevy_ecs::prelude::*;

/// Something that can lay itself out for a given screen size and spawn its
/// entities, so scenes can build UI with [`crate::AppState::spawn`].
///
/// [`Output`](Widget::Output) is what the caller gets back — a bare [`Entity`]
/// for a single-entity widget, or a handle to several of them (see
/// [`super::Panel`], which returns its panel plus one entity per button so a
/// scene can update labels later).
pub trait Widget {
    type Output;

    fn spawn(self, world: &mut World, screen_width: f32, screen_height: f32) -> Self::Output;
}