Commit 527e95c7 authored by Mathieu Nivoliez's avatar Mathieu Nivoliez
Browse files

add gfx

parent f8da3a79
Pipeline #283 failed with stages
in 2 minutes and 23 seconds
......@@ -3,3 +3,6 @@ authors = ["Mathieu Nivoliez <mathieu.nivoliez@laposte.net>"]
name = "DeepVox"
version = "0.1.0"
[dependencies]
gfx = "0.16"
gfx_window_glutin = "0.16"
glutin = "0.8"
fn main() {
println!("Blank again");
#[macro_use] extern crate gfx;
extern crate gfx_window_glutin;
extern crate glutin;
use gfx::traits::FactoryExt;
use gfx::Device;
use gfx_window_glutin as gfx_glutin;
pub type ColorFormat = gfx::format::Srgba8;
pub type DepthFormat = gfx::format::DepthStencil;
const BLACK: [f32; 4] = [0.0, 0.0, 0.0, 1.0];
pub fn main() {
let events_loop = glutin::EventsLoop::new();
let builder = glutin::WindowBuilder::new()
.with_title("Square Toy".to_string())
.with_dimensions(800, 800)
.with_vsync();
let (window, mut device, mut factory, mut main_color, mut main_depth) =
gfx_glutin::init::<ColorFormat, DepthFormat>(builder, &events_loop);
let mut encoder: gfx::Encoder<_, _> = factory.create_command_buffer().into();
let mut running = true;
while running {
events_loop.poll_events(|glutin::Event::WindowEvent{window_id: _, event}| {
use glutin::WindowEvent::*;
match event {
KeyboardInput(_, _, Some(glutin::VirtualKeyCode::Escape), _)
| Closed => running = false,
Resized(_, _) => {
gfx_glutin::update_views(&window, &mut main_color, &mut main_depth);
},
_ => (),
}
});
encoder.clear(&main_color, BLACK);
encoder.flush(&mut device);
window.swap_buffers().unwrap();
device.cleanup();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment