imgui-ggez-starter
imgui-ggez-starter copied to clipboard
Use more recent version of imgui?
Olivia, thank you so much for putting this starter code together! Is there any interest in making it compatible with a more recent imgui API? I changed a few cargo lines as recommended here:
imgui = "0.3.0"
imgui-gfx-renderer = "0.3.0"
imgui-winit-support = "0.3.0"
The compiler reported the following 16 errors:
error[E0061]: this function takes 2 parameters but 3 parameters were supplied --> src\imgui_wrapper.rs:115:21 | 115 | let image = Image::new(&ui, texture_id, [100.0, 100.0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 2 parameters
error[E0599]: no method named window
found for type imgui::Ui<'_>
in the current scope
--> src\imgui_wrapper.rs:118:12
|
118 | ui.window(im_str!("Hello textures"))
| ^^^^^^ method not found in imgui::Ui<'_>
error[E0061]: this function takes 1 parameter but 0 parameters were supplied --> src\imgui_wrapper.rs:122:19 | 122 | image.build(); | ^^^^^ expected 1 parameter
error[E0599]: no method named window
found for type imgui::Ui<'_>
in the current scope
--> src\imgui_wrapper.rs:127:10
|
127 | ui.window(im_str!("Hello world"))
| ^^^^^^ method not found in imgui::Ui<'_>
error[E0599]: no method named menu_item
found for type imgui::Ui<'_>
in the current scope
--> src\imgui_wrapper.rs:149:15
|
149 | if ui.menu_item(im_str!("popup menu item 1")).build() {
| ^^^^^^^^^ method not found in imgui::Ui<'_>
error[E0599]: no method named menu_item
found for type imgui::Ui<'_>
in the current scope
--> src\imgui_wrapper.rs:153:15
|
153 | if ui.menu_item(im_str!("popup menu item 2")).build() {
| ^^^^^^^^^ method not found in imgui::Ui<'_>
error[E0061]: this function takes 3 parameters but 1 parameter was supplied --> src\imgui_wrapper.rs:160:12 | 160 | ui.menu(im_str!("Menu 1")).build(|| { | ^^^^ expected 3 parameters
error[E0599]: no method named build
found for type ()
in the current scope
--> src\imgui_wrapper.rs:160:36
|
160 | ui.menu(im_str!("Menu 1")).build(|| {
| ^^^^^ method not found in ()
error[E0599]: no method named menu_item
found for type imgui::Ui<'_>
in the current scope
--> src\imgui_wrapper.rs:161:17
|
161 | if ui.menu_item(im_str!("Item 1.1")).build() {
| ^^^^^^^^^ method not found in imgui::Ui<'_>
error[E0061]: this function takes 3 parameters but 1 parameter was supplied --> src\imgui_wrapper.rs:165:14 | 165 | ui.menu(im_str!("Item 1.2")).build(|| { | ^^^^ expected 3 parameters
error[E0599]: no method named build
found for type ()
in the current scope
--> src\imgui_wrapper.rs:165:40
|
165 | ui.menu(im_str!("Item 1.2")).build(|| {
| ^^^^^ method not found in ()
error[E0599]: no method named menu_item
found for type imgui::Ui<'_>
in the current scope
--> src\imgui_wrapper.rs:166:19
|
166 | if ui.menu_item(im_str!("Item 1.2.1")).build() {
| ^^^^^^^^^ method not found in imgui::Ui<'_>
error[E0599]: no method named menu_item
found for type imgui::Ui<'_>
in the current scope
--> src\imgui_wrapper.rs:169:19
|
169 | if ui.menu_item(im_str!("Item 1.2.2")).build() {
| ^^^^^^^^^ method not found in imgui::Ui<'_>
error[E0061]: this function takes 3 parameters but 1 parameter was supplied --> src\imgui_wrapper.rs:175:12 | 175 | ui.menu(im_str!("Menu 2")).build(|| { | ^^^^ expected 3 parameters
error[E0599]: no method named build
found for type ()
in the current scope
--> src\imgui_wrapper.rs:175:36
|
175 | ui.menu(im_str!("Menu 2")).build(|| {
| ^^^^^ method not found in ()
error[E0599]: no method named menu_item
found for type imgui::Ui<'_>
in the current scope
--> src\imgui_wrapper.rs:176:17
|
176 | if ui.menu_item(im_str!("Item 2.1")).build() {
| ^^^^^^^^^ method not found in imgui::Ui<'_>
yep, definitely should upgrade to a more recent version. I'll take a look!
@davideps @iolivia imgui v0.4.0 require ui for build, not for new. https://docs.rs/imgui/0.4.0/imgui/struct.Image.html
if let Some(texture_id) = self.texture_id {
let image = Image::new(texture_id, [100.0, 100.0]);
// Window with texture
Window::new(im_str!("Hello textures"))
.size([150.0, 150.0], imgui::Condition::FirstUseEver)
.position([300.0, 150.0], imgui::Condition::FirstUseEver)
.build(&ui, || {
image.build(&ui);
});
}