mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Add time as input to emigui to enable animations
This commit is contained in:
@@ -26,6 +26,10 @@ pub struct Style {
|
||||
/// For stuff like check marks in check boxes.
|
||||
pub line_width: f32,
|
||||
|
||||
// TODO: add ability to disable animations!
|
||||
/// How many seconds a typical animation should last
|
||||
pub animation_time: f32,
|
||||
|
||||
pub window: Window,
|
||||
}
|
||||
|
||||
@@ -44,6 +48,7 @@ impl Default for Style {
|
||||
clickable_diameter: 34.0,
|
||||
start_icon_width: 20.0,
|
||||
line_width: 1.0,
|
||||
animation_time: 1.0 / 20.0,
|
||||
window: Window::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ pub struct RawInput {
|
||||
|
||||
/// Also known as device pixel ratio, > 1 for HDPI screens.
|
||||
pub pixels_per_point: f32,
|
||||
|
||||
/// Time in seconds. Relative to whatever. Used for animation.
|
||||
pub time: f64,
|
||||
}
|
||||
|
||||
/// What the gui maintains
|
||||
@@ -46,6 +49,9 @@ pub struct GuiInput {
|
||||
|
||||
/// Also known as device pixel ratio, > 1 for HDPI screens.
|
||||
pub pixels_per_point: f32,
|
||||
|
||||
/// Time in seconds. Relative to whatever. Used for animation.
|
||||
pub time: f64,
|
||||
}
|
||||
|
||||
impl GuiInput {
|
||||
@@ -62,6 +68,7 @@ impl GuiInput {
|
||||
mouse_move,
|
||||
screen_size: new.screen_size,
|
||||
pixels_per_point: new.pixels_per_point,
|
||||
time: new.time,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user