bevy/crates/bevy_window/src/event.rs
TheRawMeatball 3cb2e22e89
Added use_dpi setting to WindowDescriptor (#1131)
Added scale_factor_override
2020-12-28 14:26:50 -06:00

79 lines
1.9 KiB
Rust

use super::{WindowDescriptor, WindowId};
use bevy_math::Vec2;
/// A window event that is sent whenever a window has been resized.
#[derive(Debug, Clone)]
pub struct WindowResized {
pub id: WindowId,
pub width: f32,
pub height: f32,
}
/// An event that indicates that a new window should be created.
#[derive(Debug, Clone)]
pub struct CreateWindow {
pub id: WindowId,
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,
}
#[derive(Debug, Clone)]
pub struct CursorMoved {
pub id: WindowId,
pub position: Vec2,
}
#[derive(Debug, Clone)]
pub struct CursorEntered {
pub id: WindowId,
}
#[derive(Debug, Clone)]
pub struct CursorLeft {
pub id: WindowId,
}
/// 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,
}
/// An event that indicates a window has received or lost focus.
#[derive(Debug, Clone)]
pub struct WindowFocused {
pub id: WindowId,
pub focused: bool,
}
/// An event that indicates a window's scale factor has changed.
#[derive(Debug, Clone)]
pub struct WindowScaleFactorChanged {
pub id: WindowId,
pub scale_factor: f64,
}
/// An event that indicates a window's OS-reported scale factor has changed.
#[derive(Debug, Clone)]
pub struct WindowBackendScaleFactorChanged {
pub id: WindowId,
pub scale_factor: f64,
}