From 7a60ab9f178dd813c876fcf8e25c947f9a9a5e06 Mon Sep 17 00:00:00 2001 From: Simponic Date: Tue, 30 Jun 2020 20:04:55 -0600 Subject: Updated indentation --- point.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 point.h (limited to 'point.h') diff --git a/point.h b/point.h new file mode 100644 index 0000000..7f0715f --- /dev/null +++ b/point.h @@ -0,0 +1,49 @@ +/*********************************************************************** + * Header File: + * Point : The representation of a position on the screen + * Author: + * Br. Helfrich + * Summary: + * Everything we need to know about a location on the screen, including + * the location and the bounds. + ************************************************************************/ + + +#ifndef POINT_H +#define POINT_H + +#include + +/********************************************* + * POINT + * A single position. + *********************************************/ +class Point +{ +public: + // constructors + Point() : x(0.0), y(0.0) {} + Point(bool check) : x(0.0), y(0.0) {} + Point(float x, float y); + + // getters + float getX() const { return x; } + float getY() const { return y; } + + // setters + void setX(float x); + void setY(float y); + void addX(float dx) { setX(getX() + dx); } + void addY(float dy) { setY(getY() + dy); } + + bool inRange ( const Point &p , const float range ); +private: + float x; // horizontal position + float y; // vertical position +}; + +// stream I/O useful for debugging +std::ostream & operator << (std::ostream & out, const Point & pt); +std::istream & operator >> (std::istream & in, Point & pt); + +#endif // POINT_H -- cgit v1.2.3-70-g09d2