mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 19:05:59 -04:00
Add another named constructor for Rect
This commit is contained in:
parent
8b0b6548f7
commit
3011a62589
@ -71,4 +71,8 @@ const SDL_Rect* Rect::Get() const {
|
|||||||
return rect_.get();
|
return rect_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect Rect::FromCenter(int cx, int cy, int w, int h) {
|
||||||
|
return Rect(cx - w/2, cy - h/2, cx + w - w/2, cy + h - h/2);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,8 @@ public:
|
|||||||
|
|
||||||
static Rect Null();
|
static Rect Null();
|
||||||
|
|
||||||
|
static Rect FromCenter(int cx, int cy, int w, int h);
|
||||||
|
|
||||||
Rect(const Rect& other);
|
Rect(const Rect& other);
|
||||||
Rect& operator=(const Rect& other);
|
Rect& operator=(const Rect& other);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user