[][src]Function gfx_window_sdl::init

pub fn init<Cf, Df>(
    video_subsystem: &VideoSubsystem,
    builder: WindowBuilder
) -> Result<InitOk<Cf, Df>, InitError> where
    Cf: RenderFormat,
    Df: DepthFormat

Builds an SDL2 window from a WindowBuilder struct.

Example

extern crate gfx_core;
extern crate gfx_window_sdl;
extern crate sdl2;

use gfx_core::format::{DepthStencil, Rgba8};

fn main() {
    let sdl = sdl2::init().unwrap();
    let video = sdl.video().unwrap();

    let builder = video.window("Example", 800, 600);
    let (window, glcontext, device, factory, color_view, depth_view) =
        gfx_window_sdl::init::<Rgba8, DepthStencil>(&video, builder)
        .expect("gfx_window_sdl::init failed!");

    // some code...
}