jtmm2/src/util.c

53 lines
698 B
C

#include "util.h"
#include <gint/display.h>
int
sign(int x)
{
return (x > 0) - (x < 0);
}
float
absf(float x)
{
return x * (-1 + 2 * (x > 0));
}
float
minf(float x, float y)
{
return (x < y) ? (x) : (y);
}
float
maxf(float x, float y)
{
return (x > y) ? (x) : (y);
}
int
min(int x, int y)
{
return (x < y) ? (x) : (y);
}
int
max(int x, int y)
{
return (x > y) ? (x) : (y);
}
void
dputs_outline(int x, int y, int halign, int valign, const char *text)
{
int rx = 2;
while (rx-- > -1) {
int ry = 2;
while (ry-- > -1) {
dprint_opt(x + rx, y + ry, C_WHITE, C_NONE, halign,
valign, "%s", text);
}
}
dprint_opt(x, y, C_BLACK, C_NONE, halign, valign, "%s", text);
}