Format everything and add rustfmt to travis (#951)
* Format everything and add rustfmt to travis * Remove extern crate winit from examples and add force_multiline_blocks * Format the code properly * Fix inconsistent period in PULL_REQUEST_TEMPLATE.md * Only run rustfmt on nightly * Travis fixings
This commit is contained in:
parent
b1b5aefc4b
commit
e2c84725de
109 changed files with 4787 additions and 3679 deletions
|
|
@ -1,8 +1,8 @@
|
|||
extern crate winit;
|
||||
|
||||
use winit::window::{WindowBuilder, CursorIcon};
|
||||
use winit::event::{Event, WindowEvent, ElementState, KeyboardInput};
|
||||
use winit::event_loop::{EventLoop, ControlFlow};
|
||||
use winit::{
|
||||
event::{ElementState, Event, KeyboardInput, WindowEvent},
|
||||
event_loop::{ControlFlow, EventLoop},
|
||||
window::{CursorIcon, WindowBuilder},
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let event_loop = EventLoop::new();
|
||||
|
|
@ -14,7 +14,18 @@ fn main() {
|
|||
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
match event {
|
||||
Event::WindowEvent { event: WindowEvent::KeyboardInput { input: KeyboardInput { state: ElementState::Pressed, .. }, .. }, .. } => {
|
||||
Event::WindowEvent {
|
||||
event:
|
||||
WindowEvent::KeyboardInput {
|
||||
input:
|
||||
KeyboardInput {
|
||||
state: ElementState::Pressed,
|
||||
..
|
||||
},
|
||||
..
|
||||
},
|
||||
..
|
||||
} => {
|
||||
println!("Setting cursor to \"{:?}\"", CURSORS[cursor_idx]);
|
||||
window.set_cursor_icon(CURSORS[cursor_idx]);
|
||||
if cursor_idx < CURSORS.len() - 1 {
|
||||
|
|
@ -23,26 +34,52 @@ fn main() {
|
|||
cursor_idx = 0;
|
||||
}
|
||||
},
|
||||
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => {
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::CloseRequested,
|
||||
..
|
||||
} => {
|
||||
*control_flow = ControlFlow::Exit;
|
||||
return;
|
||||
},
|
||||
_ => ()
|
||||
_ => (),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const CURSORS: &[CursorIcon] = &[
|
||||
CursorIcon::Default, CursorIcon::Crosshair, CursorIcon::Hand,
|
||||
CursorIcon::Arrow, CursorIcon::Move, CursorIcon::Text,
|
||||
CursorIcon::Wait, CursorIcon::Help, CursorIcon::Progress,
|
||||
CursorIcon::NotAllowed, CursorIcon::ContextMenu, CursorIcon::Cell,
|
||||
CursorIcon::VerticalText, CursorIcon::Alias, CursorIcon::Copy,
|
||||
CursorIcon::NoDrop, CursorIcon::Grab, CursorIcon::Grabbing,
|
||||
CursorIcon::AllScroll, CursorIcon::ZoomIn, CursorIcon::ZoomOut,
|
||||
CursorIcon::EResize, CursorIcon::NResize, CursorIcon::NeResize,
|
||||
CursorIcon::NwResize, CursorIcon::SResize, CursorIcon::SeResize,
|
||||
CursorIcon::SwResize, CursorIcon::WResize, CursorIcon::EwResize,
|
||||
CursorIcon::NsResize, CursorIcon::NeswResize, CursorIcon::NwseResize,
|
||||
CursorIcon::ColResize, CursorIcon::RowResize
|
||||
CursorIcon::Default,
|
||||
CursorIcon::Crosshair,
|
||||
CursorIcon::Hand,
|
||||
CursorIcon::Arrow,
|
||||
CursorIcon::Move,
|
||||
CursorIcon::Text,
|
||||
CursorIcon::Wait,
|
||||
CursorIcon::Help,
|
||||
CursorIcon::Progress,
|
||||
CursorIcon::NotAllowed,
|
||||
CursorIcon::ContextMenu,
|
||||
CursorIcon::Cell,
|
||||
CursorIcon::VerticalText,
|
||||
CursorIcon::Alias,
|
||||
CursorIcon::Copy,
|
||||
CursorIcon::NoDrop,
|
||||
CursorIcon::Grab,
|
||||
CursorIcon::Grabbing,
|
||||
CursorIcon::AllScroll,
|
||||
CursorIcon::ZoomIn,
|
||||
CursorIcon::ZoomOut,
|
||||
CursorIcon::EResize,
|
||||
CursorIcon::NResize,
|
||||
CursorIcon::NeResize,
|
||||
CursorIcon::NwResize,
|
||||
CursorIcon::SResize,
|
||||
CursorIcon::SeResize,
|
||||
CursorIcon::SwResize,
|
||||
CursorIcon::WResize,
|
||||
CursorIcon::EwResize,
|
||||
CursorIcon::NsResize,
|
||||
CursorIcon::NeswResize,
|
||||
CursorIcon::NwseResize,
|
||||
CursorIcon::ColResize,
|
||||
CursorIcon::RowResize,
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue