Joe232
February 4, 2023, 8:11am
1
Using egui:
I have a question:
egui::Window::new("Projects")
.fixed_pos(egui::pos2(0f32, 0f32))
.fixed_size(egui::vec2(1920f32, 1080f32))
.open(&mut open_projects)
.show(ctx, |ui|
I have this code but it always draws the exact small window no matter what the allocated fixed_size
is.
Can somebody please advise me what I should do to change the size of the window?
vague
February 4, 2023, 8:55am
2
Refer to Window in egui::containers - Rust
-.fixed_size(egui::vec2(1920f32, 1080f32))
+.default_size(egui::vec2(1920f32, 1080f32))
+.resizable(true)
Joe232
February 4, 2023, 9:37am
3
It says for fixed_size()
Sets the window size and prevents it from being resized by dragging its edges.
Which is what I want, I don't want it to be resizable. So how come the screensize is not right though still?
noclck
February 4, 2023, 9:41am
4
I have the exact same problem. No matter I tried default_size(...)
, min_width(...)
or fixed_size(...)
it doesn't work. I got the impression that it goes to default size anyway
1 Like
It looks like the issue linked by @vague is probably the issue, but one thing you might try putting this at top of the code inside the window:
ui.set_width(ui.available_width());
ui.set_height(ui.available_height());
I think I've done something like this before, but haven't tested and it might not work.
3 Likes
Joe232
February 4, 2023, 11:59pm
7
zicklag:
It looks like the issue linked by @vague is probably the issue, but one thing you might try putting this at top of the code inside the window:
ui.set_width(ui.available_width());
ui.set_height(ui.available_height());
Where do I exactly put it over here:
egui::Window::new("Projects")
.fixed_pos(egui::pos2(0f32, 0f32))
.fixed_size(egui::vec2(1920f32, 1080f32))
.open(&mut open_projects)
.show(ctx, |ui|
?
Joe232
February 5, 2023, 12:22am
8
Anyways it works thank you
2 Likes