2018-04-28 11:30:53 -04:00
|
|
|
#ifndef DGL_DGLRECT_H_INCLUDED
|
|
|
|
#define DGL_DGLRECT_H_INCLUDED
|
2017-11-26 13:18:33 -05:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
} RECT;
|
|
|
|
|
2018-04-28 11:30:53 -04:00
|
|
|
static RECT rect(int x, int y, int width, int height);
|
|
|
|
static int rect_right(const RECT *r);
|
|
|
|
static int rect_bottom(const RECT *r);
|
2017-11-26 13:18:33 -05:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2018-04-28 11:30:53 -04:00
|
|
|
static RECT rect(int x, int y, int width, int height) {
|
2017-11-26 13:18:33 -05:00
|
|
|
RECT result;
|
|
|
|
result.x = x;
|
|
|
|
result.y = y;
|
|
|
|
result.width = width;
|
|
|
|
result.height = height;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2018-04-28 11:30:53 -04:00
|
|
|
static int rect_right(const RECT *r) {
|
2017-11-26 13:18:33 -05:00
|
|
|
if (r->width)
|
|
|
|
return r->x + r->width - 1;
|
|
|
|
else
|
|
|
|
return r->x;
|
|
|
|
}
|
|
|
|
|
2018-04-28 11:30:53 -04:00
|
|
|
static int rect_bottom(const RECT *r) {
|
2017-11-26 13:18:33 -05:00
|
|
|
if (r->height)
|
|
|
|
return r->y + r->height - 1;
|
|
|
|
else
|
|
|
|
return r->y;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|