Show maptileclient.h syntax highlighted
/***************************************************************************
maptile.h - description
-------------------
begin : Mon Aug 5 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 MAPTILECLIENT_H_INCLUDED
#define MAPTILECLIENT_H_INCLUDED
#include <maptile.h>
#include <string>
#include <ClanLib/display.h>
class MapPos;
class WorldPos;
class Rules;
class CL_Sprite;
/**
* One tile on the map, client edition.
* A MapTile has a certain slope at a certain height.
*/
class MapTileClient: public MapTile,
public boost::multipliable2<MapTileClient, Rotation> {
protected:
/**
* The width of the flat tile image.
*/
static const int PICWIDTH;
/**
* The height of the flat tile image.
*/
static const int PICHEIGHT;
/**
* An array of slope sprites.
*/
static CL_Sprite** sprites;
/**
* The graphical offset of this tile.
*/
CL_Point offset;
public:
/**
* Constructor.
*/
MapTileClient();
/**
* Copy constructor.
*/
MapTileClient(const MapTileClient& t);
/**
* Destructor.
*/
virtual ~MapTileClient();
/**
* Copy operator.
*/
MapTileClient& operator=(const MapTileClient& copy);
/**
* Rotate this tile the given amount.
*/
MapTileClient& operator*=(const Rotation& r);
/**
* Get the last calculated offset.
*/
CL_Point getOffset() const;
/**
* Find the graphical offset for this tile at \p p, store it for use by
* getOffset(), and return it.
*/
CL_Point calcOffset(const MapPos& p);
/**
* Find the corner that is graphically nearest the given pos \p p.
*/
Corner calcNearestScreenCorner(const CL_Point& p) const;
/**
* Finds the tile coords of the given relative pos.
* \param gp Graphic coords.
*/
MapTilePos findPos(const CL_Point& gp) const;
/**
* Find the graphic coords of \p p relative to the tile.
*/
CL_Point findPosSlope(const MapTilePos& p) const;
/**
* Find the graphic coords of \p c relative to the tile.
*/
CL_Point findPosSlope(const Corner& c) const;
/**
* Finds the slope coords of the given relative pos.
*/
MapTilePos findPosSlope(const CL_Point& p) const;
/**
* Sets up and displays the MapTile at the given position rotated
* the given number of right angles.
*/
void draw() const;
/**
* The width of the regular tile pic.
*/
static int picWidth();
/**
* The height of the regular tile pic.
*/
static int picHeight();
/**
* Half the width of the regular tile pic.
*/
static int picWidthOn2();
/**
* Half the height of the regular tile pic.
*/
static int picHeightOn2();
/**
* Negative half the width of the regular tile pic.
*/
static int picWidthOnNeg2();
/**
* Negative half the height of the regular tile pic.
*/
static int picHeightOnNeg2();
/**
* Get the name of the sprite.
* \param n Raw slope number.
* \param s At sea level?
*/
static std::string getSpriteName(Rules* r, int n, bool s);
/**
* Get the sprite array index for this tile.
*/
int getSpriteNum() const;
/**
* Load sprites.
*/
static void loadSprites(Rules* r);
/**
* Free sprites.
*/
static void freeSprites();
};
#endif /* ndef MAPTILECLIENT_H_INCLUDED */
See more files for this project here