diff options
author | Kimapr <kimapr@mail.ru> | 2023-12-23 07:08:26 +0500 |
---|---|---|
committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2023-12-23 03:14:45 +0100 |
commit | 12f914b5a51e34308437f9a4eccbb33142b3565f (patch) | |
tree | 4a137e043c08d28afccd60d7401b0c11f3512daf /stage3 | |
parent | 5847273427b9b6fb2ea5af9ecd29ce3f4815ee44 (diff) | |
download | cuddles-12f914b5a51e34308437f9a4eccbb33142b3565f.tar.xz |
fps independent cheese
Diffstat (limited to 'stage3')
-rw-r--r-- | stage3/cheese_demo.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/stage3/cheese_demo.c b/stage3/cheese_demo.c index c545c70..52488d4 100644 --- a/stage3/cheese_demo.c +++ b/stage3/cheese_demo.c @@ -2,6 +2,7 @@ #include "math3d.h" #include "heap.h" #include "rng.h" +#include "clock.h" static u32 *make_cheese_texture(u32 tex_w, u32 tex_h) { @@ -87,8 +88,14 @@ void cheese_demo() float angle = 0; + u64 time = clock_monotonic(); + for (;;) { - angle += 0.3; + u64 time1 = clock_monotonic(); + float delta = (time1 - time) / (float)(NANOSECONDS); + time = time1; + + angle += delta * 60; float transform[4][4]; float tmp[4][4]; |