mirror of
https://github.com/italicsjenga/mini_gl_fb.git
synced 2024-11-22 07:21:30 +11:00
Remove dependency on Config for init_glutin_context
This commit is contained in:
parent
f23f653413
commit
6a99711833
14
src/core.rs
14
src/core.rs
|
@ -1,4 +1,3 @@
|
|||
use config::Config;
|
||||
use breakout::GlutinBreakout;
|
||||
|
||||
use rustic_gl;
|
||||
|
@ -20,14 +19,19 @@ use gl::types::*;
|
|||
use std::ptr::null;
|
||||
|
||||
/// Create a context using glutin given a configuration.
|
||||
pub fn init_glutin_context<S: ToString>(config: &Config<S>) -> (EventsLoop, GlWindow) {
|
||||
let window_size = LogicalSize::new(config.window_size.0, config.window_size.1);
|
||||
pub fn init_glutin_context<S: ToString>(
|
||||
window_title: S,
|
||||
window_width: f64,
|
||||
window_height: f64,
|
||||
resizable: bool,
|
||||
) -> (EventsLoop, GlWindow) {
|
||||
let window_size = LogicalSize::new(window_width, window_height);
|
||||
|
||||
let events_loop = EventsLoop::new();
|
||||
let window = WindowBuilder::new()
|
||||
.with_title(config.window_title.to_string())
|
||||
.with_title(window_title.to_string())
|
||||
.with_dimensions(window_size)
|
||||
.with_resizable(config.resizable);
|
||||
.with_resizable(resizable);
|
||||
|
||||
let context = ContextBuilder::new();
|
||||
let gl_window = GlWindow::new(window, context, &events_loop).unwrap();
|
||||
|
|
|
@ -110,7 +110,12 @@ pub fn get_fancy<S: ToString>(config: Config<S>) -> MiniGlFb {
|
|||
let buffer_height = if config.buffer_size.1 == 0 { config.window_size.1.round() as _ }
|
||||
else { config.buffer_size.1 };
|
||||
|
||||
let (events_loop, gl_window) = core::init_glutin_context(&config);
|
||||
let (events_loop, gl_window) = core::init_glutin_context(
|
||||
config.window_title,
|
||||
config.window_size.0,
|
||||
config.window_size.1,
|
||||
config.resizable,
|
||||
);
|
||||
|
||||
let dpi_factor = gl_window.get_hidpi_factor();
|
||||
let (vp_width, vp_height) = gl_window.get_inner_size()
|
||||
|
|
Loading…
Reference in a new issue