From 6b559a16a2d8bed536dc19bd13199bbc50015638 Mon Sep 17 00:00:00 2001 From: Adam Wick Date: Thu, 28 Feb 2019 16:38:34 -0800 Subject: [PATCH] Actually make a window! --- .gitignore | 1 + Cargo.toml | 1 + src/lib.rs | 13 +++++++++++++ 3 files changed, 15 insertions(+) diff --git a/.gitignore b/.gitignore index 53eaa21..6936990 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target **/*.rs.bk +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml index 269262b..1dafcea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,5 +9,6 @@ path = "src/main.rs" name = "example" [dependencies] +glutin = "^0.19.0" log = "^0.4.6" simplelog = "^0.5.3" diff --git a/src/lib.rs b/src/lib.rs index 4586b6f..d21323b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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(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(()) } \ No newline at end of file