1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 12:50:04 -04:00

Add a fractal clock example to showcase painting performance

This commit is contained in:
Emil Ernerfeldt
2020-05-11 20:21:24 +02:00
parent 5a9e3d62bf
commit 71154edf9b
21 changed files with 425 additions and 37 deletions

View File

@@ -107,7 +107,13 @@
screen_size: { x: window.innerWidth, y: window.innerHeight },
pixels_per_point: pixels_per_point(),
time: window.performance.now() / 1000.0,
seconds_since_midnight: seconds_since_midnight(),
events: g_events,
web: {
location: window.location.toString(),
location_hash: window.location.hash.toString(), // i.e. #fragment
},
};
g_scroll_delta_x = 0;
g_scroll_delta_y = 0;
@@ -115,6 +121,11 @@
return input;
}
function seconds_since_midnight() {
var d = new Date();
return (d.getHours() * 60.0 + d.getMinutes()) * 60.0 + d.getSeconds() + 1e-3 * d.getMilliseconds();
}
function mouse_pos_from_event(canvas, event) {
var rect = canvas.getBoundingClientRect();
return {