diff options
Diffstat (limited to 'source/dw/app/inigfx.rs')
-rw-r--r-- | source/dw/app/inigfx.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/dw/app/inigfx.rs b/source/dw/app/inigfx.rs index 9760ded..5444b10 100644 --- a/source/dw/app/inigfx.rs +++ b/source/dw/app/inigfx.rs @@ -1,11 +1,13 @@ // Copyright 2023 Gabriel Jensen. -use crate::dw::app::{App,Gfx}; +use crate::dw::VER; +use crate::dw::app::{App, Gfx}; extern crate gl; extern crate glfw; -use glfw::{Context}; +use gl::load_with; +use glfw::{Context, SwapInterval}; use std::ffi::c_void; impl App { @@ -14,17 +16,19 @@ impl App { let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap(); eprintln!("creating window"); - glfw.window_hint(glfw::WindowHint::ContextVersion(0x3,0x2)); + glfw.window_hint(glfw::WindowHint::ContextVersion(0x3, 0x2)); glfw.window_hint(glfw::WindowHint::OpenGlProfile(glfw::OpenGlProfileHint::Core)); glfw.window_hint(glfw::WindowHint::Samples(Some(0x8))); - let (mut win,evt) = glfw.create_window(0x400,0x300,"dw",glfw::WindowMode::Windowed).expect("unable to create window"); + let (mut win, evt) = glfw.create_window(0x400, 0x300, format!("DeltaWorld {}.{}.{}", VER.maj, VER.min, VER.pat).as_str(), glfw::WindowMode::Windowed).expect("unable to create window"); win.set_key_polling(true); win.make_current(); eprintln!("initialising opengl"); - gl::load_with(|nam| glfw.get_proc_address_raw(nam) as *const c_void); + load_with(|nam| glfw.get_proc_address_raw(nam) as *const c_void); + + glfw.set_swap_interval(SwapInterval::Sync(0x1)); let shdprg = self.getshdprg(); |