1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 14:20:04 -04:00

Use instant crate in egui-winit for WebAssembly support (#1023)

* Replace `std::time::Instant` with wasm-compatible `instant::Instant`

* Change version requirement for instant to be compatible to winit

* Enable wasm-bindgen feature for instant

* Update lockfile

* Update changelog

* sort dependencies

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
Niklas Korz
2022-01-03 22:13:53 +01:00
committed by GitHub
parent b1fd6a44e8
commit 01015ac94c
5 changed files with 10 additions and 7 deletions

View File

@@ -105,7 +105,7 @@ pub fn screen_size_in_pixels(window: &winit::window::Window) -> egui::Vec2 {
/// Handles the integration between egui and winit.
pub struct State {
start_time: std::time::Instant,
start_time: instant::Instant,
egui_input: egui::RawInput,
pointer_pos_in_points: Option<egui::Pos2>,
any_pointer_button_down: bool,
@@ -137,7 +137,7 @@ impl State {
/// Initialize with a given dpi scaling.
pub fn from_pixels_per_point(pixels_per_point: f32) -> Self {
Self {
start_time: std::time::Instant::now(),
start_time: instant::Instant::now(),
egui_input: egui::RawInput {
pixels_per_point: Some(pixels_per_point),
..Default::default()