JugiMap Framework
SpriteLayer Class Reference

The SpriteLayer class defines the sprite and tile layers from JugiMap Editor. More...

#include <jmLayers.h>

Inherits Layer.

Inherited by SpriteLayerAGK, SpriteLayerCC, and SpriteLayerNC.

Public Member Functions

 SpriteLayer ()
 Constructor. More...
 
virtual void InitEngineObjects () override
 Initialize all engine objects related to this layer and its content. More...
 
virtual void InitLayerParameters () override
 Initialize layer properties from the parameters set in the editor. More...
 
virtual void UpdateEngineObjects () override
 Update all engine objects related to this layer and its content. More...
 
virtual void DrawEngineObjects () override
 Draw all engine objects related to this layer and its content. More...
 
std::vector< Sprite * > & GetSprites ()
 Returns a reference to the vector of stored sprites in this sprite layer. More...
 
virtual void UpdateBoundingBox () override
 Update the map bounding box of this sprite layer. More...
 
void SetAlpha (float _alpha)
 Sets the alpha factor of this sprite layer to the given *_alpha*. More...
 
float GetAlpha ()
 Returns the alpha factor of this sprite layer. More...
 
void SetBlend (Blend _blend)
 Sets the blend factor of this sprite layer to the given *_blend*. More...
 
Blend GetBlend ()
 Returns the blend factor of this sprite layer. More...
 
void AddSprite (Sprite *_sprite)
 Adds a new sprite to this sprite layer. More...
 
virtual void RemoveAndDeleteSprite (Sprite *_sprite)
 Remove and delete the given sprite *_sprite* from this sprite layer. More...
 
void CaptureForLerpDrawing ()
 Capture the sprite properties, usually the position only, required for the lerp drawing. More...
 
void SetSpritesChanged (bool _spritesChanged)
 Set the sprites changed flag which indicates that this sprite layer has sprites with changed properites. More...
 
bool IsSpritesChanged ()
 Returns 'true' if this sprite layer has sprites with changed properties; otherwise returns false. More...
 
void SetSpritesChangeFlag (int _spritesChangeFlag)
 Set the sprites changes flag to the given **_changedFlags**. More...
 
void AppendToSpritesChangeFlag (int _spritesChangeFlag)
 Append the given *_spritesChangeFlag* to the current sprites changes flag using bitwise operation. More...
 
int GetSpritesChangeFlag ()
 Returns the sprites changes flag. More...
 
bool IsEditorTileLayer ()
 Returns true if this layer was a tile layer in JugiMap Editor; if it was a sprite layer returns false. More...
 
- Public Member Functions inherited from Layer
 Layer ()
 Constructor. More...
 
MapGetMap ()
 Returns a Map object where this layer is stored. More...
 
ComposedSpriteGetParentComposedSprite ()
 Returns a ComposedSprite where this layer is stored or nullptr if it is stored in a map. More...
 
bool IsMapLayer ()
 Returns true if this layer is stored in a Map; if it's stored in a ComposedSprite returns false. More...
 
LayerKind GetKind ()
 Returns the kind of this layer. More...
 
std::string GetName ()
 Returns the name of this layer. More...
 
std::vector< jugimap::Parameter > & GetParameters ()
 Returns a reference to the vector of stored paramters in this layer. More...
 
int GetZOrder ()
 Returns the zOrder of this layer. More...
 
Rectf GetBoundingBox ()
 Returns the map bounding box of this layer. More...
 
LayerType GetLayerType ()
 Returns the LayerType factor of this layer. More...
 
StretchingVariant GetStretchingVariant ()
 Returns the AlignX factor of this layer. More...
 
Vec2i GetAlignPosition ()
 Returns the allign position factor of this layer. More...
 
Vec2f GetAlignOffset ()
 Returns the allign offset factor of this layer. More...
 
Vec2f GetLayersPlaneSize ()
 Returns the layers plane size of this layer. More...
 
Vec2f GetParallaxFactor ()
 Returns the ParallaxLayerMode factor of this layer. More...
 
Vec2f GetParallaxOffset ()
 Returns the parallax offset of this layer. More...
 
void _SetName (const std::string &_name)
 Returns the ScreenLayerMode factor of this layer. More...
 
void _SetKind (LayerKind _kind)
 Sets the kind of this layer to the given *_kind*. More...
 
void _SetLayerType (LayerType _layerType)
 Sets the layer mode of this layer to the given *_layerType*. More...
 
void _SetParallaxFactor (Vec2f _parallaxFactor)
 Sets the parallax factor of this layer to the given *_parallaxFactor*. More...
 
void _SetAlignPosition (Vec2i _alignPosition)
 Sets the align position of this layer to the given *_alignPosition*. More...
 
void _SetAlignOffset (Vec2f _alignOffset)
 Sets the align offset of this layer to the given *_alignOffset*. More...
 
void _SetAttachToLayer (std::string _attachToLayer)
 Sets the 'attachToLayer' of this layer to the given *_attachToLayer*. More...
 
void _SetStretchingVariant (StretchingVariant _stretchingVariant)
 Sets the stretching variant of this layer to the given *_stretchingVariant*. More...
 
void _SetZOrder (int _zOrder)
 Sets the z-order factor of this layer to the given *_zOrder*. More...
 

Protected Member Functions

virtual ~SpriteLayer () override
 Destructor. More...
 
- Protected Member Functions inherited from Layer
virtual ~Layer ()
 Destructor. More...
 

Detailed Description

The SpriteLayer class defines the sprite and tile layers from JugiMap Editor.

A sprite layer stores Sprite objects and is their owner.

Constructor & Destructor Documentation

◆ SpriteLayer()

Constructor.

◆ ~SpriteLayer()

~SpriteLayer ( )
overrideprotectedvirtual

Destructor.

Member Function Documentation

◆ InitEngineObjects()

void InitEngineObjects ( )
overridevirtual

Initialize all engine objects related to this layer and its content.

This function should usually not be used manually as it gets called in the Map::InitEngineMap function.

Reimplemented from Layer.

◆ InitLayerParameters()

void InitLayerParameters ( )
overridevirtual

Initialize layer properties from the parameters set in the editor.

This function should usually not be used manually as it gets called in the Map::InitMapParameters function.

Reimplemented from Layer.

◆ UpdateEngineObjects()

void UpdateEngineObjects ( )
overridevirtual

Update all engine objects related to this layer and its content.

This function should usually not be used manually as it gets called in the Map::UpdateEngineMap function.

Reimplemented from Layer.

Reimplemented in SpriteLayerAGK.

◆ DrawEngineObjects()

void DrawEngineObjects ( )
overridevirtual

Draw all engine objects related to this layer and its content.

This function should usually not be used manually as it gets called in the Map::DrawEngineMap function. It is needed only for the engines which do not handle drawing (rendering) internally.

Reimplemented from Layer.

◆ GetSprites()

std::vector<Sprite*>& GetSprites ( )
inline

Returns a reference to the vector of stored sprites in this sprite layer.

◆ UpdateBoundingBox()

void UpdateBoundingBox ( )
overridevirtual

Update the map bounding box of this sprite layer.

Reimplemented from Layer.

◆ SetAlpha()

void SetAlpha ( float  _alpha)

Sets the alpha factor of this sprite layer to the given *_alpha*.

The alpha (opacity) factor is in the scale of [0.0 - 1.0].

See also
GetAlpha

◆ GetAlpha()

float GetAlpha ( )

Returns the alpha factor of this sprite layer.

See also
SetAlpha

◆ SetBlend()

void SetBlend ( Blend  _blend)

Sets the blend factor of this sprite layer to the given *_blend*.

See also
GetBlend

◆ GetBlend()

Blend GetBlend ( )
inline

Returns the blend factor of this sprite layer.

See also
SetBlend

◆ AddSprite()

void AddSprite ( Sprite _sprite)

Adds a new sprite to this sprite layer.

Important: This sprite layer will take over the ownership of the added sprite.

◆ RemoveAndDeleteSprite()

void RemoveAndDeleteSprite ( Sprite _sprite)
virtual

Remove and delete the given sprite *_sprite* from this sprite layer.

If the sprite belong to other layer it will not be deleted.

Reimplemented in SpriteLayerNC, and SpriteLayerCC.

◆ CaptureForLerpDrawing()

void CaptureForLerpDrawing ( )

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

See also
Globals::SetUseLerpDrawing

◆ SetSpritesChanged()

void SetSpritesChanged ( bool  _spritesChanged)
inline

Set the sprites changed flag which indicates that this sprite layer has sprites with changed properites.

Set to true whenever a sprite has a property change which require an update of the engine sprite. Set to false after engine sprites has been updated. This function should usually not be used manually as it is called by functions which change sprite properties and the UpdateEngineLayer function.

See also
IsSpritesChanged

◆ IsSpritesChanged()

bool IsSpritesChanged ( )
inline

Returns 'true' if this sprite layer has sprites with changed properties; otherwise returns false.

See also
SetSpritesChanged

◆ SetSpritesChangeFlag()

void SetSpritesChangeFlag ( int  _spritesChangeFlag)
inline

Set the sprites changes flag to the given **_changedFlags**.

The sprites changes flag affects all stored sprites. It must be a value or a bitwise combination of values defined in the Sprite::Property enumerator. This function should usually not be used manually as it is called by functions which change sprite properties.

See also
AppendToSpritesChangeFlag, GetSpritesChangeFlag

◆ AppendToSpritesChangeFlag()

void AppendToSpritesChangeFlag ( int  _spritesChangeFlag)
inline

Append the given *_spritesChangeFlag* to the current sprites changes flag using bitwise operation.

See also
SetSpritesChangeFlag, GetSpritesChangeFlag

◆ GetSpritesChangeFlag()

int GetSpritesChangeFlag ( )
inline

Returns the sprites changes flag.

See also
SetSpritesChangeFlag, AppendToSpritesChangeFlag

◆ IsEditorTileLayer()

bool IsEditorTileLayer ( )
inline

Returns true if this layer was a tile layer in JugiMap Editor; if it was a sprite layer returns false.

The SpriteLayer makes no distinction between the tile layers and sprite layers from the editor. However an extended class for a particlar game engine may found that information useful.


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