bevy/crates/bevy_window/src/event.rs

50 lines
1.2 KiB
Rust
Raw Normal View History

2020-04-19 19:13:04 +00:00
use super::{WindowDescriptor, WindowId};
use bevy_math::Vec2;
2020-04-19 19:13:04 +00:00
/// A window event that is sent whenever a window has been resized.
#[derive(Debug, Clone)]
pub struct WindowResized {
pub id: WindowId,
pub width: usize,
pub height: usize,
2020-04-19 19:13:04 +00:00
}
/// An event that indicates that a new window should be created.
#[derive(Debug, Clone)]
pub struct CreateWindow {
pub id: WindowId,
2020-04-19 19:13:04 +00:00
pub descriptor: WindowDescriptor,
}
/// An event that indicates a window should be closed.
#[derive(Debug, Clone)]
pub struct CloseWindow {
pub id: WindowId,
}
/// An event that is sent whenever a new window is created.
#[derive(Debug, Clone)]
pub struct WindowCreated {
pub id: WindowId,
}
/// An event that is sent whenever a close was requested for a window. For example: when the "close" button
/// is pressed on a window.
#[derive(Debug, Clone)]
pub struct WindowCloseRequested {
pub id: WindowId,
2020-04-25 01:55:15 +00:00
}
#[derive(Debug, Clone)]
pub struct CursorMoved {
2020-06-15 19:47:35 +00:00
pub id: WindowId,
pub position: Vec2,
2020-06-15 19:47:35 +00:00
}
/// An event that is sent whenever a window receives a character from the OS or underlying system.
#[derive(Debug, Clone)]
pub struct ReceivedCharacter {
pub id: WindowId,
pub char: char,
}