Made glfw window creation use a proper builder pattern

The main reason I changed this stuff yet again is that I tried to actually used it, and found it to be too restricted in practice. ;)

Specifically, with the previous `create_default_window()` it was impossible to add additional window hints to glfw, like for example making the window re-sizable.

With the new design, you can specify common window hints that should be applied regardless of which setup lead to an window creation, and you can also add custom fallbacks before and after the provided shortcut function.
I don't particularly care.


On Sat, Jul 12, 2014 at 11:32 AM, Marvin Löbel <notifications@github.com>
wrote:

> In src/glfw_platform/lib.rs:
>
> > +    -> WindowBuilder<'glfw, 'title, 'monitor> {
> > +        self.mode = Some(mode);
> > +        self
> > +    }
> > +
> > +    /// Adds a list of `WindowHint`s to try creating a window with.
> > +    ///
> > +    /// If multiple `try_hints()` calls are present, then only one of them
> > +    /// will be applied (the first that lead to a successful window creation).
> > +    ///
> > +    /// This method works in combination with `common_hints()` to create
> > +    /// a list of fallback window configurations to try initializing with.
> > +    /// For details, see `create()`.
> > +    pub fn try_hints(mut self, hints: &[glfw::WindowHint])
> > +    -> WindowBuilder<'glfw, 'title, 'monitor> {
> > +        self.try_hints.push(hints.iter().map(|&x| x).collect());
>
> It could, but that would make the invocation more verbose:
>
> .try_hints(vec![
>     ...])`
>
> Seeing how the WindowHints are copyable anyway, the &[] does seem like a
> particular less efficient way to do it.
>
> If you think it would be cleaner with vec![] anyway, I can change it.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/bjz/gfx-rs/pull/94/files#r14854695>.
>



-- 
http://octayn.net/