GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Member Functions | Static Public Member Functions | List of all members
gd::ResourcesManager Class Reference

Inventory all resources used by a project. More...

#include <ResourcesManager.h>

Public Member Functions

 ResourcesManager (const ResourcesManager &)
 
ResourcesManageroperator= (const ResourcesManager &rhs)
 
bool HasResource (const gd::String &name) const
 Return true if a resource exists.
 
const gd::StringGetResourceNameWithOrigin (const gd::String &originName, const gd::String &originIdentifier) const
 Return the name of the resource with the given origin, if any. If not found, an empty string is returned.
 
const gd::StringGetResourceNameWithFile (const gd::String &file) const
 Return the name of the first resource with the given file, if any. If not found, an empty string is returned.
 
ResourceGetResource (const gd::String &name)
 Return a reference to a resource.
 
const ResourceGetResource (const gd::String &name) const
 Return a reference to a resource.
 
std::shared_ptr< ResourceCreateResource (const gd::String &kind)
 Create a new resource but does not add it to the list.
 
const std::vector< std::shared_ptr< Resource > > & GetAllResources () const
 
std::vector< gd::StringGetAllResourceNames () const
 Get a list containing the names of all resources.
 
std::vector< gd::StringFindFilesNotInResources (const std::vector< gd::String > &filePathsToCheck) const
 Return a list of the files, from the specified input list, that are not used as files by the resources.
 
std::shared_ptr< gd::ResourceGetResourceSPtr (const gd::String &name)
 Return a (smart) pointer to a resource.
 
bool AddResource (const gd::Resource &resource)
 Add an already constructed resource. More...
 
bool AddResource (const gd::String &name, const gd::String &filename, const gd::String &kind)
 Add a resource created from a file.
 
void RemoveResource (const gd::String &name)
 Remove a resource.
 
void RenameResource (const gd::String &oldName, const gd::String &newName)
 Rename a resource.
 
std::size_t GetResourcePosition (const gd::String &name) const
 Return the position of the layer called "name" in the layers list.
 
bool MoveResourceUpInList (const gd::String &name)
 Move a resource up in the list.
 
bool MoveResourceDownInList (const gd::String &name)
 Move a resource down in the list.
 
void MoveResource (std::size_t oldIndex, std::size_t newIndex)
 Change the position of the specified resource.
 
bool HasFolder (const gd::String &name) const
 Return true if the folder exists.
 
const ResourceFolderGetFolder (const gd::String &name) const
 Return a reference to a folder.
 
ResourceFolderGetFolder (const gd::String &name)
 Return a reference to a folder.
 
void RemoveFolder (const gd::String &name)
 Remove a folder.
 
void CreateFolder (const gd::String &name)
 Create a new empty folder.
 
bool MoveFolderUpInList (const gd::String &name)
 Move a folder up in the list.
 
bool MoveFolderDownInList (const gd::String &name)
 Move a folder down in the list.
 
std::vector< gd::StringGetAllFolderList ()
 Get a list containing the name of all of the folders.
 
void SerializeTo (SerializerElement &element) const
 Serialize the object.
 
void UnserializeFrom (const SerializerElement &element)
 Unserialize the object.
 

Static Public Member Functions

static void SerializeResourceTo (gd::Resource &resource, SerializerElement &resourceElement)
 Serialize one resource.
 

Detailed Description

Inventory all resources used by a project.

See also
Resource

Member Function Documentation

◆ AddResource()

bool gd::ResourcesManager::AddResource ( const gd::Resource resource)

Add an already constructed resource.

Note
A copy of the resource is made and stored inside the ResourcesManager.

◆ GetAllResources()

const std::vector<std::shared_ptr<Resource> >& gd::ResourcesManager::GetAllResources ( ) const
inline

Get a list containing all the resources.


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