Add drawrect(), a simple helper for drawing rectangles with specified
thickness
This commit is contained in:
parent
2c7f540787
commit
ab355d6a52
1 changed files with 12 additions and 0 deletions
|
@ -111,3 +111,15 @@ __wrap void(vector pos, vector sz, string pic, vector srcpos, vector srcsz, vect
|
|||
{
|
||||
return prior([(int)pos[0],(int)pos[1]], sz, pic, srcpos, srcsz, rgb, alpha, drawflag);
|
||||
};
|
||||
|
||||
void drawrect(vector pos, vector sz, float thickness, vector rgb, float al, optional float dfl)
|
||||
{
|
||||
/* top */
|
||||
drawfill(pos, [sz[0], thickness], rgb, al, dfl);
|
||||
/* bottom */
|
||||
drawfill(pos + [0, sz[1] - thickness], [sz[0], thickness], rgb, al, dfl);
|
||||
/* left */
|
||||
drawfill(pos + [0, thickness], [thickness, sz[1] - (thickness * 2)], rgb, al, dfl);
|
||||
/* right */
|
||||
drawfill(pos + [sz[0] - thickness, thickness], [thickness, sz[1] - (thickness * 2)], rgb, al, dfl);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue