diff --git a/imgui-examples/examples/support_gfx/mod.rs b/imgui-examples/examples/support_gfx/mod.rs index 9e4226b..11605be 100644 --- a/imgui-examples/examples/support_gfx/mod.rs +++ b/imgui-examples/examples/support_gfx/mod.rs @@ -34,14 +34,12 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ } else { Shaders::GlSlEs100 } + } else if version.major >= 4 { + Shaders::GlSl400 + } else if version.major >= 3 { + Shaders::GlSl130 } else { - if version.major >= 4 { - Shaders::GlSl400 - } else if version.major >= 3 { - Shaders::GlSl130 - } else { - Shaders::GlSl110 - } + Shaders::GlSl110 } }; @@ -141,7 +139,7 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ break; } - encoder.clear(&mut main_color, clear_color); + encoder.clear(&main_color, clear_color); renderer.render(ui, &mut factory, &mut encoder).expect( "Rendering failed", ); diff --git a/imgui-examples/examples/test_window_impl.rs b/imgui-examples/examples/test_window_impl.rs index 9329449..a877536 100644 --- a/imgui-examples/examples/test_window_impl.rs +++ b/imgui-examples/examples/test_window_impl.rs @@ -432,7 +432,7 @@ fn show_test_window<'a>(ui: &Ui<'a>, state: &mut State, opened: &mut bool) { }); ui.tree_node(im_str!("Color/Picker Widgets")).build(|| { - let ref mut s = state.color_edit; + let s = &mut state.color_edit; ui.checkbox(im_str!("With HDR"), &mut s.hdr); ui.same_line(0.0); show_help_marker(ui, im_str!("Currently all this does is to lift the 0..1 limits on dragging widgets.")); @@ -531,7 +531,7 @@ fn show_test_window<'a>(ui: &Ui<'a>, state: &mut State, opened: &mut bool) { } ui.same_line(0.0); ui.text(match state.selected_fish { - Some(index) => names[index].clone(), + Some(index) => names[index], None => im_str!(""), }); ui.popup(im_str!("select"), || { @@ -539,7 +539,7 @@ fn show_test_window<'a>(ui: &Ui<'a>, state: &mut State, opened: &mut bool) { ui.separator(); for (index, name) in names.iter().enumerate() { if ui.selectable( - name.clone(), + name, false, ImGuiSelectableFlags::empty(), ImVec2::new(0.0, 0.0), diff --git a/imgui-gfx-renderer/src/lib.rs b/imgui-gfx-renderer/src/lib.rs index f3c5dfe..ce87a29 100644 --- a/imgui-gfx-renderer/src/lib.rs +++ b/imgui-gfx-renderer/src/lib.rs @@ -173,7 +173,7 @@ impl Renderer { ]; ui.render(|ui, draw_list| { - self.render_draw_list(ui, factory, encoder, draw_list) + self.render_draw_list(ui, factory, encoder, &draw_list) }) } fn render_draw_list<'a, F: Factory, C: CommandBuffer>( @@ -181,7 +181,7 @@ impl Renderer { ui: &'a Ui<'a>, factory: &mut F, encoder: &mut Encoder, - draw_list: DrawList<'a>, + draw_list: &DrawList<'a>, ) -> RendererResult<()> { let (scale_width, scale_height) = ui.imgui().display_framebuffer_scale(); diff --git a/imgui-glium-renderer/src/lib.rs b/imgui-glium-renderer/src/lib.rs index 1cb24a7..b24af57 100644 --- a/imgui-glium-renderer/src/lib.rs +++ b/imgui-glium-renderer/src/lib.rs @@ -66,7 +66,7 @@ impl Renderer { pub fn init(imgui: &mut ImGui, ctx: &F) -> RendererResult { let device_objects = try!(DeviceObjects::init(imgui, ctx)); Ok(Renderer { - ctx: ctx.get_context().clone(), + ctx: Rc::clone(ctx.get_context()), device_objects: device_objects, }) } @@ -74,7 +74,7 @@ impl Renderer { pub fn render<'a, S: Surface>(&mut self, surface: &mut S, ui: Ui<'a>) -> RendererResult<()> { let _ = self.ctx.insert_debug_marker("imgui-rs: starting rendering"); let result = ui.render(|ui, draw_list| { - self.render_draw_list(surface, ui, draw_list) + self.render_draw_list(surface, ui, &draw_list) }); let _ = self.ctx.insert_debug_marker("imgui-rs: rendering finished"); result @@ -84,7 +84,7 @@ impl Renderer { &mut self, surface: &mut S, ui: &'a Ui<'a>, - draw_list: DrawList<'a>, + draw_list: &DrawList<'a>, ) -> RendererResult<()> { use glium::{Blend, DrawParameters, Rect}; use glium::uniforms::{MinifySamplerFilter, MagnifySamplerFilter}; diff --git a/imgui-sys/src/lib.rs b/imgui-sys/src/lib.rs index 74ea476..1580aeb 100644 --- a/imgui-sys/src/lib.rs +++ b/imgui-sys/src/lib.rs @@ -184,7 +184,7 @@ bitflags!( /// Window flags #[repr(C)] pub struct ImGuiWindowFlags: c_int { - const NoTitleBar = 1 << 0; + const NoTitleBar = 1; const NoResize = 1 << 1; const NoMove = 1 << 2; const NoScrollbar = 1 << 3; @@ -273,7 +273,7 @@ bitflags!( /// Condition flags #[repr(C)] pub struct ImGuiCond: c_int { - const Always = 1 << 0; + const Always = 1; const Once = 1 << 1; const FirstUseEver = 1 << 2; const Appearing = 1 << 3; @@ -296,7 +296,7 @@ bitflags!( #[repr(C)] pub struct ImGuiColumnsFlags: c_int { /// Disable column dividers - const NoBorder = 1 << 0; + const NoBorder = 1; /// Disable resizing columns when clicking on the dividers const NoResize = 1 << 1; /// Disable column width preservation when adjusting columns @@ -310,7 +310,7 @@ bitflags!( /// Flags for text inputs #[repr(C)] pub struct ImGuiInputTextFlags: c_int { - const CharsDecimal = 1 << 0; + const CharsDecimal = 1; const CharsHexadecimal = 1 << 1; const CharsUppercase = 1 << 2; const CharsNoBlank = 1 << 3; @@ -383,7 +383,7 @@ bitflags!( /// Flags for selectables #[repr(C)] pub struct ImGuiSelectableFlags: c_int { - const DontClosePopups = 1 << 0; + const DontClosePopups = 1; const SpanAllColumns = 1 << 1; const AllowDoubleClick = 1 << 2; } @@ -403,7 +403,7 @@ bitflags!( /// Flags for trees and collapsing headers #[repr(C)] pub struct ImGuiTreeNodeFlags: c_int { - const Selected = 1 << 0; + const Selected = 1; const Framed = 1 << 1; const AllowOverlapMode = 1 << 2; const NoTreePushOnOpen = 1 << 3;