From a3c6970a50a3c769aebce2bcb17cd9d9febe4354 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Tue, 28 Jan 2025 12:05:07 -0500 Subject: Move to GLFW for transparent clickthrough overlay --- src/context.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/context.rs') diff --git a/src/context.rs b/src/context.rs index ca3ebe3..05d6990 100644 --- a/src/context.rs +++ b/src/context.rs @@ -14,10 +14,11 @@ extern { pub struct Context { pub render_width: f32, pub render_height: f32, - pub window: sdl2::video::Window, + pub glfw: std::cell::RefCell, + pub window: std::cell::RefCell, pub gl: glow::Context, pub emptyvao: glow::VertexArray, - pub timer: sdl2::TimerSubsystem, + pub start_instant: std::time::Instant, } @@ -46,16 +47,16 @@ impl Context { } #[cfg(not(target_arch = "wasm32"))] - pub fn new(sdl: sdl2::Sdl, window: sdl2::video::Window, gl: glow::Context, render_width: f32, render_height: f32) -> Self { + pub fn new(glfw: std::cell::RefCell, window: std::cell::RefCell, gl: glow::Context, render_width: f32, render_height: f32) -> Self { let emptyvao = unsafe { gl.create_vertex_array().expect("failed to initialize vao") }; let ret = Self { render_width, render_height, - window, + glfw, window, gl, emptyvao, - timer: sdl.timer().expect("failed to initialize timer subsystem"), + start_instant: std::time::Instant::now(), }; ret.init(); ret -- cgit v1.2.3