Show maptilepos.h syntax highlighted
/***************************************************************************
maptilepos.h - description
-------------------
begin : Thu Sep 19 2002
copyright : (C) 2002 by Brendon Higgins
email : freepop-devel@lists.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef MAPTILEPOS_H_INCLUDED
#define MAPTILEPOS_H_INCLUDED
#include <boost/operators.hpp>
class Corner;
class Rotation;
/**
* Position on a MapTile.
*
* This class describes a location on the surface of a MapTile.
*/
class MapTilePos: public
boost::equality_comparable<MapTilePos,
boost::additive<MapTilePos,
boost::multipliable2<MapTilePos, Rotation
> > > {
private:
/**
* Coords.
*/
float x, y;
public:
/**
* Constructor.
*/
MapTilePos(float px = 0.0f, float py = 0.0f);
/**
* Copy constructor.
*/
MapTilePos(const MapTilePos& p);
/**
* Checks equality.
*/
bool operator==(const MapTilePos& m) const;
/**
* In place addition.
*/
MapTilePos& operator+=(const MapTilePos& p);
/**
* In place subtraction.
*/
MapTilePos& operator-=(const MapTilePos& p);
/**
* The x location.
*/
float getX() const;
/**
* The y location.
*/
float getY() const;
/**
* The ID of the closest corner.
*/
Corner calcNearestCorner() const;
/**
* Spin the pos.
*/
MapTilePos& operator*=(const Rotation& r);
/**
* Is true if 0 <= x,y <= 1
*/
bool isValid() const;
};
#endif /* ndef MAPTILEPOS_H_INCLUDED */
See more files for this project here