diff options
Diffstat (limited to 'src/api/caca')
-rw-r--r-- | src/api/caca/mod.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/api/caca/mod.rs b/src/api/caca/mod.rs index 3b4018e..c1a19c7 100644 --- a/src/api/caca/mod.rs +++ b/src/api/caca/mod.rs @@ -5,14 +5,16 @@ use libc; use api::osmesa::{OsMesaContext, OsMesaCreationError}; use Api; -use BuilderAttribs; use ContextError; use CreationError; use Event; +use GlAttributes; use GlContext; use PixelFormat; +use PixelFormatRequirements; use CursorState; use MouseCursor; +use WindowAttributes; use std::collections::VecDeque; use std::path::Path; @@ -84,8 +86,14 @@ impl<'a> Iterator for WaitEventsIterator<'a> { } impl Window { - pub fn new(builder: BuilderAttribs) -> Result<Window, CreationError> { - let opengl = match OsMesaContext::new(builder) { + pub fn new(window: &WindowAttributes, pf_reqs: &PixelFormatRequirements, + opengl: &GlAttributes<&Window>) -> Result<Window, CreationError> + { + let opengl = opengl.clone().map_sharing(|w| &w.opengl); + + let opengl = match OsMesaContext::new(window.dimensions.unwrap_or((800, 600)), pf_reqs, + &opengl) + { Err(OsMesaCreationError::NotSupported) => return Err(CreationError::NotSupported), Err(OsMesaCreationError::CreationError(e)) => return Err(e), Ok(c) => c |