devilutionX/Source/engine/rectangle.hpp
Juliano Leal Goncalves d93e1fdf07 Add 'Contains' function for 'Rectangle'
This will be useful for various bound checks throughout the code.
2021-06-27 16:37:20 +02:00

21 lines
436 B
C++

#pragma once
#include "engine/point.hpp"
#include "engine/size.hpp"
namespace devilution {
struct Rectangle {
Point position;
Size size;
constexpr bool Contains(Point point) const
{
return point.x >= this->position.x
&& point.x <= (this->position.x + this->size.width)
&& point.y >= this->position.y
&& point.y <= (this->position.y + this->size.height);
}
};
} // namespace devilution