diff options
| author | LLLL Colonq <llll@colonq> | 2025-01-28 12:05:07 -0500 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2025-01-28 12:06:04 -0500 |
| commit | a3c6970a50a3c769aebce2bcb17cd9d9febe4354 (patch) | |
| tree | 1f1d2940997b9fd5d326b7eb10dcff84c9a7e754 /src/context.rs | |
| parent | 39a0ff935e6298193188d8569ae3cbb96807f34c (diff) | |
Move to GLFW for transparent clickthrough overlay
Diffstat (limited to 'src/context.rs')
| -rw-r--r-- | src/context.rs | 11 |
1 files changed, 6 insertions, 5 deletions
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<glfw::Glfw>, + pub window: std::cell::RefCell<glfw::PWindow>, 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<glfw::Glfw>, window: std::cell::RefCell<glfw::PWindow>, 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 |
