Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
MapLayer Class Reference

A map layer. More...

#include <map.h>

Public Member Functions

 MapLayer (int x, int y, int width, int height, bool isFringeLayer, Map *map)
 Constructor, taking layer origin, size and whether this layer is the fringe layer.
 
 ~MapLayer ()
 
int getWidth () const
 
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 Actors &actors, int debugFlags) const
 Draws this layer to the given graphics context.
 
bool isFringeLayer () const
 
int getTileDrawWidth (int x1, int y1, int endX, int &width) const
 
void setMask (int mask)
 
int getMask () const
 

Private Attributes

int mX
 
int mY
 
int mWidth
 
int mHeight
 
int mMask = 1
 
bool mIsFringeLayer
 Whether the actors are drawn.
 
Image ** mTiles
 
MapmMap
 

Detailed Description

A map layer.

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

Definition at line 80 of file map.h.

Constructor & Destructor Documentation

◆ MapLayer()

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

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

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

Definition at line 89 of file map.cpp.

◆ ~MapLayer()

MapLayer::~MapLayer ( )

Definition at line 101 of file map.cpp.

Member Function Documentation

◆ draw()

void MapLayer::draw ( Graphics graphics,
int  startX,
int  startY,
int  endX,
int  endY,
int  scrollX,
int  scrollY,
const Actors actors,
int  debugFlags 
) 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 actors are only drawn when this layer is the fringe layer.

Definition at line 111 of file map.cpp.

◆ getMask()

int MapLayer::getMask ( ) const
inline

Definition at line 132 of file map.h.

◆ getTile()

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

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

Definition at line 108 of file map.h.

◆ getTileDrawWidth()

int MapLayer::getTileDrawWidth ( int  x1,
int  y1,
int  endX,
int &  width 
) const

Definition at line 189 of file map.cpp.

◆ getWidth()

int MapLayer::getWidth ( ) const
inline

Definition at line 93 of file map.h.

◆ isFringeLayer()

bool MapLayer::isFringeLayer ( ) const
inline

Definition at line 126 of file map.h.

◆ setMask()

void MapLayer::setMask ( int  mask)
inline

Definition at line 131 of file map.h.

◆ setTile() [1/2]

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

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

Definition at line 103 of file map.h.

◆ setTile() [2/2]

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

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

Definition at line 106 of file map.cpp.

Member Data Documentation

◆ mHeight

int MapLayer::mHeight
private

Definition at line 136 of file map.h.

◆ mIsFringeLayer

bool MapLayer::mIsFringeLayer
private

Whether the actors are drawn.

Definition at line 138 of file map.h.

◆ mMap

Map* MapLayer::mMap
private

Definition at line 140 of file map.h.

◆ mMask

int MapLayer::mMask = 1
private

Definition at line 137 of file map.h.

◆ mTiles

Image** MapLayer::mTiles
private

Definition at line 139 of file map.h.

◆ mWidth

int MapLayer::mWidth
private

Definition at line 136 of file map.h.

◆ mX

int MapLayer::mX
private

Definition at line 135 of file map.h.

◆ mY

int MapLayer::mY
private

Definition at line 135 of file map.h.


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