26int setTickSpeed(
int tickspeed) {
33 return ::currentTimeMillis();
37 return ::currentTimeNanos();
40void sleepMillis(
unsigned long millis) {
41 ::sleepMillis(millis);
44void sleepNanos(
unsigned long long nanos) {
50double clamp(
double value,
double min,
double max) {
51 return clamp_d(value, min, max);
54float clamp(
float value,
float min,
float max) {
55 return clamp_f(value, min, max);
58int clamp(
int value,
int min,
int max) {
59 return clamp_i(value, min, max);
62double lerp(
double a,
double b,
double t) {
66float lerp(
float a,
float b,
float t) {
70int lerp(
int a,
int b,
double t) {
74void rgbToHsv(
int rgb,
double* h,
double* s,
double* v) {
78int hsvToRgb(
double h,
double s,
double v) {
82int lerpColor(
int rgb1,
int rgb2,
double t) {
88ThreadID launchThread(
void (*func)(
void*),
void* arg) {
92int joinThread(ThreadID thread) {
96int detachThread(ThreadID thread) {
100void* getInternalMutex(
int id) {
104int lockMutex(
void* mutex) {
108int unlockMutex(
void* mutex) {
112void tryLockMutex(
int id) {
116void tryUnlockMutex(
int id) {
120int isThreadSafeEnabled() {
124int initThreadSafe() {
128int destroyThreadSafe() {
Cross-Platform Utilities for CmdFX.
int CmdFX_detachThread(ThreadID thread)
Detaches a thread.
int CmdFX_unlockMutex(void *mutex)
Unlocks a mutex.
int CmdFX_joinThread(ThreadID thread)
Joins a thread.
ThreadID CmdFX_launchThread(void(*func)(void *), void *arg)
Launches a thread.
double lerp_d(double a, double b, double t)
Linearly interpolates between two values.
int CmdFX_isThreadSafeEnabled()
Checks if thread-safe functions are enabled.
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.
void CmdFX_tryUnlockMutex(int id)
Tries to unlock a mutex.
int CmdFX_initThreadSafe()
Initializes thread-safe functions.
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.
int CmdFX_lockMutex(void *mutex)
Locks a mutex.
int clamp_i(int value, int min, int max)
Clamps a value between a minimum and maximum.
double clamp_d(double value, double min, double max)
Clamps a value between a minimum and maximum.
void CmdFX_tryLockMutex(int id)
Tries to lock a mutex.
int CmdFX_getTickSpeed()
Gets the tick speed of cmdfx.
unsigned long long currentTimeNanos()
Gets the current time in nanoseconds.
int CmdFX_destroyThreadSafe()
Cleans up thread-safe functions.
void * CmdFX_getInternalMutex(int index)
Gets an internal mutex.
Primary namespace for CmdFX.
Definition cmdfx.hpp:26