/** \file IsoMouseMap.h
* Declares the IsoMouseMap class.
*
* @see IsoMouseMap
*
* @author Vovansim (aka Scorpion)
* @version 1.0
* @date May 26, 2003
*/
#ifndef ISO_MOUSE_MAP_H
#define ISO_MOUSE_MAP_H
#include "IsoDefinitions.h"
#include "IsoTilePlotter.h"
#include "IsoTileWalker.h"
#include "IsoScroller.h"
/**
* Lists the possible tiles spanned by the coarse coordinate located
* by mousemap.
*/
typedef enum {
MM_CENTER=0, /**< The center tile. */
MM_NW=1, /**< The upper-left tile. */
MM_NE=2, /**< The upper-rigth tile. */
MM_SW=3, /**< The lower-left tile. */
MM_SE=4 /**< The lower-right tile. */
} MOUSEMAP_DIRECTION;
/**
* Class IsoMouseMap: Allows to easily convert the view space
* coordinates into the coordinates of the tile clicked.
*
* @author Vovansim (aka Scorpion)
* @version 1.0
* @date May 26, 2003
*/
class IsoMouseMap {
private:
/** The width of the look-up tile. */
int width;
/** The height of the look-up tile. */
int height;
/** Reference point (adjustment for the upper left of tile 0,0) */
POINT reference;
/** Lookup table */
MOUSEMAP_DIRECTION* lookupTable;
/** Scroller */
IsoScroller* scroller;
/** Walker */
IsoTileWalker* tileWalker;
public:
//////////////////////// Constructors / Destructors ///////////////////////
IsoMouseMap();
~IsoMouseMap();
////////////////////// End Constructors / Destructors /////////////////////
//////////////////////// Initialization / Clean-up ////////////////////////
/** Allows to load a mousemap template image for use with
isometric and hexagonal maps. */
void load(char* filename);
/** Use with rectangular maps. Takes the width and the height
of the tile as a parameter. */
void create(int width, int height);
/** Clean up. */
void destroy();
////////////////////// End Initialization / Clean-up //////////////////////
/** Returns the coordinates of the tile that was clicked if
the coordinates of the mouse are passed in. */
POINT mapMouse(POINT coords);
/////////////////////////// Accessors / Modifiers /////////////////////////
/** Returns the width of the tile. */
int getWidth();
/** Returns the height of the tile. */
int getHeight();
/** Returns the reference point. */
POINT* getReferencePoint();
/** Sets the reference point to the value passed in. */
void setReferencePoint(POINT* newReferencePoint);
/** Calculates the correct reference point value given the
tile plotter used for the game, and the extent rectangle
for a specific tile. */
void calculateReferencePoint(IsoTilePlotter* tilePlotter, RECT* extent);
/** Returns the scroller used for the mouse map. */
IsoScroller* getScroller();
/** Sets the scroller. */
void setScroller(IsoScroller* scroller);
/** Returns the tile walker used for the mouse map. */
IsoTileWalker* getTileWalker();
/** Sets the tile walker. */
void setTileWalker(IsoTileWalker* tileWalker);
///////////////////////// End Accessors / Modifiers ///////////////////////
};
#endif//ISO_MOUSE_MAP_H