Actually make a window!
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
Cargo.lock
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
13
src/lib.rs
13
src/lib.rs
@@ -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(())
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user