cmdfx 0.1.1
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
util.h
Go to the documentation of this file.
1
11#pragma once
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17// Global Declarations
18
28
38int CmdFX_setTickSpeed(int tickspeed);
39
40// Time
41
46unsigned long currentTimeMillis();
47
52unsigned long long currentTimeNanos();
53
58void sleepMillis(unsigned long millis);
59
64void sleepNanos(unsigned long long nanos);
65
66// Math
67
75double clamp_d(double value, double min, double max);
76
84float clamp_f(float value, float min, float max);
85
93int clamp_i(int value, int min, int max);
94
102double lerp_d(double a, double b, double t);
103
111float lerp_f(float a, float b, float t);
112
120int lerp_i(int a, int b, double t);
121
129void rgb_to_hsv(int rgb, double* h, double* s, double* v);
130
138int hsv_to_rgb(double h, double s, double v);
139
147int lerp_color(int rgb1, int rgb2, double t);
148
149#ifdef __cplusplus
150}
151#endif
double lerp_d(double a, double b, double t)
Linearly interpolates between two values.
void rgb_to_hsv(int rgb, double *h, double *s, double *v)
Converts an RGB color to HSV.
int lerp_i(int a, int b, double t)
Linearly interpolates between two values.
float lerp_f(float a, float b, float t)
Linearly interpolates between two values.
int hsv_to_rgb(double h, double s, double v)
Converts an HSV color to RGB.
int CmdFX_setTickSpeed(int tickspeed)
Sets the tick speed of cmdfx.
int lerp_color(int rgb1, int rgb2, double t)
Linearly interpolates between two colors.
float clamp_f(float value, float min, float max)
Clamps a value between a minimum and maximum.
unsigned long currentTimeMillis()
Gets the current time in milliseconds.
void sleepMillis(unsigned long millis)
Pauses the program for a specified number of milliseconds.
int clamp_i(int value, int min, int max)
Clamps a value between a minimum and maximum.
void sleepNanos(unsigned long long nanos)
Pauses the program for a specified number of nanoseconds.
double clamp_d(double value, double min, double max)
Clamps a value between a minimum and maximum.
int CmdFX_getTickSpeed()
Gets the tick speed of cmdfx.
unsigned long long currentTimeNanos()
Gets the current time in nanoseconds.