mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-02-23 01:40:16 -05:00
feat: Calculate animation curve by time points rather than passed frames
This commit is contained in:
parent
9f229b3c48
commit
9d9a4356e3
6 changed files with 76 additions and 84 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
|
|
@ -80,3 +81,15 @@ int regex_match(const char *pattern, const char *str) {
|
|||
void wl_list_append(struct wl_list *list, struct wl_list *object) {
|
||||
wl_list_insert(list->prev, object);
|
||||
}
|
||||
|
||||
unsigned int get_now_in_ms(void) {
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
return timespec_to_ms(&now);
|
||||
}
|
||||
|
||||
unsigned int timespec_to_ms(struct timespec *ts) {
|
||||
return (unsigned int)ts->tv_sec * 1000 +
|
||||
(unsigned int)ts->tv_nsec / 1000000;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,3 +6,5 @@ void *ecalloc(size_t nmemb, size_t size);
|
|||
int fd_set_nonblock(int fd);
|
||||
int regex_match(const char *pattern_mb, const char *str_mb);
|
||||
void wl_list_append(struct wl_list *list, struct wl_list *object);
|
||||
unsigned int get_now_in_ms(void);
|
||||
unsigned int timespec_to_ms(struct timespec *ts);
|
||||
Loading…
Add table
Add a link
Reference in a new issue