1 #ifndef JUGIMAP_LAYERS_H
2 #define JUGIMAP_LAYERS_H
19 class JugiMapBinaryLoader;
79 bool IsMapLayer(){
return (parentComposedSprite==
nullptr); }
179 void _SetName(
const std::string &_name){ name = _name; }
240 bool UpdateParallaxOffset();
251 std::string name =
"Layer";
252 std::vector<jugimap::Parameter> parameters;
264 Vec2f parallaxFactor;
267 Vec2i tilingSpacingDelta;
268 Vec2i tilingCountAutoSpread;
271 Vec2f parallaxOffset;
283 Vec2i alignOffset_obtainFromMap;
285 std::string attachToLayer;
286 Vec2f layersPlaneSize;
378 int FindLastZOrder();
409 spritesChangeFlag = _spritesChangeFlag;
410 if(spritesChangeFlag!=0){
411 spritesChanged =
true;
421 spritesChangeFlag |= _spritesChangeFlag;
422 if(spritesChangeFlag!=0){
423 spritesChanged =
true;
456 std::vector<Sprite*>sprites;
457 bool editorTileLayer =
false;
458 bool spritesChanged =
false;
459 int spritesChangeFlag = 0;
464 void UpdateSingleSpriteStretch(
Vec2i _designSize,
bool _stretchX,
bool _stretchY);
465 bool UpdateStretchingSingleSpriteLayer();
513 std::vector<VectorShape*>vectorShapes;
virtual void UpdateEngineObjects()
Update all engine objects related to this layer and its content.
Definition: jmLayers.h:58
virtual ~SpriteLayer() override
Destructor.
Definition: jmLayers.cpp:210
LayerType GetLayerType()
Returns the LayerType factor of this layer.
Definition: jmLayers.h:111
Vec2i GetAlignPosition()
Returns the allign position factor of this layer.
Definition: jmLayers.h:131
std::vector< Sprite * > & GetSprites()
Returns a reference to the vector of stored sprites in this sprite layer.
Definition: jmLayers.h:323
VectorLayer()
Constructor.
Definition: jmLayers.cpp:641
The Layer class is the base class for layers.
Definition: jmLayers.h:27
int GetZOrder()
Returns the zOrder of this layer.
Definition: jmLayers.h:97
void _SetName(const std::string &_name)
Returns the ScreenLayerMode factor of this layer.
Definition: jmLayers.h:179
void SetSpritesChangeFlag(int _spritesChangeFlag)
Set the sprites changes flag to the given **_changedFlags**.
Definition: jmLayers.h:407
virtual void InitLayerParameters()
Initialize layer properties from the parameters set in the editor.
Definition: jmLayers.cpp:18
Color in RGBA color space - integer variant.
Definition: jmColor.h:15
std::vector< jugimap::Parameter > & GetParameters()
Returns a reference to the vector of stored paramters in this layer.
Definition: jmLayers.h:91
Map * GetMap()
Returns a Map object where this layer is stored.
Definition: jmLayers.h:71
bool IsMapLayer()
Returns true if this layer is stored in a Map; if it's stored in a ComposedSprite returns false.
Definition: jmLayers.h:79
std::string GetName()
Returns the name of this layer.
Definition: jmLayers.h:87
void _SetAlignOffset(Vec2f _alignOffset)
Sets the align offset of this layer to the given *_alignOffset*.
Definition: jmLayers.h:212
virtual void InitLayerParameters() override
Initialize layer properties from the parameters set in the editor.
Definition: jmLayers.cpp:236
void _SetLayerType(LayerType _layerType)
Sets the layer mode of this layer to the given *_layerType*.
Definition: jmLayers.h:191
StretchingVariant
The stretching variants.
Definition: jmGlobal.h:76
LayerKind
The kinds of layer. Used as identifier for Layer objects.
Definition: jmGlobal.h:51
Layer()
Constructor.
Definition: jmLayers.h:36
Rectf GetBoundingBox()
Returns the map bounding box of this layer.
Definition: jmLayers.h:105
std::vector< VectorShape * > & GetVectorShapes()
Returns a reference to the vector of stored shapes in this vector layer.
Definition: jmLayers.h:496
Vec2f GetParallaxFactor()
Returns the ParallaxLayerMode factor of this layer.
Definition: jmLayers.h:158
Vec2f GetParallaxOffset()
Returns the parallax offset of this layer.
Definition: jmLayers.h:165
int GetSpritesChangeFlag()
Returns the sprites changes flag.
Definition: jmLayers.h:430
void AppendToSpritesChangeFlag(int _spritesChangeFlag)
Append the given *_spritesChangeFlag* to the current sprites changes flag using bitwise operation.
Definition: jmLayers.h:419
The StandardSprite class defines the sprite from JugiMap Editor.
Definition: jmSprites.h:787
virtual void InitEngineObjects()
Initialize all engine objects related to this layer and its content.
Definition: jmLayers.h:52
virtual void UpdateEngineObjects() override
Update all engine objects related to this layer and its content.
Definition: jmLayers.cpp:665
void _SetParallaxFactor(Vec2f _parallaxFactor)
Sets the parallax factor of this layer to the given *_parallaxFactor*.
Definition: jmLayers.h:198
void _SetAlignPosition(Vec2i _alignPosition)
Sets the align position of this layer to the given *_alignPosition*.
Definition: jmLayers.h:205
virtual void UpdateBoundingBox() override
Update the map bounding box of this sprite layer.
Definition: jmLayers.cpp:590
virtual ~Layer()
Destructor.
Definition: jmLayers.h:238
The Sprite is the base sprite class.
Definition: jmSprites.h:32
virtual void DrawEngineObjects()
Draw all engine objects related to this layer and its content.
Definition: jmLayers.h:65
virtual void UpdateBoundingBox() override
Update the map bounding box of this layer.
Definition: jmLayers.cpp:687
virtual void DrawEngineObjects() override
Draw all engine objects related to this layer and its content.
Definition: jmLayers.cpp:316
void _SetZOrder(int _zOrder)
Sets the z-order factor of this layer to the given *_zOrder*.
Definition: jmLayers.h:232
void _SetStretchingVariant(StretchingVariant _stretchingVariant)
Sets the stretching variant of this layer to the given *_stretchingVariant*.
Definition: jmLayers.h:226
The layer kind not defined.
bool IsEditorTileLayer()
Returns true if this layer was a tile layer in JugiMap Editor; if it was a sprite layer returns false...
Definition: jmLayers.h:440
virtual void InitEngineObjects() override
Initialize all engine objects related to this layer and its content.
Definition: jmLayers.cpp:218
Vec2f GetAlignOffset()
Returns the allign offset factor of this layer.
Definition: jmLayers.h:137
float GetAlpha()
Returns the alpha factor of this sprite layer.
Definition: jmLayers.cpp:520
virtual void UpdateBoundingBox()
Update the map bounding box of this layer.
Definition: jmLayers.h:101
void CaptureForLerpDrawing()
Capture the sprite properties, usually the position only, required for the lerp drawing.
Definition: jmLayers.cpp:602
ComposedSprite * GetParentComposedSprite()
Returns a ComposedSprite where this layer is stored or nullptr if it is stored in a map.
Definition: jmLayers.h:75
virtual ~VectorLayer() override
Destructor.
Definition: jmLayers.cpp:647
virtual void InitLayerParameters() override
Initialize layer properties from the parameters set in the editor.
Definition: jmLayers.cpp:654
StretchingVariant GetStretchingVariant()
Returns the AlignX factor of this layer.
Definition: jmLayers.h:125
void _SetKind(LayerKind _kind)
Sets the kind of this layer to the given *_kind*.
Definition: jmLayers.h:185
bool IsSpritesChanged()
Returns 'true' if this sprite layer has sprites with changed properties; otherwise returns false.
Definition: jmLayers.h:397
virtual void RemoveAndDeleteSprite(Sprite *_sprite)
Remove and delete the given sprite *_sprite* from this sprite layer.
Definition: jmLayers.cpp:574
void SetAlpha(float _alpha)
Sets the alpha factor of this sprite layer to the given *_alpha*.
Definition: jmLayers.cpp:504
Vec2f GetLayersPlaneSize()
Returns the layers plane size of this layer.
Definition: jmLayers.h:143
The Font class defines fonts used in TextSprite objects.
Definition: jmFont.h:16
virtual void UpdateEngineObjects() override
Update all engine objects related to this layer and its content.
Definition: jmLayers.cpp:267
SpriteLayer()
Constructor.
Definition: jmLayers.cpp:204
LayerKind GetKind()
Returns the kind of this layer.
Definition: jmLayers.h:83
Blend
The blend modes for the openGL pixel blending.
Definition: jmGlobal.h:101
The ComposedSprite class defines the composed sprite from JugiMap Editor.
Definition: jmSprites.h:682
void SetBlend(Blend _blend)
Sets the blend factor of this sprite layer to the given *_blend*.
Definition: jmLayers.cpp:512
void AddSprite(Sprite *_sprite)
Adds a new sprite to this sprite layer.
Definition: jmLayers.cpp:530
LayerType
The types of layer. Used to distinguish layers for world, parallax and screen maps.
Definition: jmGlobal.h:64
The SourceSprite class defines the source sprite from JugiMap Editor.
Definition: jmSourceGraphics.h:221
void AddVectorShape(VectorShape *_vs)
Adds a new vector shape to this vector layer.
Definition: jmLayers.h:502
TextHandleVariant
Predefined handles for TextSprite objects.
Definition: jmGlobal.h:229
The TextSprite class defines the text sprite from JugiMap Editor.
Definition: jmSprites.h:889
The VectorLayer class defines the vector layer from JugiMap Editor.
Definition: jmLayers.h:477
The VectorShape class defines the vector shape from JugiMap Editor.
Definition: jmVectorShapes.h:206
The JugiMapBinaryLoader class loads data from jugimap binary files (.jmb).
Definition: jmMapBinaryLoader.h:37
The Map class defines the map element from JugiMap Editor.
Definition: jmMap.h:26
void SetSpritesChanged(bool _spritesChanged)
Set the sprites changed flag which indicates that this sprite layer has sprites with changed properit...
Definition: jmLayers.h:391
The SpriteLayer class defines the sprite and tile layers from JugiMap Editor.
Definition: jmLayers.h:303
Blend GetBlend()
Returns the blend factor of this sprite layer.
Definition: jmLayers.h:352
void _SetAttachToLayer(std::string _attachToLayer)
Sets the 'attachToLayer' of this layer to the given *_attachToLayer*.
Definition: jmLayers.h:219