JugiMap Framework
Map Class Reference

The Map class defines the map element from JugiMap Editor. More...

#include <jmMap.h>

Inherited by MapAGK, MapCC, MapNC, and MapSFML.

Public Member Functions

 Map ()
 Constructor. More...
 
 Map (int _zOrderStart)
 Constructor. More...
 
virtual ~Map ()
 Destructor. More...
 
virtual void DeleteContent ()
 Delete the map content. More...
 
virtual void InitAsWorldMap ()
 Initialize this map as a word map. More...
 
virtual void InitAsParallaxMap (Vec2i _worldMapSize)
 Initialize this map as a parallax map linked to a world map with the given size *_worldMapSize*. More...
 
virtual void InitAsScreenMap (Vec2i _screenMapDesignSize)
 Initialize this map as a screen map with the given design size *_screenMapDesignSize*. More...
 
virtual void InitEngineObjects (MapType _mapType)
 Initialize the engine map objects. More...
 
virtual void UpdateEngineObjects ()
 Update the engine map objects. More...
 
virtual void DrawEngineObjects ()
 Draw the engine map objects. More...
 
void SetCamera (Camera *_camera)
 Assign a camera to this map. More...
 
MapType GetType ()
 Returns the type of this map. More...
 
Vec2i GetTileSize ()
 Returns the tile size of this map. More...
 
Vec2i GetTilesCount ()
 Returns the number of tile rows and columns. More...
 
CameraGetCamera ()
 Returns the camera assigned to this map. More...
 
std::vector< Layer * > & GetLayers ()
 Returns a reference to the layers of this map. More...
 
std::vector< jugimap::Parameter > & GetParameters ()
 Returns a reference to the parameters of this map. More...
 
Vec2i GetWorldMapSize ()
 Returns the world map size. More...
 
Vec2i GetScreenMapDesignSize ()
 Returns the screen map design size. More...
 
Vec2i GetSize ()
 Returns the size of this map. More...
 
void CaptureForLerpDrawing ()
 Capture the sprite properties, usually the position only, required for the lerp drawing. More...
 
virtual void SetVisible (bool _visible)
 Set the visibility of this map. More...
 
bool IsVisible ()
 Returns true if this map is visible; otherwise returns false. More...
 
jugimap::SpriteLayerAddSpriteLayer (const std::string &_name)
 Adds the given *_layer* to this map. More...
 
void _SetName (const std::string &_name)
 Sets the name of this map to the given *_name*. More...
 
void _SetZOrderStart (int _zOrderStart)
 Sets the starting z-order. More...
 
int GetZOrderStart ()
 Returns the starting z-order value. More...
 
void RebuildWidgets ()
 Returns the next z-order to be used with a next (manually) added layer to the map. More...
 

Detailed Description

The Map class defines the map element from JugiMap Editor.

A map object stores Layer objects and is their owner.

Constructor & Destructor Documentation

◆ Map() [1/2]

Map ( )
inline

Constructor.

◆ Map() [2/2]

Map ( int  _zOrderStart)
inline

Constructor.

◆ ~Map()

~Map ( )
virtual

Destructor.

Member Function Documentation

◆ DeleteContent()

void DeleteContent ( )
virtual

Delete the map content.

This function deletes layers and their content (sprites, vector shapes, ...). SourceGraphics objects (source sprites, textures, ...) assigned to map objects are not deleted!

◆ InitAsWorldMap()

void InitAsWorldMap ( )
virtual

Initialize this map as a word map.

◆ InitAsParallaxMap()

void InitAsParallaxMap ( Vec2i  _worldMapSize)
virtual

Initialize this map as a parallax map linked to a world map with the given size *_worldMapSize*.

◆ InitAsScreenMap()

void InitAsScreenMap ( Vec2i  _screenMapDesignSize)
virtual

Initialize this map as a screen map with the given design size *_screenMapDesignSize*.

◆ InitEngineObjects()

void InitEngineObjects ( MapType  _mapType)
virtual

Initialize the engine map objects.

This function initialize the engine objects of all map elements. It should be called after a map was initialized by type.

Reimplemented in MapNC, and MapCC.

◆ UpdateEngineObjects()

void UpdateEngineObjects ( )
virtual

Update the engine map objects.

This function must be called before the engine begin with drawing (rendering).

Reimplemented in MapNC, MapAGK, and MapCC.

◆ DrawEngineObjects()

void DrawEngineObjects ( )
virtual

Draw the engine map objects.

This function is needed only for the engines which do not handle drawing (rendering) internally.

Reimplemented in MapSFML.

◆ SetCamera()

void SetCamera ( Camera _camera)
inline

Assign a camera to this map.

A camera must be assigned before calling the UpdateEngineMap() function. The type of an assigned camera depends of the map type:

  • For a world map use a WorldMapCamera camera.
  • For a parallax map use the same camera as is used for the world map.
  • For a screen map use a ScreenMapCamera.

◆ GetType()

MapType GetType ( )
inline

Returns the type of this map.

◆ GetTileSize()

Vec2i GetTileSize ( )
inline

Returns the tile size of this map.

◆ GetTilesCount()

Vec2i GetTilesCount ( )
inline

Returns the number of tile rows and columns.

◆ GetCamera()

Camera* GetCamera ( )
inline

Returns the camera assigned to this map.

◆ GetLayers()

std::vector<Layer*>& GetLayers ( )
inline

Returns a reference to the layers of this map.

◆ GetParameters()

std::vector<jugimap::Parameter>& GetParameters ( )
inline

Returns a reference to the parameters of this map.

◆ GetWorldMapSize()

Vec2i GetWorldMapSize ( )
inline

Returns the world map size.

The returned value depends of the map type:

  • For a world map it is the size of the map.
  • For a parallax map it is the size of the linked world map.
  • For a screen map it is not defined (zero vector). This function should not be called before the map initalization (calling InitWorldMap, InitParallaxMap or InitScreenMap)!

◆ GetScreenMapDesignSize()

Vec2i GetScreenMapDesignSize ( )
inline

Returns the screen map design size.

The returned value depends of the map type:

  • For world maps and parallax maps it is not defined.
  • For a screen map it is the design size set at initialization. This function should not be called before the map initalization (calling InitWorldMap, InitParallaxMap or InitScreenMap)!

◆ GetSize()

Vec2i GetSize ( )
inline

Returns the size of this map.

◆ CaptureForLerpDrawing()

void CaptureForLerpDrawing ( )

Capture the sprite properties, usually the position only, required for the lerp drawing.

See also
Globals::SetUseLerpDrawing

◆ SetVisible()

virtual void SetVisible ( bool  _visible)
inlinevirtual

Set the visibility of this map.

See also
IsVisible

Reimplemented in MapNC, MapAGK, and MapCC.

◆ IsVisible()

bool IsVisible ( )
inline

Returns true if this map is visible; otherwise returns false.

See also
IsVisible

◆ AddSpriteLayer()

SpriteLayer * AddSpriteLayer ( const std::string &  _name)

Adds the given *_layer* to this map.

If the *_index* is specified the layer will be inserted at that position in the layers vector; otherwise it will be added at the end. This function is available for the cases where we manually create maps or layers.

◆ _SetName()

void _SetName ( const std::string &  _name)
inline

Sets the name of this map to the given *_name*.

This function is available for the cases where we manually create maps.

◆ _SetZOrderStart()

void _SetZOrderStart ( int  _zOrderStart)
inline

Sets the starting z-order.

This function should be used before loading the map to set starting z-order value for layers.

See also
GetZOrderStart

◆ GetZOrderStart()

int GetZOrderStart ( )
inline

Returns the starting z-order value.

See also
_SetZOrderStart

◆ RebuildWidgets()

void RebuildWidgets ( )

Returns the next z-order to be used with a next (manually) added layer to the map.


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