Fission FSN
Loading...
Searching...
No Matches
fsRect.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: fsRect.h
4*
5* Purpose: Basic type.
6*
7*********************************************************************/
8
9#ifndef fsRecthdr
10#define fsRecthdr
11
12#include "fsPoint.h"
13
14
15class fsRect final
16{
17public:
18
19 fsS32 xCoordGet() const { return mL + (mR - mL) / 2; }
20 fsS32 yCoordGet() const { return mT + (mB - mT) / 2; }
21 fsS32 widthGet() const { return mR - mL; }
22 fsS32 heightGet() const { return mB - mT; }
23
24 fsS32 lGet() const { return mL; }
25 fsS32 rGet() const { return mR; }
26 fsS32 tGet() const { return mT; }
27 fsS32 bGet() const { return mB; }
28
29 fsBool obscuredBy(const fsRect& pOther) const
30 {
31 return
32 mL > pOther.mL &&
33 mR < pOther.mR &&
34 mT > pOther.mT &&
35 mB < pOther.mB;
36 }
37
38 fsRect intersectGet(const fsRect& pOther) const
39 {
40 return fsRect(
41 mL > pOther.mL ? mL : pOther.mL,
42 mR < pOther.mR ? mR : pOther.mR,
43 mT > pOther.mT ? mT : pOther.mT,
44 mB < pOther.mB ? mB : pOther.mB);
45 }
46
48 {
49 return (mR > mL && mB > mT);
50 }
51
53 mL(0),
54 mR(0),
55 mT(0),
56 mB(0)
57 {
58 }
59
60 fsRect(fsS32 pL, fsS32 pR, fsS32 pT, fsS32 pB) :
61 mL(pL),
62 mR(pR),
63 mT(pT),
64 mB(pB)
65 {
66 }
67
68 fsRect(const fsPoint& pPos, fsS32 pWidth, fsS32 pHeight) :
69 mL(pPos.x - (pWidth / 2)),
70 mR(pPos.x + (pWidth / 2)),
71 mT(pPos.y - (pHeight / 2)),
72 mB(pPos.y + (pHeight / 2))
73 {
74 }
75
77 {
78 }
79
80protected:
81
82private:
83
84 fsS32 mL;
85 fsS32 mR;
86 fsS32 mT;
87 fsS32 mB;
88};
89
90#endif
fsRect()
Definition fsRect.h:52
fsS32 bGet() const
Definition fsRect.h:27
fsS32 rGet() const
Definition fsRect.h:25
fsS32 yCoordGet() const
Definition fsRect.h:20
fsS32 lGet() const
Definition fsRect.h:24
fsRect intersectGet(const fsRect &pOther) const
Definition fsRect.h:38
fsBool isValidGet() const
Definition fsRect.h:47
fsS32 widthGet() const
Definition fsRect.h:21
~fsRect()
Definition fsRect.h:76
fsS32 xCoordGet() const
Definition fsRect.h:19
fsRect(const fsPoint &pPos, fsS32 pWidth, fsS32 pHeight)
Definition fsRect.h:68
fsS32 heightGet() const
Definition fsRect.h:22
fsS32 tGet() const
Definition fsRect.h:26
fsRect(fsS32 pL, fsS32 pR, fsS32 pT, fsS32 pB)
Definition fsRect.h:60
fsBool obscuredBy(const fsRect &pOther) const
Definition fsRect.h:29
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsPoint.h:17