The Battle for Wesnoth  1.15.1+dev
point.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2018 by Mark de Wever <koraq@xs4all.nl>
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #define GETTEXT_DOMAIN "wesnoth-lib"
16 
17 #include "sdl/point.hpp"
18 
19 #include <iostream>
20 
21 point::operator SDL_Point() const
22 {
23  return {x, y};
24 }
25 
27 {
28  x += point.x;
29  y += point.y;
30  return *this;
31 }
32 
34 {
35  x -= point.x;
36  y -= point.y;
37  return *this;
38 }
39 
40 std::ostream& operator<<(std::ostream& stream, const point& point)
41 {
42  stream << point.x << ',' << point.y;
43  return stream;
44 }
point & operator+=(const point &point)
Definition: point.cpp:26
std::ostream & operator<<(std::ostream &stream, const point &point)
Definition: point.cpp:40
int x
x coordinate.
Definition: point.hpp:44
point & operator-=(const point &point)
Definition: point.cpp:33
Holds a 2D point.
Definition: point.hpp:23
int y
y coordinate.
Definition: point.hpp:47