Actually make a window!
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
/target
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
|
||||
@@ -9,5 +9,6 @@ path = "src/main.rs"
|
||||
name = "example"
|
||||
|
||||
[dependencies]
|
||||
glutin = "^0.19.0"
|
||||
log = "^0.4.6"
|
||||
simplelog = "^0.5.3"
|
||||
|
||||
13
src/lib.rs
13
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<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(())
|
||||
}
|
||||
Reference in New Issue
Block a user