MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / cDimension

Class cDimension

Source/Dimension.hpp:23–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 */
22
23class cDimension {
24 public:
25 unsigned int mWidth, mHeight;
26
27 public:
28 cDimension() : mWidth( 0 ), mHeight( 0 ) {}
29 cDimension( unsigned int pWidth, unsigned int pHeight ) : mWidth( pWidth ), mHeight( pHeight ) {}
30
31 void Set( unsigned int pWidth, unsigned int pHeight ) { mWidth = pWidth; mHeight = pHeight; }
32
33 unsigned int WidthByHeight() { return mWidth * mHeight; }
34 int getWidth() const { return mWidth; }
35 int getHeight() const { return mHeight; }
36
37 cPosition getCentre() const { return { mWidth / 2, mHeight / 2 }; };
38
39 cDimension operator/(const cDimension& pDim) {
40 return cDimension(mWidth / pDim.mWidth, mHeight / pDim.mHeight);
41 }
42
43 bool operator==(const cDimension& pRight) {
44 return mWidth == pRight.mWidth && mHeight == pRight.mHeight;
45 }
46
47 cDimension operator+(const cDimension& pRight) {
48
49 return cDimension(mWidth + pRight.mWidth, mHeight + pRight.mHeight);
50 }
51};

Callers 3

operator/Method · 0.85
operator+Method · 0.85
GetWindowSizeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected