Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions egui-winit/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to the `egui-winit` integration will be noted in this file.


## Unreleased
* Replaced `std::time::Instant` with `instant::Instant` for WebAssembly compatability ([#1023](https://github.com/emilk/egui/pull/1023))


## 0.16.0 - 2021-12-29
Expand Down
1 change: 1 addition & 0 deletions egui-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ all-features = true
[dependencies]
egui = { version = "0.16.0", path = "../egui", default-features = false, features = ["single_threaded"] }
winit = "0.26"
instant = { version = "0.1", features = ["wasm-bindgen"] }

epi = { version = "0.16.0", path = "../epi", optional = true }

Expand Down
10 changes: 5 additions & 5 deletions egui-winit/src/epi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub fn handle_app_output(
/// For loading/saving app state and/or egui memory to disk.
pub struct Persistence {
storage: Option<Box<dyn epi::Storage>>,
last_auto_save: std::time::Instant,
last_auto_save: instant::Instant,
}

#[allow(clippy::unused_self)]
Expand All @@ -116,7 +116,7 @@ impl Persistence {

Self {
storage: create_storage(app_name),
last_auto_save: std::time::Instant::now(),
last_auto_save: instant::Instant::now(),
}
}

Expand Down Expand Up @@ -177,7 +177,7 @@ impl Persistence {
egui_ctx: &egui::Context,
window: &winit::window::Window,
) {
let now = std::time::Instant::now();
let now = instant::Instant::now();
if now - self.last_auto_save > app.auto_save_interval() {
self.save(app, egui_ctx, window);
self.last_auto_save = now;
Expand Down Expand Up @@ -278,7 +278,7 @@ impl EpiIntegration {
epi::backend::TexAllocationData,
Vec<egui::epaint::ClippedShape>,
) {
let frame_start = std::time::Instant::now();
let frame_start = instant::Instant::now();

let raw_input = self.egui_winit.take_egui_input(window);
let (egui_output, shapes) = self.egui_ctx.run(raw_input, |egui_ctx| {
Expand All @@ -294,7 +294,7 @@ impl EpiIntegration {
let tex_allocation_data =
crate::epi::handle_app_output(window, self.egui_ctx.pixels_per_point(), app_output);

let frame_time = (std::time::Instant::now() - frame_start).as_secs_f64() as f32;
let frame_time = (instant::Instant::now() - frame_start).as_secs_f64() as f32;
self.frame.lock().info.cpu_usage = Some(frame_time);

(needs_repaint, tex_allocation_data, shapes)
Expand Down
4 changes: 2 additions & 2 deletions egui-winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down