Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
Size2D.h
Go to the documentation of this file.
1/* Copyright (C) 2021 Wildfire Games.
2 * This file is part of 0 A.D.
3 *
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef INCLUDED_SIZE2D
19#define INCLUDED_SIZE2D
20
21/*
22 * Provides an interface for a size - geometric property in R2.
23 */
25{
26public:
28 CSize2D(const CSize2D& size);
29 CSize2D(const float width, const float height);
30
31 CSize2D& operator=(const CSize2D& size);
32 bool operator==(const CSize2D& size) const;
33 bool operator!=(const CSize2D& size) const;
34
35 CSize2D operator+(const CSize2D& size) const;
36 CSize2D operator-(const CSize2D& size) const;
37 CSize2D operator/(const float a) const;
38 CSize2D operator*(const float a) const;
39
40 void operator+=(const CSize2D& a);
41 void operator-=(const CSize2D& a);
42 void operator/=(const float a);
43 void operator*=(const float a);
44
45public:
46 float Width = 0.0f, Height = 0.0f;
47};
48
49#endif // INCLUDED_SIZE2D
Definition: Size2D.h:25
CSize2D operator-(const CSize2D &size) const
Definition: Size2D.cpp:54
void operator-=(const CSize2D &a)
Definition: Size2D.cpp:75
float Height
Definition: Size2D.h:46
CSize2D operator*(const float a) const
Definition: Size2D.cpp:64
float Width
Definition: Size2D.h:46
bool operator==(const CSize2D &size) const
Definition: Size2D.cpp:39
void operator*=(const float a)
Definition: Size2D.cpp:87
CSize2D operator+(const CSize2D &size) const
Definition: Size2D.cpp:49
CSize2D & operator=(const CSize2D &size)
Definition: Size2D.cpp:32
void operator/=(const float a)
Definition: Size2D.cpp:81
bool operator!=(const CSize2D &size) const
Definition: Size2D.cpp:44
void operator+=(const CSize2D &a)
Definition: Size2D.cpp:69
CSize2D operator/(const float a) const
Definition: Size2D.cpp:59