-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Helpers for overlay editing #6
Comments
Here is an idea - when selecting an entity, spawn "virtual entities" - lets call them knobs - based on its type and data. These entities could be clicked on and dragged, and that information can be passed back to the edit system. I say they are "virtual entities" because they will not be created when playing the level. They should not be child entities, because they should not be deleted on Code-wise, I think it should look something like this (this example if for a resize knob): fn edit_system(edit: YoleckEdit<Example>) {
edit.edit(|ctx, data, ui| {
ctx.knob("width", |ctx, cmd| {
if let Some(pos) ctx.get_passed_data::<Vec2>() {
data.size.x = pos.x - data.position.x;
}
cmd.insert_bundle(SpriteBundle {
// The X knob of a resize gizmo. Maybe it'll be a 2D mesh, or something compound...
});
});
});
} The first parameter passed to
Alternative syntax: fn edit_system(edit: YoleckEdit<Example>) {
edit.edit(|ctx, data, ui| {
{
let (ctx, cmd) = ctx.knob("width");
// do knob stuff
}
});
} This syntax is uglier but more powerful. I don't think the first syntax is necessary though - knobs will mostly be created via helpers, which will benefit from the second syntax's power and will be able to hide its ugliness. |
I also think knobs need to have a "selected" status. Less important for gizmos, but this supports e.g. editing an enemy's patrol, so we want to allow selecting a path node so one could configure it in the egui frame. |
e.g. - handles the editor can interact with
The text was updated successfully, but these errors were encountered: