/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* utils.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: mcolonna +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/15 16:56:47 by mcolonna #+# #+# */ /* Updated: 2024/10/17 14:41:09 by mcolonna ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef UTILS_H # define UTILS_H # include typedef struct s_point_double { double x; double y; } t_point_double; typedef struct s_point_int { int x; int y; } t_point_int; // TODO Must the transparency be 0 or 255? /// @brief Represents an TRGB color in 0xTTRRGGBB format. typedef __u32 t_color; /// @brief Convert a color from each color value to a t_color. /// /// @param red Level of red from 0 to 255. /// @param green Level of green from 0 to 255. /// @param blue Level of blue from 0 to 255. /// @return The result. t_color color_from_rgb(int red, int green, int blue); void write_err(const char *str, ...); /// @brief Call the function in loop. /// If not enough time passed since the last call, returns without doing /// anything. /// /// @param f Function to call in loop. void timedloop(void (*f)(void)); #endif