utils: Añadidas las funciones darkenColor y lightenColor
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "utils.h"
|
||||
#include <math.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Calcula el cuadrado de la distancia entre dos puntos
|
||||
double distanceSquared(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
@@ -576,7 +578,27 @@ void initOptions(options_t *options)
|
||||
options->screen.borderHeight = 0;
|
||||
|
||||
options->notifications.posV = pos_top;
|
||||
options->notifications.posH = pos_left;
|
||||
options->notifications.sound = true;
|
||||
options->notifications.color = {48, 48, 48};
|
||||
options->notifications.posH = pos_left;
|
||||
options->notifications.sound = true;
|
||||
options->notifications.color = {48, 48, 48};
|
||||
}
|
||||
|
||||
// Oscurece un color
|
||||
color_t darkenColor(color_t color, int amount)
|
||||
{
|
||||
color_t newColor;
|
||||
newColor.r = max(0, color.r - amount);
|
||||
newColor.g = max(0, color.g - amount);
|
||||
newColor.b = max(0, color.b - amount);
|
||||
return newColor;
|
||||
}
|
||||
|
||||
// Aclara un color
|
||||
color_t lightenColor(color_t color, int amount)
|
||||
{
|
||||
color_t newColor;
|
||||
newColor.r = min(255, color.r + amount);
|
||||
newColor.g = min(255, color.g + amount);
|
||||
newColor.b = min(255, color.b + amount);
|
||||
return newColor;
|
||||
}
|
||||
Reference in New Issue
Block a user