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

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/target /target
**/*.rs.bk **/*.rs.bk
Cargo.lock

View File

@@ -9,5 +9,6 @@ path = "src/main.rs"
name = "example" name = "example"
[dependencies] [dependencies]
glutin = "^0.19.0"
log = "^0.4.6" log = "^0.4.6"
simplelog = "^0.5.3" simplelog = "^0.5.3"

View File

@@ -1,8 +1,13 @@
extern crate glutin;
extern crate log; extern crate log;
pub mod errors; pub mod errors;
use glutin::{ContextBuilder,ControlFlow,EventsLoop,GlWindow,WindowBuilder};
use glutin::dpi::LogicalSize;
use self::errors::TUIGUIError; use self::errors::TUIGUIError;
use std::sync::mpsc::channel;
use std::thread;
pub type Widget = (); pub type Widget = ();
pub type Attribute = (); pub type Attribute = ();
@@ -19,6 +24,14 @@ pub trait Application {
pub fn tuigui<App: Application>(mut a: App) -> Result<(), TUIGUIError> 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(); a.starting();
Ok(()) Ok(())
} }