summaryrefslogtreecommitdiff
path: root/source/modules/asura-utils/math/rect.hpp
blob: 1751634b9eb97f2ff638286be6a506fda23b93c0 (plain)
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
#ifndef __ASURA_ENGINE_RECT_H__
#define __ASURA_ENGINE_RECT_H__

namespace AsuraEngine
{
	namespace Math
	{
		
		template<typename T> 
		struct Rect
		{
		public:
			Rect();
			~Rect(T x, T y, T w, T h);

			///
			/// x,yǷrectڡ
			///
			bool Contain(T x, T y);

			///
			/// Ƿཻཻľ
			///
			bool Intersect(const Rect& src, Rect& intersection);
			
			///
			///  Ƿཻཻľ
			///
			static bool Intersect(const Rect<T>& src1, const Rect<T>& src2, Rect<T>& intersection);

			T x, y, w, h;
		};
		
#include "Rect.inl"

		// Define the most common types
		typedef Rect<int>          Recti;
		typedef Rect<unsigned int> Rectu;
		typedef Rect<float>        Rectf;
		typedef Rect<long>         Reftl;

	}
}

namespace AEMath = AsuraEngine::Math;

#endif