Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members   Examples  

IsoScroller Class Reference

Class IsoScroller: wraps up the scrolling algorithms for a map. More...

#include <IsoScroller.h>

Collaboration diagram for IsoScroller:

Collaboration graph
[legend]
List of all members.

Public Methods

 IsoScroller ()
 ~IsoScroller ()
RECTgetScreenSpace ()
 Returns a pointer to the screen space RECT. More...

int getScreenSpaceWidth ()
 Returns the width of the screen space. More...

int getScreenSpaceHeight ()
 Returns the height of the screen space. More...

void setScreenSpace (RECT *newScreenSpace)
 Sets the screen space RECT to a new value. More...

void adjustScreenSpace (int leftAdjust, int topAdjust, int rightAdjust, int bottomAdjust)
 Adjusts the screen space by the values specified. More...

RECTgetWorldSpace ()
 Returns a pointer to the world space RECT. More...

int getWorldSpaceWidth ()
 Returns the width of the world space. More...

int getWorldSpaceHeight ()
 Returns the height of the world space. More...

void setWorldSpace (RECT *newWorldSpace)
 Sets the world space RECT to a new value. More...

void adjustWorldSpace (int leftAdjust, int topAdjust, int rightAdjust, int bottomAdjust)
 Adjusts the world space by the values specified. More...

void calcWorldSpace (IsoTilePlotter *tilePlotter, RECT *extent, int mapWidth, int mapHeight)
 Calculates worldspace based on a tile plotter, a tile extent rectangle, and a map's height and width. More...

RECTgetAnchorSpace ()
 Returns a pointer to the anchor space RECT. More...

int getAnchorSpaceWidth ()
 Returns the width of the anchor space. More...

int getAnchorSpaceHeight ()
 Returns the height of the anchor space. More...

void setAnchorSpace (RECT *newAnchorSpace)
 Sets the anchor space RECT to a new value. More...

void adjustAnchorSpace (int leftAdjust, int topAdjust, int rightAdjust, int bottomAdjust)
 Adjusts the anchor space by the values specified. More...

void calcAnchorSpace ()
 Calculates anchor space based on world space and screen space. More...

POINTgetAnchor ()
 Returns the point where the anchor is located. More...

void setAnchor (POINT *newAnchor, bool wrap=true)
 Sets the new location for the anchor. More...

void moveAnchor (int xAdjust, int yAdjust, bool wrap=true)
 Moves anchor by the specifid quantities in x and y directions. More...

void wrapAnchor ()
 Applies clipping or wrapping to the anchor. More...

POINT ScreenToWorld (POINT screenCoords)
 Converts screen coordinates to world coordinates. More...

POINT WorldToScreen (POINT worldCoords)
 Converts world coordinates to screen coordinates. More...

SCROLLERWRAPMODE getHWrapMode ()
 Returns the currently set horizontal wrap mode. More...

SCROLLERWRAPMODE getVWrapMode ()
 Returns the currently set vertical wrap mode. More...

void setHWrapMode (SCROLLERWRAPMODE newWrapMode)
 Sets the horizontal wrap mode. More...

void setVWrapMode (SCROLLERWRAPMODE newWrapMode)
 Sets the vertical wrap mode. More...

bool isWorldCoord (POINT coord)
 Returns true if the coordinate passed in is within the world rectangle. More...

bool isScreenCoord (POINT coord)
 Returns true if the coordinate passed in is within the screen rectangle. More...

bool isAnchorCoord (POINT coord)
 Returns true if the point passed in is within the anchor space. More...


Detailed Description

Class IsoScroller: wraps up the scrolling algorithms for a map.

Takes care of automatically clipping or wrapping the anchor, thus keeping the view always on the map, and potentially allowing to make cylindrical and toral worlds.

Author:
Vovansim (aka Scorpion)
Version:
1.0
Date:
May 17, 2003
Examples:

TileEngineExample.cpp.

Definition at line 34 of file IsoScroller.h.


Constructor & Destructor Documentation

IsoScroller::IsoScroller  
 

Definition at line 16 of file IsoScroller.cpp.

References setHWrapMode, setRectEmpty, setVWrapMode, SWM_NONE, POINT::x, and POINT::y.

IsoScroller::~IsoScroller  
 

Definition at line 31 of file IsoScroller.cpp.


Member Function Documentation

void IsoScroller::adjustAnchorSpace int    leftAdjust,
int    topAdjust,
int    rightAdjust,
int    bottomAdjust
 

Adjusts the anchor space by the values specified.

Parameters:
leftAdjust  The number of pixels to add to the x coordinate of the left edge
topAdjust  The number of pixels to add to the y coordinate of the top edge
rightAdjust  The number of pixels to add to the x coordinate of the right edge
bottomAdjust  The number of pixels to add to the y coordinate of the bottom edge

Definition at line 207 of file IsoScroller.cpp.

References RECT::bottom, RECT::left, RECT::right, and RECT::top.

void IsoScroller::adjustScreenSpace int    leftAdjust,
int    topAdjust,
int    rightAdjust,
int    bottomAdjust
 

Adjusts the screen space by the values specified.

Parameters:
leftAdjust  The number of pixels to add to the x coordinate of the left edge
topAdjust  The number of pixels to add to the y coordinate of the top edge
rightAdjust  The number of pixels to add to the x coordinate of the right edge
bottomAdjust  The number of pixels to add to the y coordinate of the bottom edge

Definition at line 68 of file IsoScroller.cpp.

References RECT::bottom, RECT::left, RECT::right, and RECT::top.

void IsoScroller::adjustWorldSpace int    leftAdjust,
int    topAdjust,
int    rightAdjust,
int    bottomAdjust
 

Adjusts the world space by the values specified.

Parameters:
leftAdjust  The number of pixels to add to the x coordinate of the left edge
topAdjust  The number of pixels to add to the y coordinate of the top edge
rightAdjust  The number of pixels to add to the x coordinate of the right edge
bottomAdjust  The number of pixels to add to the y coordinate of the bottom edge

Definition at line 112 of file IsoScroller.cpp.

References RECT::bottom, RECT::left, RECT::right, and RECT::top.

void IsoScroller::calcAnchorSpace  
 

Calculates anchor space based on world space and screen space.

Definition at line 218 of file IsoScroller.cpp.

References RECT::bottom, CopyRect, getScreenSpaceHeight, getScreenSpaceWidth, RECT::left, RECT::right, SWM_WRAP, and RECT::top.

Referenced by initializeEngine, and programLoop.

void IsoScroller::calcWorldSpace IsoTilePlotter   tilePlotter,
RECT   extent,
int    mapWidth,
int    mapHeight
 

Calculates worldspace based on a tile plotter, a tile extent rectangle, and a map's height and width.

Definition at line 127 of file IsoScroller.cpp.

References RECT::bottom, CopyRect, RECT::left, OffsetRect, IsoTilePlotter::plotTile, RECT::right, setRectEmpty, tilePlotter, RECT::top, POINT::x, and POINT::y.

Referenced by initializeEngine, and programLoop.

POINT * IsoScroller::getAnchor  
 

Returns the point where the anchor is located.

Definition at line 246 of file IsoScroller.cpp.

Referenced by initializeEngine, and programLoop.

RECT * IsoScroller::getAnchorSpace  
 

Returns a pointer to the anchor space RECT.

Definition at line 181 of file IsoScroller.cpp.

int IsoScroller::getAnchorSpaceHeight  
 

Returns the height of the anchor space.

Definition at line 191 of file IsoScroller.cpp.

References RECT::bottom, and RECT::top.

Referenced by wrapAnchor.

int IsoScroller::getAnchorSpaceWidth  
 

Returns the width of the anchor space.

Definition at line 186 of file IsoScroller.cpp.

References RECT::left, and RECT::right.

Referenced by wrapAnchor.

SCROLLERWRAPMODE IsoScroller::getHWrapMode  
 

Returns the currently set horizontal wrap mode.

Definition at line 365 of file IsoScroller.cpp.

RECT * IsoScroller::getScreenSpace  
 

Returns a pointer to the screen space RECT.

Definition at line 42 of file IsoScroller.cpp.

int IsoScroller::getScreenSpaceHeight  
 

Returns the height of the screen space.

Definition at line 52 of file IsoScroller.cpp.

References RECT::bottom, and RECT::top.

Referenced by calcAnchorSpace.

int IsoScroller::getScreenSpaceWidth  
 

Returns the width of the screen space.

Definition at line 47 of file IsoScroller.cpp.

References RECT::left, and RECT::right.

Referenced by calcAnchorSpace.

SCROLLERWRAPMODE IsoScroller::getVWrapMode  
 

Returns the currently set vertical wrap mode.

Definition at line 370 of file IsoScroller.cpp.

RECT * IsoScroller::getWorldSpace  
 

Returns a pointer to the world space RECT.

Definition at line 86 of file IsoScroller.cpp.

int IsoScroller::getWorldSpaceHeight  
 

Returns the height of the world space.

Definition at line 96 of file IsoScroller.cpp.

References RECT::bottom, and RECT::top.

int IsoScroller::getWorldSpaceWidth  
 

Returns the width of the world space.

Definition at line 91 of file IsoScroller.cpp.

References RECT::left, and RECT::right.

bool IsoScroller::isAnchorCoord POINT    coord
 

Returns true if the point passed in is within the anchor space.

Definition at line 401 of file IsoScroller.cpp.

bool IsoScroller::isScreenCoord POINT    coord
 

Returns true if the coordinate passed in is within the screen rectangle.

Definition at line 396 of file IsoScroller.cpp.

bool IsoScroller::isWorldCoord POINT    coord
 

Returns true if the coordinate passed in is within the world rectangle.

Definition at line 391 of file IsoScroller.cpp.

void IsoScroller::moveAnchor int    xAdjust,
int    yAdjust,
bool    wrap = true
 

Moves anchor by the specifid quantities in x and y directions.

Definition at line 261 of file IsoScroller.cpp.

References wrapAnchor, POINT::x, and POINT::y.

Referenced by programLoop, and renderMap.

POINT IsoScroller::ScreenToWorld POINT    screenCoords
 

Converts screen coordinates to world coordinates.

Definition at line 331 of file IsoScroller.cpp.

Referenced by IsoMouseMap::mapMouse.

void IsoScroller::setAnchor POINT   newAnchor,
bool    wrap = true
 

Sets the new location for the anchor.

Definition at line 251 of file IsoScroller.cpp.

References wrapAnchor, POINT::x, and POINT::y.

void IsoScroller::setAnchorSpace RECT   newAnchorSpace
 

Sets the anchor space RECT to a new value.

Definition at line 196 of file IsoScroller.cpp.

References CopyRect.

void IsoScroller::setHWrapMode SCROLLERWRAPMODE    newWrapMode
 

Sets the horizontal wrap mode.

Definition at line 375 of file IsoScroller.cpp.

Referenced by initializeEngine, and IsoScroller.

void IsoScroller::setScreenSpace RECT   newScreenSpace
 

Sets the screen space RECT to a new value.

Definition at line 57 of file IsoScroller.cpp.

References CopyRect.

Referenced by initializeEngine.

void IsoScroller::setVWrapMode SCROLLERWRAPMODE    newWrapMode
 

Sets the vertical wrap mode.

Definition at line 380 of file IsoScroller.cpp.

Referenced by initializeEngine, and IsoScroller.

void IsoScroller::setWorldSpace RECT   newWorldSpace
 

Sets the world space RECT to a new value.

Definition at line 101 of file IsoScroller.cpp.

References CopyRect.

POINT IsoScroller::WorldToScreen POINT    worldCoords
 

Converts world coordinates to screen coordinates.

Definition at line 345 of file IsoScroller.cpp.

Referenced by renderMap.

void IsoScroller::wrapAnchor  
 

Applies clipping or wrapping to the anchor.

Definition at line 271 of file IsoScroller.cpp.

References RECT::bottom, getAnchorSpaceHeight, getAnchorSpaceWidth, RECT::left, RECT::right, SWM_CLIP, SWM_WRAP, RECT::top, POINT::x, and POINT::y.

Referenced by moveAnchor, and setAnchor.


The documentation for this class was generated from the following files:
Generated on Mon May 26 22:13:22 2003 for SDL Isometric Engine by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002