From 6a99711833e1db02d6151f8f0ade1c2e2b5294bd Mon Sep 17 00:00:00 2001 From: shivshank Date: Fri, 27 Jul 2018 17:56:41 -0400 Subject: [PATCH] Remove dependency on Config for init_glutin_context --- src/core.rs | 14 +++++++++----- src/lib.rs | 7 ++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/core.rs b/src/core.rs index d5e2ab9..5369619 100644 --- a/src/core.rs +++ b/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(config: &Config) -> (EventsLoop, GlWindow) { - let window_size = LogicalSize::new(config.window_size.0, config.window_size.1); +pub fn init_glutin_context( + 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(); diff --git a/src/lib.rs b/src/lib.rs index cbc7887..f19acde 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,7 +110,12 @@ pub fn get_fancy(config: Config) -> 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()