refactor view/scene to separate modules
This commit is contained in:
40
src/bin/vrtue.rs
Normal file
40
src/bin/vrtue.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
extern crate vrtue;
|
||||
use vrtue::{view, vr};
|
||||
|
||||
extern crate env_logger;
|
||||
extern crate gfx_device_gl;
|
||||
#[macro_use] extern crate log;
|
||||
extern crate piston_window;
|
||||
|
||||
use self::piston_window::{PistonWindow, Window, WindowSettings};
|
||||
|
||||
pub fn main() {
|
||||
env_logger::init().expect("env logger");
|
||||
let mut vr = vr::VR::new().expect("VR init");
|
||||
|
||||
let mut window: PistonWindow =
|
||||
WindowSettings::new("Hello Virtual World!", [512; 2])
|
||||
.exit_on_esc(true)
|
||||
.vsync(false)
|
||||
.build().expect("Building Window");
|
||||
|
||||
let view = view::ViewRoot::<gfx_device_gl::Device,
|
||||
view::ColorFormat,
|
||||
view::DepthFormat>::create_view(&mut window, &mut vr);
|
||||
|
||||
'main:
|
||||
//while let Some(_) = window.next() {
|
||||
loop {
|
||||
view.draw(&mut window, &mut vr);
|
||||
|
||||
// handle window events
|
||||
while let Some(ev) = window.poll_event() {
|
||||
match ev {
|
||||
piston_window::Input::Text(_) => break 'main,
|
||||
_ => debug!("\t{:?}", ev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
debug!("shutting down");
|
||||
}
|
||||
Reference in New Issue
Block a user