diff --git a/src/trekstor.rs b/src/trekstor.rs index 1b1bf81..7519040 100644 --- a/src/trekstor.rs +++ b/src/trekstor.rs @@ -45,6 +45,9 @@ impl Platform for Trekstor { let mut buffer1 = [Rgba::from((0, 0, 0, 0)); 614400]; + let window_width = ctx.screen.width(); + let window_height = ctx.screen.height(); + loop { ctx.input.handle_event(); @@ -70,19 +73,19 @@ impl Platform for Trekstor { self.window.draw_if_needed(|renderer| { dbg!("Rendering"); - renderer.render(&mut buffer1, ctx.screen.width() as usize); + renderer.render(&mut buffer1, window_width as usize); for (i, px) in buffer1.into_iter().enumerate() { - if i > (ctx.screen.width() as usize - 1) { + if i > (window_width as usize - 1) { break; } - let x = (i % ctx.screen.width() as usize) as u32; - let y = (i / ctx.screen.width() as usize) as u32; + let x = (i % window_width as usize) as u32; + let y = (i / window_width as usize) as u32; - if x >= ctx.screen.width() || y >= ctx.screen.height() { - println!("Out of bounds {} {}", x, y); - continue; - } + // if x >= window_width || y >= window_height { + // println!("Out of bounds {} {}", x, y); + // continue; + // } dbg!(x, y, px);