ScummVM API documentation
floatpoint.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef WINTERMUTE_FLOATPOINT_H
23 #define WINTERMUTE_FLOATPOINT_H
24 
25 namespace Wintermute {
26 
27 struct FloatPoint {
28  float x;
29  float y;
30  FloatPoint() : x(0), y(0) {}
31  FloatPoint(float x1, float y1) : x(x1), y(y1) {}
32  bool operator==(const FloatPoint &p) const { return x == p.x && y == p.y; }
33  bool operator!=(const FloatPoint &p) const { return x != p.x || y != p.y; }
34  FloatPoint operator+(const FloatPoint &delta) const { return FloatPoint (x + delta.x, y + delta.y); }
35  FloatPoint operator-(const FloatPoint &delta) const { return FloatPoint (x - delta.x, y - delta.y); }
36 
37  FloatPoint& operator+=(const FloatPoint &delta) {
38  x += delta.x;
39  y += delta.y;
40  return *this;
41  }
42  FloatPoint& operator-=(const FloatPoint &delta) {
43  x -= delta.x;
44  y -= delta.y;
45  return *this;
46  }
47 };
48 
49 } // End of namespace Wintermute
50 
51 #endif
Definition: floatpoint.h:27
Definition: achievements_tables.h:27