MapLayer Class Reference

#include <map.h>

List of all members.


Detailed Description

A map layer.

Stores a grid of tiles and their offset, and implements layer rendering.

Definition at line 89 of file map.h.


Public Member Functions

 MapLayer (int x, int y, int width, int height, bool isFringeLayer)
 Constructor, taking layer origin, size and whether this layer is the fringe layer.
 ~MapLayer ()
 Destructor.
void setTile (int x, int y, Image *img)
 Set tile image, with x and y in layer coordinates.
void setTile (int index, Image *img)
 Set tile image with x + y * width already known.
ImagegetTile (int x, int y) const
 Get tile image, with x and y in layer coordinates.
void draw (Graphics *graphics, int startX, int startY, int endX, int endY, int scrollX, int scrollY, const Sprites &sprites) const
 Draws this layer to the given graphics context.

Private Attributes

int mX
int mY
int mWidth
int mHeight
bool mIsFringeLayer
 Whether the sprites are drawn.
Image ** mTiles

Constructor & Destructor Documentation

MapLayer::MapLayer ( int  x,
int  y,
int  width,
int  height,
bool  isFringeLayer 
)

Constructor, taking layer origin, size and whether this layer is the fringe layer.

The fringe layer is the layer that draws the sprites. There can be only one fringe layer per map.

Definition at line 99 of file map.cpp.

MapLayer::~MapLayer (  ) 

Destructor.

Definition at line 109 of file map.cpp.


Member Function Documentation

void MapLayer::setTile ( int  x,
int  y,
Image img 
)

Set tile image, with x and y in layer coordinates.

Definition at line 114 of file map.cpp.

void MapLayer::setTile ( int  index,
Image img 
) [inline]

Set tile image with x + y * width already known.

Definition at line 112 of file map.h.

Image * MapLayer::getTile ( int  x,
int  y 
) const

Get tile image, with x and y in layer coordinates.

Definition at line 119 of file map.cpp.

void MapLayer::draw ( Graphics graphics,
int  startX,
int  startY,
int  endX,
int  endY,
int  scrollX,
int  scrollY,
const Sprites sprites 
) const

Draws this layer to the given graphics context.

The coordinates are expected to be in map range and will be translated to local layer coordinates and clipped to the layer's dimensions.

The given sprites are only drawn when this layer is the fringe layer.

Definition at line 124 of file map.cpp.


Member Data Documentation

int MapLayer::mX [private]

Definition at line 134 of file map.h.

int MapLayer::mY [private]

Definition at line 134 of file map.h.

int MapLayer::mWidth [private]

Definition at line 135 of file map.h.

int MapLayer::mHeight [private]

Definition at line 135 of file map.h.

bool MapLayer::mIsFringeLayer [private]

Whether the sprites are drawn.

Definition at line 136 of file map.h.

Image** MapLayer::mTiles [private]

Definition at line 137 of file map.h.


The documentation for this class was generated from the following files:

Generated on Sun Apr 26 17:30:43 2009 for The Mana World by  doxygen 1.5.5