From 584df5518b8de0ed750ce936fd2ccce461ab2ee4 Mon Sep 17 00:00:00 2001 From: Alula <6276139+alula@users.noreply.github.com> Date: Sun, 27 Jun 2021 03:29:48 +0200 Subject: [PATCH] fix an imgui rendering issue on sdl2 backend --- src/framework/backend_sdl2.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/framework/backend_sdl2.rs b/src/framework/backend_sdl2.rs index a5b1316..3fd5942 100644 --- a/src/framework/backend_sdl2.rs +++ b/src/framework/backend_sdl2.rs @@ -377,6 +377,7 @@ impl BackendRenderer for SDL2Renderer { let mut refs = self.refs.borrow_mut(); refs.canvas.set_draw_color(to_sdl(color)); + refs.canvas.set_blend_mode(sdl2::render::BlendMode::Blend); refs.canvas.clear(); } @@ -388,6 +389,15 @@ impl BackendRenderer for SDL2Renderer { Ok(()) } + fn prepare_draw(&mut self, width: f32, height: f32) -> GameResult { + let mut refs = self.refs.borrow_mut(); + + refs.canvas.set_clip_rect(Some(sdl2::rect::Rect::new(0, 0, width as u32, height as u32, ))); + //refs.canvas.set_clip_rect(None); + + Ok(()) + } + fn create_texture_mutable(&mut self, width: u16, height: u16) -> GameResult> { let refs = self.refs.borrow_mut();