-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDGLRECT.H
More file actions
executable file
·49 lines (39 loc) · 908 Bytes
/
DGLRECT.H
File metadata and controls
executable file
·49 lines (39 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef LIBDGL_DGLRECT_H
#define LIBDGL_DGLRECT_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int x;
int y;
int width;
int height;
} RECT;
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);
// --------------------------------------------------------------------------
static RECT rect(int x, int y, int width, int height) {
RECT result;
result.x = x;
result.y = y;
result.width = width;
result.height = height;
return result;
}
static int rect_right(const RECT *r) {
if (r->width)
return r->x + r->width - 1;
else
return r->x;
}
static int rect_bottom(const RECT *r) {
if (r->height)
return r->y + r->height - 1;
else
return r->y;
}
#ifdef __cplusplus
}
#endif
#endif