MCPcopy Index your code
hub / github.com/AustinJ235/basalt

github.com/AustinJ235/basalt @0.21.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.21.0 ↗ · + Follow
769 symbols 1,514 edges 39 files 282 documented · 37%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Basalt is a window/ui framework for building desktop applications or providing a ui a top other applications. In the backend vulkano which is a safe rust wrapper around vulkan. Basalt provides window creation, advance input handling, and along with the ui itself. The UI is based on the idea of a Bin. A Bin can have borders, backgrounds, and text and is the the fundamental element for building any ui widget/element. Currently the amount of provided widgets/elements is limited.

The project is very much a work in progress and is what I work on the side. Some issues exists, but nothing preventing you from creating a full-fledged app!

use basalt::input::MouseButton;
use basalt::interface::{BinPosition, BinStyle, Color};
use basalt::render::Renderer;
use basalt::window::WindowOptions;
use basalt::{Basalt, BasaltOptions};

fn main() {
    Basalt::initialize(BasaltOptions::default(), move |basalt_res| {
        let basalt = basalt_res.unwrap();

        let window = basalt
            .window_manager_ref()
            .create(WindowOptions {
                title: String::from("app"),
                inner_size: Some([400; 2]),
                ..WindowOptions::default()
            })
            .unwrap();

        let background = window.new_bin();

        background
            .style_update(BinStyle {
                pos_from_t: Some(0.0),
                pos_from_b: Some(0.0),
                pos_from_l: Some(0.0),
                pos_from_r: Some(0.0),
                back_color: Some(Color::shex("f0f0f0")),
                ..BinStyle::default()
            })
            .expect_valid();

        let button = window.new_bin();
        background.add_child(button.clone());

        button
            .style_update(BinStyle {
                position: Some(BinPosition::Parent),
                pos_from_t: Some(75.0),
                pos_from_l: Some(75.0),
                width: Some(75.0),
                height: Some(32.0),
                back_color: Some(Color::shex("c0c0c0")),
                border_size_t: Some(1.0),
                border_size_b: Some(1.0),
                border_size_l: Some(1.0),
                border_size_r: Some(1.0),
                border_color_t: Some(Color::shex("707070")),
                border_color_b: Some(Color::shex("707070")),
                border_color_l: Some(Color::shex("707070")),
                border_color_r: Some(Color::shex("707070")),
                text: String::from("Button"),
                text_height: Some(16.0),
                pad_t: Some(7.0),
                pad_l: Some(8.0),
                text_color: Some(Color::shex("303030")),
                ..BinStyle::default()
            })
            .expect_valid();

        button.on_press(MouseButton::Left, move |_, window, local| {
            println!("{:?} {:?}", window, local);
            Default::default()
        });

        Renderer::new(window)
            .unwrap()
            .with_interface_only()
            .run()
            .unwrap();

        basalt.exit();
    });
}

Extension points exported contracts — how you extend this code

KeyCombo (Interface)
Trait used for various methods that can take multiple `Key`s. A `Key` can be either `Qwerty` or `MouseButton`. Support [3 …
src/input/key.rs
UserRenderer (Interface)
Trait used for user provided renderers. [1 implementers]
src/render/mod.rs

Core symbols most depended-on inside this repo

f32u8
called by 176
src/image_cache/convert.rs
u16f32
called by 129
src/image_cache/convert.rs
stl
called by 93
src/image_cache/convert.rs
u8f32
called by 92
src/image_cache/convert.rs
lts
called by 75
src/image_cache/convert.rs
upgrade
called by 48
src/input/mod.rs
input_ref
called by 45
src/lib.rs
finish
called by 39
src/input/builder.rs

Shape

Method 593
Class 81
Enum 50
Function 43
Interface 2

Languages

Rust100%

Modules by API surface

src/interface/bin/color.rs181 symbols
src/window/window.rs76 symbols
src/interface/bin/mod.rs76 symbols
src/lib.rs54 symbols
src/input/builder.rs37 symbols
src/interface/bin/style.rs33 symbols
src/input/state.rs31 symbols
src/input/mod.rs28 symbols
src/window/mod.rs27 symbols
src/image_cache/mod.rs24 symbols
src/render/mod.rs21 symbols
src/interface/mod.rs21 symbols

For agents

$ claude mcp add basalt \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact