aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
blob: 5e661a380cb78dfb98b581972c197f0e713e2eff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef COMET_UTIL_H
#define COMET_UTIL_H

#include <time.h>
#include <stddef.h>
#include <stdbool.h>

struct timespec timespec_diff(struct timespec a, struct timespec b);

bool timespec_greater(struct timespec a, struct timespec b);

void timespec_print(struct timespec *ts);

// Check if point (px, py) is inside a rectangle in (x, y), (x+w, y), (x, y+h) and (w+h, y+h)
bool check_rect(int px, int py, int x, int y, int w, int h);

// Check if point (px, py) is inside a circle of radius r and center (x, y)
bool check_circle(int px, int py, int x, int y, int r);

// Check if point (px, py) is inside a capsule in (x, y), (x+w, y), (x, y+h) and (w+h, y+h)
bool check_capsule(int px, int py, int x, int y, int w, int h);

#endif