Skip to content
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

Sensible default widgets #18

Open
germangb opened this issue Nov 12, 2019 · 0 comments
Open

Sensible default widgets #18

germangb opened this issue Nov 12, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@germangb
Copy link
Owner

germangb commented Nov 12, 2019

At the moment, the default widget is a label, which means that if you don't specify a widget type inside an annotation, that particular struct field is rendered as a text label (provided it implements Display), which is not interactive.

The idea is to define the following default widgets for each type:

rust type default widget remarks
i32, u32, f32, [f32; 2], (f32, f32) etc... input
bool checkbox
String, ImString input String might need an extra allocation, which is not desirable

NOTE: Table not definitive

This way you can save a few keystrokes:

#[derive(imgui_ext::Gui)]
struct Example {
    #[imgui(checkbox)]
    a: bool,
    #[imgui(input)]
    b: [f32; 2],
}

// would become equivalent to:

#[derive(imgui_ext::Gui)]
struct Example {
    #[imgui]
    a: bool,
    #[imgui]
    b: [f32; 2],
}
@germangb germangb added the enhancement New feature or request label Nov 12, 2019
@germangb germangb changed the title Sensible defaults Sensible default widgets Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant