FosterFramework / Foster

A small C# game framework
MIT License
422 stars 37 forks source link

Added `Rect.Translate` and `RectInt.Translate` #77

Closed codecat closed 6 months ago

codecat commented 6 months ago

I frequently find myself needing these functions, so I figured I'd make a pull request for it. Hopefully it's useful 😊

MrBrixican commented 6 months ago

There is overloaded + Vector2 and - Vector2 operators for Rect that already accomplish what you want, but it may be nice to have an actual method like we have for scaling. Additionally, it may not be a bad idea to have overloaded + Point2 and - Point2 operators for RectInt as well.

codecat commented 6 months ago

Ah! I totally missed that! Makes sense to have named functions indeed, to make sure stuff doesn't get overlooked.

codecat commented 6 months ago

I've added operator + and operator - to RectInt for this PR as well.

NoelFB commented 6 months ago

Yeah I think this is fine ... I usually also use +/- operators but I think it's nice to have.