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;
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;
235 virtual void SetFile(
const gd::String& newFile)
override;
237 virtual bool UseFile()
const override {
return true; }
239 std::map<gd::String, gd::PropertyDescriptor> GetProperties()
const override;
298 virtual void SetFile(
const gd::String& newFile)
override;
300 virtual bool UseFile()
const override {
return true; }
324 virtual void SetFile(
const gd::String& newFile)
override;
326 virtual bool UseFile()
const override {
return true; }
350 virtual void SetFile(
const gd::String& newFile)
override;
352 virtual bool UseFile()
const override {
return true; }
354 std::map<gd::String, gd::PropertyDescriptor> GetProperties()
const override;
406 virtual void SetFile(
const gd::String& newFile)
override;
408 virtual bool UseFile()
const override {
return true; }
410 std::map<gd::String, gd::PropertyDescriptor> GetProperties()
const override;
447 virtual void SetFile(
const gd::String& newFile)
override;
449 virtual bool UseFile()
const override {
return true; }
451 std::map<gd::String, gd::PropertyDescriptor> GetProperties()
const override;
488 virtual void SetFile(
const gd::String& newFile)
override;
490 virtual bool UseFile()
const override {
return true; }
514 virtual void SetFile(
const gd::String& newFile)
override;
516 virtual bool UseFile()
const override {
return true; }
540 virtual void SetFile(
const gd::String& newFile)
override;
542 virtual bool UseFile()
const override {
return true; }
567 bool HasResource(
const gd::String& name)
const;
594 std::shared_ptr<Resource> CreateResource(
const gd::String& kind);
599 const std::vector<std::shared_ptr<Resource>>&
GetAllResources()
const {
return resources; };
604 std::vector<gd::String> GetAllResourceNames()
const;
610 std::vector<gd::String> FindFilesNotInResources(
const std::vector<gd::String>& filePathsToCheck)
const;
615 std::shared_ptr<gd::Resource> GetResourceSPtr(
const gd::String& name);
644 std::size_t GetResourcePosition(
const gd::String& name)
const;
649 bool MoveResourceUpInList(
const gd::String& name);
654 bool MoveResourceDownInList(
const gd::String& name);
659 void MoveResource(std::size_t oldIndex, std::size_t newIndex);
689 bool MoveFolderUpInList(
const gd::String& name);
694 bool MoveFolderDownInList(
const gd::String& name);
699 std::vector<gd::String> GetAllFolderList();
719 std::vector<std::shared_ptr<Resource> > resources;
720 std::vector<ResourceFolder> folders;
745 virtual void AddResource(
const gd::String& name,
751 virtual void RemoveResource(
const gd::String& name);
756 virtual bool HasResource(
const gd::String& name)
const;
771 virtual std::vector<gd::String> GetAllResourceNames();
776 virtual bool MoveResourceUpInList(
const gd::String& name);
781 virtual bool MoveResourceDownInList(
const gd::String& name);
796 std::vector<std::shared_ptr<Resource> > resources;
Describe an atlas file used by a project.
Definition: ResourcesManager.h:531
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:539
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:542
Describe an audio file used by a project.
Definition: ResourcesManager.h:224
void SetPreloadAsMusic(bool enable=true)
Set if the audio resource should be preloaded as music.
Definition: ResourcesManager.h:254
bool PreloadAsSound() const
Return true if the audio resource should be preloaded as music.
Definition: ResourcesManager.h:259
bool PreloadAsMusic() const
Return true if the audio resource should be preloaded as music.
Definition: ResourcesManager.h:249
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:237
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:234
void SetPreloadAsSound(bool enable=true)
Set if the audio resource should be preloaded as music.
Definition: ResourcesManager.h:264
void SetPreloadInCache(bool enable=true)
Set if the audio resource should be preloaded in cache (without decoding into memory).
Definition: ResourcesManager.h:274
bool PreloadInCache() const
Return true if the audio resource should be preloaded in cache (without decoding into memory).
Definition: ResourcesManager.h:269
Describe a bitmap font file used by a project.
Definition: ResourcesManager.h:479
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:490
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:487
Describe a font file used by a project.
Definition: ResourcesManager.h:289
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:297
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:300
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
bool alwaysLoaded
True if the image must always be loaded in memory.
Definition: ResourcesManager.h:213
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:341
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:349
void DisablePreload(bool disable=true)
Set if the json preload at game startup must be disabled.
Definition: ResourcesManager.h:369
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:352
bool IsPreloadDisabled() const
Return true if the loading at game startup must be disabled.
Definition: ResourcesManager.h:364
Describe a 3D model file used by a project.
Definition: ResourcesManager.h:505
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:513
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:516
Definition: ResourcesManager.h:727
virtual const gd::String & GetName() const
Definition: ResourcesManager.h:740
virtual void SetName(const gd::String &name_)
Definition: ResourcesManager.h:736
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:557
const std::vector< std::shared_ptr< Resource > > & GetAllResources() const
Definition: ResourcesManager.h:599
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:382
String represents an UTF8 encoded string.
Definition: String.h:31
Describe a tilemap file used by a project.
Definition: ResourcesManager.h:397
void DisablePreload(bool disable=true)
Set if the tilemap preload at game startup must be disabled.
Definition: ResourcesManager.h:425
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:405
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:408
bool IsPreloadDisabled() const
Return true if the loading at game startup must be disabled.
Definition: ResourcesManager.h:420
Describe a tileset file used by a project.
Definition: ResourcesManager.h:438
void DisablePreload(bool disable=true)
Set if the tilemap preload at game startup must be disabled.
Definition: ResourcesManager.h:466
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:449
bool IsPreloadDisabled() const
Return true if the loading at game startup must be disabled.
Definition: ResourcesManager.h:461
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:446
Describe a video file used by a project.
Definition: ResourcesManager.h:315
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:323
virtual bool UseFile() const override
Return true if the resource use a file.
Definition: ResourcesManager.h:326
Definition: CommonTools.h:24