Actually make a window!

This commit is contained in:
2019-02-28 16:38:34 -08:00
parent 8e8cb40334
commit 6b559a16a2
3 changed files with 15 additions and 0 deletions

View File

@@ -1,8 +1,13 @@
extern crate glutin;
extern crate log;
pub mod errors;
use glutin::{ContextBuilder,ControlFlow,EventsLoop,GlWindow,WindowBuilder};
use glutin::dpi::LogicalSize;
use self::errors::TUIGUIError;
use std::sync::mpsc::channel;
use std::thread;
pub type Widget = ();
pub type Attribute = ();
@@ -19,6 +24,14 @@ pub trait Application {
pub fn tuigui<App: Application>(mut a: App) -> Result<(), TUIGUIError>
{
let mut events_loop = EventsLoop::new();
let window = WindowBuilder::new()
.with_title("Hello world!")
.with_dimensions(LogicalSize::new(1024.0, 768.0));
let context = ContextBuilder::new();
let gl_window = GlWindow::new(window, context, &events_loop).unwrap();
let (sender, receiver) = channel();
events_loop.run_forever(|evt| { sender.send(evt).unwrap(); ControlFlow::Continue } );
a.starting();
Ok(())
}