21 void swap(
char *x,
char *y)
32 short l = (short)strlen(str);
35 if (str[start] ==
'\n')
50 swap(str+start, str+end);
57 char*
citoa(
int num,
char* str,
int base)
72 if (num < 0 && base == 10)
82 str[i++] = (rem > 9)? (rem-10) +
'a' : rem +
'0';
98 int range_adjust(
int val,
int in_lower,
int in_upper,
int out_lower,
int out_upper)
101 return ((val - in_lower) * (out_upper - out_lower)) / (in_upper - in_lower) + out_lower;
104 int clamp(
int x,
int in_lower,
int in_upper){
105 return min(
max(x, in_lower), in_upper);
111 if (pt->
x >= r->
sx && pt->
y >= r->
sy)
112 if (pt->
x < r->
ex && pt->
y < r->
ey)
121 pt_list[0].
x = pl->
p0.
x;
122 pt_list[0].
y = pl->
p0.
y;
123 pt_list[1].
x = pl->
p1.
x;
124 pt_list[1].
y = pl->
p1.
y;
125 pt_list[2].
x = pl->
p2.
x;
126 pt_list[2].
y = pl->
p2.
y;
127 pt_list[3].
x = pl->
p3.
x;
128 pt_list[3].
y = pl->
p3.
y;
138 short pos = 0, neg = 0;
139 short x, y, x1, y1, x2, y2, d;
149 for (i = 0; i < n_pt; i++)
152 if (pt_list[i].x == pt->
x && pt_list[i].
y == pt->
y)
160 j = i < (n_pt - 1) ? i + 1 : 0;
169 d = (x - x1)*(y2 - y1) - (y - y1)*(x2 - x1);
175 if (pos > 0 && neg > 0)
void swap(char *x, char *y)
int range_adjust(int val, int in_lower, int in_upper, int out_lower, int out_upper)
BOOL point_within_polygon(vec2 *pt, vec2 *pt_list, unsigned short n_pt)
void reverse(char str[], int length)
BOOL point_within_rect(vec2 *pt, rect *r)
char * citoa(int num, char *str, int base)
short str_find_delimiter(short start, char *str)
int clamp(int x, int in_lower, int in_upper)
BOOL point_within_quad(vec2 *pt, poly *pl)