MCPcopy Index your code
hub / github.com/dekirisu/mevy

github.com/dekirisu/mevy @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
127 symbols 217 edges 15 files 20 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README
<img src="https://github.com/user-attachments/assets/829a86b8-8dc4-4403-9da4-536daaefbd11">






<a href="https://github.com/dekirisu/mevy" style="position:relative"><img src="https://img.shields.io/badge/github-dekirisu/mevy-ee6677"></a>
<a href="https://crates.io/crates/mevy" style="position:relative"><img src="https://img.shields.io/crates/v/mevy"></a>
<a href="https://discord.gg/kevWvBuPFg" style="position:relative"><img src="https://img.shields.io/discord/515100001903312898"></a>







<img src="https://github.com/user-attachments/assets/891599e8-98a9-4d32-9f6e-6dfa76e51a31">

[!IMPORTANT]

This crate is meant to provide macros only - no additional bevy plugins, resources, components or systems

Setup

Multiple bevy versions are supported and managed by features:

# bevy 0.18
mevy = {version="0.4",features=["0.18"]}

# bevy 0.17
mevy = {version="0.4",features=["0.17"]}

# bevy 0.16
mevy = {version="0.4",features=["0.16"]}

# bevy 0.15
mevy = {version="0.4",features=["0.15"]}

Then just use all of it:

use bevy::prelude::*;
use mevy::*;

Simpler Hierarchy Spawning

Spawn children just by stating [] - the 'names' are just variables containing their Entity - those variables can be used anywhere in the macro - even 'before' - read more or see this example.

entity!{
    <world> // pass a mut World, Commands, ... variable
    SpecificChild(optional_child_name); // insert component
    .observe(..);                       // use method
    > Pointer<Click>{..};               // quick observe (e.g. 'on click')
    // component/bundle;
    // .method(..);
    [optional_child_name][
        // component;
        // .method(..);
    ]
}

Modify entities in a 'quick and dirty' way: - read more or see this example.

entity!{
    <world|#Component> // select every entity with this Component
    <Children.iter()>  // > select all children of those
    <Children.iter()>  // >> infinitely chain those selectors
    .despawn();        // despawn all of the last selected
}

CSS-like notation for bevy_ui

Using ui!((..)) (inner round braces) will return a tuple of mentioned components only. - read about available fields, custom fields & notation in this readme - see this example.

// Slim Mode
c.spawn(ui!(
    w:100 h:100 bg:#fff round:6 border:5#f00 
    shadow:10%10%3+8#fa4 neat_outline
));

// CSS-Like Mode (does the same)
c.spawn(ui!((
    size:          100px 100px;
    border:        5px #ff0000;
    box_shadow:    10% 10% 3px 8px #ffaa44;
    background:    #ffffff;
    border_radius: 6px;
    neat_outline;
)?));
//^ optional ? (or any token): hovering shows the returned tuple (if LSP used)

/// function as custom fields or p refabs
fn neat_outline() -> Outline {ui!((
    outline: 3px 1px #00ff00;
))}

Code Replacement Macro

Using the code!{} macro simplifies constructing: - Color by writing #rgb/#rgba/#rrggbb/#rrggbbaa - Val by writing 0px/0%/0vw/0vh/0vmin/0vmax/@(auto) - UiRect by writing [>0px]/[>0px 0px]/[>0px 0px 0px]/[>0px 0px 0px 0px] (css-like)

So you can do fun things like:

let shadow = code!{BoxShadow{
    // use #... is replaced with Color, meaning you can e.g. use methods 
    color: #FF1265.mix(&#F93ECA,0.4).with_alpha(0.2),
    x_offset: 100px,
    y_offset: 50%,
    spread_radius: 3.1vh,
    blur_radius: 40.23vmax,
}}};
let color = code!{#FF0000};
// or multiple things in the macro
code!{
    let color2 = #00FF00;
    let color3 = #6600AA;
}
println!{"{color2:?}"}

Design

Crates are separated into: - crate/*/syntax: token handling, meant to be reusable - crate/*: actual macros, based on that 'syntax'

[!NOTE] Only relevant if you dig deeper into this crate: The versions of those are not hard linked, since the macros can keep (or gain) features, even if the the syntax api has changed. So if one of those is 0.2.x and the other 0.5.x at some point, don't worry.

Core symbols most depended-on inside this repo

try_extra
called by 12
crates/ui/syntax/src/lib.rs
prepare
called by 9
crates/ui/syntax/src/lib.rs
try_into_color
called by 9
crates/ui/syntax/src/lib.rs
into_vals
called by 7
crates/ui/syntax/src/lib.rs
compile_error_no_version
called by 7
crates/ecs/syntax/src/lib.rs
peek_split_punct_once
called by 5
crates/ecs/syntax/src/lib.rs
world_spawn_syntax
called by 5
crates/ecs/syntax/src/lib.rs
into_rect_like
called by 4
crates/ui/syntax/src/lib.rs

Shape

Function 76
Method 45
Class 5
Enum 1

Languages

Rust100%

Modules by API surface

crates/ui/syntax/src/lib.rs34 symbols
examples/entity_macro.rs28 symbols
crates/ecs/syntax/src/lib.rs19 symbols
crates/ecs/src/lib.rs13 symbols
crates/core/syntax/src/lib.rs12 symbols
tests/test_019/src/lib.rs7 symbols
examples/ecs_simple_spawn.rs4 symbols
examples/ui_bundle.rs3 symbols
tests/test_018/src/lib.rs2 symbols
examples/ecs_picking.rs2 symbols
examples/core_code.rs1 symbols
crates/ui/src/lib.rs1 symbols

For agents

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

⬇ download graph artifact