Start with an initial draft
This commit is contained in:
commit
6f71824857
7 changed files with 160 additions and 0 deletions
28
examples/basic.rs
Normal file
28
examples/basic.rs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
use window_clipboard::Clipboard;
|
||||
use winit::{
|
||||
event::{Event, WindowEvent},
|
||||
event_loop::{ControlFlow, EventLoop},
|
||||
window::WindowBuilder,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let event_loop = EventLoop::new();
|
||||
|
||||
let window = WindowBuilder::new()
|
||||
.with_title("A fantastic window!")
|
||||
.build(&event_loop)
|
||||
.unwrap();
|
||||
|
||||
let clipboard = Clipboard::new(&window).expect("Create clipboard");
|
||||
|
||||
event_loop.run(move |event, _, control_flow| match event {
|
||||
Event::EventsCleared => {
|
||||
println!("{:?}", clipboard.read());
|
||||
}
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::CloseRequested,
|
||||
window_id,
|
||||
} if window_id == window.id() => *control_flow = ControlFlow::Exit,
|
||||
_ => *control_flow = ControlFlow::Wait,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue