6 #ifndef GDCORE_RESOURCESMANAGER_H
7 #define GDCORE_RESOURCESMANAGER_H
12 #include "GDCore/String.h"
16 class SerializerElement;
17 class PropertyDescriptor;
51 virtual void SetUserAdded(
bool isUserAdded) { userAdded = isUserAdded; }
63 virtual bool UseFile()
const {
return false; }
86 originName = originName_;
87 originIdentifier = originIdentifier_;
90 virtual const gd::String& GetOriginName()
const {
return originName; }
91 virtual const gd::String& GetOriginIdentifier()
const {
return originIdentifier; }
126 virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties()
const;
155 bool userAdded =
false;
185 virtual void SetFile(
const gd::String& newFile)
override;
187 virtual bool UseFile()
const override {
return true; }
189 std::map<gd::String, gd::PropertyDescriptor> GetProperties()
const override;
234 virtual void SetFile(
const gd::String& newFile)
override;
236 virtual bool UseFile()
const override {
return true; }
238 std::map<gd::String, gd::PropertyDescriptor> GetProperties()
const override;
297 virtual void SetFile(
const gd::String& newFile)
override;
299 virtual bool UseFile()
const override {
return true; }
323 virtual void SetFile(
const gd::String& newFile)
override;
325 virtual bool UseFile()
const override {
return true; }
349 virtual void SetFile(
const gd::String& newFile)
override;
351 virtual bool UseFile()
const override {
return true; }
353 std::map<gd::String, gd::PropertyDescriptor> GetProperties()
const override;
405 virtual void SetFile(
const gd::String& newFile)
override;
407 virtual bool UseFile()
const override {
return true; }
409 std::map<gd::String, gd::PropertyDescriptor> GetProperties()
const override;
446 virtual void SetFile(
const gd::String& newFile)
override;
448 virtual bool UseFile()
const override {
return true; }
450 std::map<gd::String, gd::PropertyDescriptor> GetProperties()
const override;
487 virtual void SetFile(
const gd::String& newFile)
override;
489 virtual bool UseFile()
const override {
return true; }
513 virtual void SetFile(
const gd::String& newFile)
override;
515 virtual bool UseFile()
const override {
return true; }
539 virtual void SetFile(
const gd::String& newFile)
override;
541 virtual bool UseFile()
const override {
return true; }
566 bool HasResource(
const gd::String& name)
const;
593 std::shared_ptr<Resource> CreateResource(
const gd::String& kind);
598 const std::vector<std::shared_ptr<Resource>>&
GetAllResources()
const {
return resources; };
603 std::vector<gd::String> GetAllResourceNames()
const;
609 std::vector<gd::String> FindFilesNotInResources(
const std::vector<gd::String>& filePathsToCheck)
const;
614 std::shared_ptr<gd::Resource> GetResourceSPtr(
const gd::String& name);
643 std::size_t GetResourcePosition(
const gd::String& name)
const;
648 bool MoveResourceUpInList(
const gd::String& name);
653 bool MoveResourceDownInList(
const gd::String& name);
658 void MoveResource(std::size_t oldIndex, std::size_t newIndex);
688 bool MoveFolderUpInList(
const gd::String& name);
693 bool MoveFolderDownInList(
const gd::String& name);
698 std::vector<gd::String> GetAllFolderList();
718 std::vector<std::shared_ptr<Resource> > resources;
719 std::vector<ResourceFolder> folders;
744 virtual void AddResource(
const gd::String& name,
750 virtual void RemoveResource(
const gd::String& name);
755 virtual bool HasResource(
const gd::String& name)
const;
770 virtual std::vector<gd::String> GetAllResourceNames();
775 virtual bool MoveResourceUpInList(
const gd::String& name);
780 virtual bool MoveResourceDownInList(
const gd::String& name);
795 std::vector<std::shared_ptr<Resource> > resources;
Describe an atlas file used by a project.
Definition: ResourcesManager.h:530
virtual const gd::String & GetFile() const override
Return, if applicable, the String containing the file used by the resource. The file is relative to t...
Definition: ResourcesManager.h:538
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:541
Describe an audio file used by a project.
Definition: ResourcesManager.h:223
void SetPreloadAsMusic(bool enable=true)
Set if the audio resource should be preloaded as music.
Definition: ResourcesManager.h:253
bool PreloadAsSound() const
Return true if the audio resource should be preloaded as music.
Definition: ResourcesManager.h:258
bool PreloadAsMusic() const
Return true if the audio resource should be preloaded as music.
Definition: ResourcesManager.h:248
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:236
virtual const gd::String & GetFile() const override
Return, if applicable, the String containing the file used by the resource. The file is relative to t...
Definition: ResourcesManager.h:233
void SetPreloadAsSound(bool enable=true)
Set if the audio resource should be preloaded as music.
Definition: ResourcesManager.h:263
void SetPreloadInCache(bool enable=true)
Set if the audio resource should be preloaded in cache (without decoding into memory).
Definition: ResourcesManager.h:273
bool PreloadInCache() const
Return true if the audio resource should be preloaded in cache (without decoding into memory).
Definition: ResourcesManager.h:268
Describe a bitmap font file used by a project.
Definition: ResourcesManager.h:478
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:489
virtual const gd::String & GetFile() const override
Return, if applicable, the String containing the file used by the resource. The file is relative to t...
Definition: ResourcesManager.h:486
Describe a font file used by a project.
Definition: ResourcesManager.h:288
virtual const gd::String & GetFile() const override
Return, if applicable, the String containing the file used by the resource. The file is relative to t...
Definition: ResourcesManager.h:296
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:299
Describe an image/texture used by a project.
Definition: ResourcesManager.h:167
virtual const gd::String & GetFile() const override
Definition: ResourcesManager.h:180
bool IsSmooth() const
Return true if the image should be smoothed.
Definition: ResourcesManager.h:205
void SetSmooth(bool enable=true)
Set if the image should be smoothed in game.
Definition: ResourcesManager.h:210
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:187
bool smooth
True if smoothing filter is applied.
Definition: ResourcesManager.h:212
Describe a json file used by a project.
Definition: ResourcesManager.h:340
virtual const gd::String & GetFile() const override
Return, if applicable, the String containing the file used by the resource. The file is relative to t...
Definition: ResourcesManager.h:348
void DisablePreload(bool disable=true)
Set if the json preload at game startup must be disabled.
Definition: ResourcesManager.h:368
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:351
bool IsPreloadDisabled() const
Return true if the loading at game startup must be disabled.
Definition: ResourcesManager.h:363
Describe a 3D model file used by a project.
Definition: ResourcesManager.h:504
virtual const gd::String & GetFile() const override
Return, if applicable, the String containing the file used by the resource. The file is relative to t...
Definition: ResourcesManager.h:512
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:515
Definition: ResourcesManager.h:726
virtual const gd::String & GetName() const
Definition: ResourcesManager.h:739
virtual void SetName(const gd::String &name_)
Definition: ResourcesManager.h:735
Base class to describe a resource used by a game.
Definition: ResourcesManager.h:27
virtual void SerializeTo(SerializerElement &element) const
Serialize the object.
Definition: ResourcesManager.h:142
virtual const gd::String & GetMetadata() const
Return the (optional) metadata associated to the resource.
Definition: ResourcesManager.h:105
virtual void SetOrigin(const gd::String &originName_, const gd::String &originIdentifier_)
Definition: ResourcesManager.h:85
virtual void SetUserAdded(bool isUserAdded)
Change if the resource is user added or not.
Definition: ResourcesManager.h:51
virtual bool IsUserAdded() const
Return true if the resource was added by the user.
Definition: ResourcesManager.h:55
virtual const gd::String & GetName() const
Return the name of the resource.
Definition: ResourcesManager.h:39
virtual bool UseFile() const
Return true if the resource use a file.
Definition: ResourcesManager.h:63
virtual bool UpdateProperty(const gd::String &name, const gd::String &value)
Called when the IDE wants to update a custom property of the resource.
Definition: ResourcesManager.h:134
virtual void SetFile(const gd::String &newFile)
Change, if applicable, the file of the resource.
Definition: ResourcesManager.h:80
virtual void SetName(const gd::String &name_)
Change the name of the resource with the name passed as parameter.
Definition: ResourcesManager.h:35
virtual void SetKind(const gd::String &newKind)
Change the kind of the resource.
Definition: ResourcesManager.h:43
virtual void SetMetadata(const gd::String &metadata_)
Set the metadata (any string) associated to the resource.
Definition: ResourcesManager.h:98
virtual const gd::String & GetFile() const
Return, if applicable, the String containing the file used by the resource. The file is relative to t...
Definition: ResourcesManager.h:72
virtual void UnserializeFrom(const SerializerElement &element)
Unserialize the object.
Definition: ResourcesManager.h:147
virtual const gd::String & GetKind() const
Return the kind of the resource.
Definition: ResourcesManager.h:47
Inventory all resources used by a project.
Definition: ResourcesManager.h:556
const std::vector< std::shared_ptr< Resource > > & GetAllResources() const
Definition: ResourcesManager.h:598
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
Describe a spine json file used by a project.
Definition: ResourcesManager.h:381
String represents an UTF8 encoded string.
Definition: String.h:33
Describe a tilemap file used by a project.
Definition: ResourcesManager.h:396
void DisablePreload(bool disable=true)
Set if the tilemap preload at game startup must be disabled.
Definition: ResourcesManager.h:424
virtual const gd::String & GetFile() const override
Return, if applicable, the String containing the file used by the resource. The file is relative to t...
Definition: ResourcesManager.h:404
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:407
bool IsPreloadDisabled() const
Return true if the loading at game startup must be disabled.
Definition: ResourcesManager.h:419
Describe a tileset file used by a project.
Definition: ResourcesManager.h:437
void DisablePreload(bool disable=true)
Set if the tilemap preload at game startup must be disabled.
Definition: ResourcesManager.h:465
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:448
bool IsPreloadDisabled() const
Return true if the loading at game startup must be disabled.
Definition: ResourcesManager.h:460
virtual const gd::String & GetFile() const override
Return, if applicable, the String containing the file used by the resource. The file is relative to t...
Definition: ResourcesManager.h:445
Describe a video file used by a project.
Definition: ResourcesManager.h:314
virtual const gd::String & GetFile() const override
Return, if applicable, the String containing the file used by the resource. The file is relative to t...
Definition: ResourcesManager.h:322
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:325
Definition: CommonTools.h:24