Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace instant with web_time #3296

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions crates/egui-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ egui = { version = "0.22.0", path = "../egui", default-features = false, feature
"log",
] }
log = { version = "0.4", features = ["std"] }
winit = { version = "0.28", default-features = false }
raw-window-handle = "0.5.0"
web-time = { version = "0.1" } # We use web-time so we can (maybe) compile for web
winit = { version = "0.28", default-features = false }

#! ### Optional dependencies

Expand All @@ -73,17 +74,8 @@ document-features = { version = "0.2", optional = true }

puffin = { version = "0.16", optional = true }
serde = { version = "1.0", optional = true, features = ["derive"] }

webbrowser = { version = "0.8.3", optional = true }

[target.'cfg(not(target_arch="wasm32"))'.dependencies]
instant = { version = "0.1" }

[target.'cfg(target_arch="wasm32")'.dependencies]
instant = { version = "0.1", features = [
"wasm-bindgen",
] } # We use instant so we can (maybe) compile for web

[target.'cfg(any(target_os="linux", target_os="dragonfly", target_os="freebsd", target_os="netbsd", target_os="openbsd"))'.dependencies]
smithay-clipboard = { version = "0.6.3", optional = true }

Expand Down
4 changes: 2 additions & 2 deletions crates/egui-winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub struct EventResponse {

/// Handles the integration between egui and winit.
pub struct State {
start_time: instant::Instant,
start_time: web_time::Instant,
egui_input: egui::RawInput,
pointer_pos_in_points: Option<egui::Pos2>,
any_pointer_button_down: bool,
Expand Down Expand Up @@ -95,7 +95,7 @@ impl State {
};

Self {
start_time: instant::Instant::now(),
start_time: web_time::Instant::now(),
egui_input,
pointer_pos_in_points: None,
any_pointer_button_down: false,
Expand Down
Loading