1 #ifndef JUGIMAP_SOURCE_GRAPHICS_H
2 #define JUGIMAP_SOURCE_GRAPHICS_H
17 class TimelineAnimation;
25 class JugiMapBinaryLoader;
39 friend class Administrator;
128 float spineScale = 1.0;
130 std::vector<VectorShape*>spriteShapes;
131 std::vector<VectorShape*>extraShapes;
136 int colorStyleId = 0;
153 friend class Administrator;
183 std::vector<GraphicItem*>&
GetItems() {
return items;}
202 std::string relativeFilePath;
204 std::vector<GraphicItem*>items;
205 std::string spineAtlasRelativeFilePath;
226 friend class Administrator;
227 friend class JMSprite;
284 std::vector<Parameter> constantParameters;
285 std::vector<GraphicItem*>graphicItems;
286 std::vector<FrameAnimation*>frameAnimations;
287 std::vector<TimelineAnimation*>timelineAnimations;
289 std::vector<Parameter> parametersTMP;
292 bool initialized =
false;
299 SourceSprite(
SpriteKind _kind) : kind(_kind){}
301 SourceSprite(
const SourceSprite &ss) =
delete;
302 SourceSprite & operator=(
const SourceSprite &ss) =
delete;
313 struct SourceSpriteReplacement
315 SourceSprite * sourceSprite =
nullptr;
316 std::string childSpriteName;
319 SourceSpriteReplacement(SourceSprite * _sourceSprite,
const std::string &_childSpriteName) :
320 sourceSprite(_sourceSprite),
321 childSpriteName(_childSpriteName)
327 struct SourceSpriteReplacements
330 std::vector<SourceSpriteReplacement>replacements;
331 SourceSprite * originalSourceSprite =
nullptr;
333 SourceSpriteReplacements(SourceSprite * _sourceSprite,
const std::string &_childSpriteName, SourceSprite * _originalSourceSprite)
334 :originalSourceSprite(_originalSourceSprite)
336 replacements.push_back(SourceSpriteReplacement(_sourceSprite, _childSpriteName));
339 SourceSprite * FindSourceSpriteForChild(
const std::string &_childSpriteName);
371 std::vector<GraphicFile*>&
GetFiles(){
return files;}
378 static void DeleteGlobalData();
383 std::vector<GraphicFile*>files;
384 std::vector<SourceSprite*>sourceSprites;
The file kind not defined.
ComposedSprite * GetSourceComposedSprite()
Returns a pointer to the owned source composed sprite or nullptr if there is none.
Definition: jmSourceGraphics.h:278
std::vector< GraphicFile * > & GetFiles()
Returns a reference to the vector of stored graphic files.
Definition: jmSourceGraphics.h:371
virtual ~GraphicFile()
Destructor.
Definition: jmSourceGraphics.cpp:40
virtual ~GraphicItem()
Destructor.
Definition: jmSourceGraphics.cpp:23
The source sprite has image(s) with multiple sprite shapes.
Definition: jmSourceGraphics.h:239
std::string GetRelativeFilePath()
Returns the relative file path of this file.
Definition: jmSourceGraphics.h:175
TextHandleVariant GetTextHandleVariant()
Returns the text handle variant if this graphic item belong to text sprite.
Definition: jmSourceGraphics.h:106
SpriteKind
The kinds of sprite. Used as identifier for Sprite objects.
Definition: jmGlobal.h:30
Vec2i GetSize()
Returns the size of sub-image if this graphic item belongs to an image file.
Definition: jmSourceGraphics.h:75
std::vector< GraphicItem * > & GetItems()
Returns a reference to the vector of stored graphic items in this file.
Definition: jmSourceGraphics.h:183
FileKind GetKind()
Returns the kind of this file.
Definition: jmSourceGraphics.h:171
int GetHeight()
Returns the height of sub-image if this graphic item belongs to an image file.
Definition: jmSourceGraphics.h:71
float GetSpineScale()
Returns the spine scale if this graphic item belongs to a Spine file.
Definition: jmSourceGraphics.h:83
Vec2i GetPos()
Returns the position of sub-image if this graphic item belong to an image file.
Definition: jmSourceGraphics.h:63
int GetWidth()
Returns the width of sub-image if this graphic item belongs to an image file.
Definition: jmSourceGraphics.h:67
~SourceGraphics()
Destructor.
Definition: jmSourceGraphics.cpp:152
Status
The status flags for standard source sprites (SpriteKind::STANDARD).
Definition: jmSourceGraphics.h:235
virtual void Init()
Initialize this graphic item.
Definition: jmSourceGraphics.cpp:16
std::string GetSpineAtlasRelativeFilePath()
Returns the relative file path of the spine atlas if this file is a Spine file.
Definition: jmSourceGraphics.h:187
std::string GetName()
Returns the name of this graphic item.
Definition: jmSourceGraphics.h:59
int GetColorStyleId()
Returns the color style id if this graphic item belong to text sprite.
Definition: jmSourceGraphics.h:102
SourceGraphics()
Constructor.
Definition: jmSourceGraphics.h:359
The GraphicItem class defines the equivalent object from JugiMap Editor.
Definition: jmSourceGraphics.h:34
std::vector< SourceSprite * > & GetSourceSprites()
Returns a reference to the vector of stored source sprites.
Definition: jmSourceGraphics.h:375
The StandardSprite class defines the sprite from JugiMap Editor.
Definition: jmSprites.h:787
int GetFontStyleId()
Returns the font style id if this graphic item belong to text sprite.
Definition: jmSourceGraphics.h:99
std::vector< Parameter > & GetConstantParameters()
Returns a reference to the vector of stored constant parameters in this source sprite.
Definition: jmSourceGraphics.h:258
The SourceGraphics class represents source graphics elements from JugiMap Editor.
Definition: jmSourceGraphics.h:351
std::vector< VectorShape * > & GetSpriteShapes()
Returns a reference to sprite shapes if this graphic item belong to an image file.
Definition: jmSourceGraphics.h:87
The sprite kind not defined.
FileKind
The kinds of file.
Definition: jmGlobal.h:17
Vec2< T > min
The minimum coordinate (the left-top corner when y coordinate points downward).
Definition: jmCommon.h:177
The GraphicFile class defines the equivalent object from JugiMap Editor.
Definition: jmSourceGraphics.h:148
std::vector< VectorShape * > & GetExtraShapes()
Returns a reference to probe shapes if this graphic item belong to an image file.
Definition: jmSourceGraphics.h:91
T GetHeight() const
Returns the height of this rectangle.
Definition: jmCommon.h:204
std::string GetLabel()
Returns the text if this graphic item belong to text sprite.
Definition: jmSourceGraphics.h:95
SpriteKind GetKind()
Returns the kind of this source sprite.
Definition: jmSourceGraphics.h:250
The SkeletonSprite class defines the skeleton sprite from JugiMap Editor.
Definition: jmSprites.h:1011
GraphicFile()
Constructor.
Definition: jmSourceGraphics.h:193
Vec2f GetHandle()
Returns the handle of sub-image if this graphic item belongs to an image file.
Definition: jmSourceGraphics.h:79
virtual void Init()
Initialize this GraphicFile.
Definition: jmSourceGraphics.h:167
T GetWidth() const
Returns the width of this rectangle.
Definition: jmCommon.h:201
Vec2< T > GetSize() const
Returns a vector storing the size of this rectangle; the width is stored in x and the height is store...
Definition: jmCommon.h:227
Vec2i GetSize()
Returns the size of image if this file is an image.
Definition: jmSourceGraphics.h:179
void Init()
Initialize this source sprite.
Definition: jmSourceGraphics.cpp:63
std::vector< GraphicItem * > & GetGraphicItems()
Returns a reference to the vector of graphic items in this source sprite.
Definition: jmSourceGraphics.h:262
std::string GetName()
Returns the name of this source sprite.
Definition: jmSourceGraphics.h:254
std::vector< FrameAnimation * > & GetFrameAnimations()
Returns a reference to the vector of stored frame animations in this source sprite.
Definition: jmSourceGraphics.h:266
Has image(s) with defined sprite shapes.
Definition: jmSourceGraphics.h:237
GraphicItem()
Constructor.
Definition: jmSourceGraphics.h:112
The ObjectFactory is the base class for engine specific object factories.
Definition: jmObjectFactory.h:48
The ComposedSprite class defines the composed sprite from JugiMap Editor.
Definition: jmSprites.h:682
static std::string pathPrefix
An optional string attached to stored file paths. It must end with slash '/'!
Definition: jmSourceGraphics.h:159
std::vector< TimelineAnimation * > & GetTimelineAnimations()
Returns a reference to the vector of stored timeline animations in this source sprite.
Definition: jmSourceGraphics.h:270
Has more images and they do not have all the same sprite shapes.
Definition: jmSourceGraphics.h:238
void DeleteContent()
Delete stored SourceGraphics objects and GraphicFile objects.
Definition: jmSourceGraphics.cpp:159
The SourceSprite class defines the source sprite from JugiMap Editor.
Definition: jmSourceGraphics.h:221
int GetStatusFlags()
Returns the status flags.
Definition: jmSourceGraphics.h:274
GraphicFile * GetFile()
Returns the graphic file of this graphic item.
Definition: jmSourceGraphics.h:55
TextHandleVariant
Predefined handles for TextSprite objects.
Definition: jmGlobal.h:229
Has images of different size.
Definition: jmSourceGraphics.h:236
The JugiMapBinaryLoader class loads data from jugimap binary files (.jmb).
Definition: jmMapBinaryLoader.h:37