-
Notifications
You must be signed in to change notification settings - Fork 380
Build Window (and ChildWindow) of Ui #521
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
Conversation
Mainly to (hopefully) make it clearer the difference between Once and FirstUseEver
Oh I did try and make this backwards compatible, but I couldn't see a nice way of doing this Problem being:
Only solutions to that I can think of are either:
|
This is a good PR and I like this change. However, I think we should hold off till 0.8.0 is released. It does break code, and just going through a large work project and adapting it to the I'd like 0.9.0 to be virtually entirely changes like this (and I'd also like us to experiment a bit, maybe using What do you think? If you think I'm being overly cautious here, that'd be understandable |
Yep makes sense! 0.8 already looks like it has enough excitement for one release 🥳 |
rebase and let's do it? |
Done 🏃 (well merged instead of rebased as there was a bunch of conflicts which were easier to deal with that way) The new table bindings use the |
Yeah The I use its functionality myself, for example, in various iterators where I'm generating label names dynamically. For example: let my_values = ["hello", "hello", "goodbye"];
for (i, v) in my_values.iter().enumerate() {
// just doing this here will bork, since we'll have two labels of "hello"
// ui.button(v);
// this fella works, but allocates a whole new string per button. wasteful
// ui.button(format!("{}##{}", v, i));
let t = ui.push_id(i);
ui.button(v); // this guy works now, because we've incremented the ID stack, and imgui actually cares about the ENTIRE stack state, not just the current id
drop(t);
} so I'd not want to accept changing |
Ahhh I see! I couldn't see any uses of I think I'll reopen the PR from a new branch with the |
Created #537 |
I've, about twice, started trying to make a PR for #454 before realizing how many things there was, before panicing and
ctrl+z
ing the changes...Thus I've stuck to just the main one,
imgui::Window
as it's commonly used, and most likely the first thing a new user will interact with (e.g it's in the README example)I think this is a good change, it's less typing, and more importantly makes thing more consistent so all methods can (eventually) be found via auto-complete like
ui.something
(e.g I missedimgui::ColorButton
when writing the example of #519 because I couldn't find it on theUi
doc page 🙄 )This is obvious a fairly big breaking change, but.. now seems to be the time for such things! The actual changes should all be pretty simple search-and-replace things
s/Window::new(/ui.window(/
ands/.build(ui, /.build(/
I also did same change for ChildWindow, but also made it it's ID handling consistent with Window, as ChildWindow was about the only thing still using the explicit
imgui::Id
type (now onlyUi::push_id
is.. and I'm tempted to make that take anImStrstr also)