GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Public Member Functions | List of all members
gd::ImageManager Class Reference

Manage images for the IDE as well as at runtime for GD C++ Platform, providing an easy way to get SFML images or OpenGL textures. More...

#include <ImageManager.h>

Public Member Functions

std::shared_ptr
< OpenGLTextureWrapper
GetOpenGLTexture (const gd::String &name) const
 Get a shared pointer to an OpenGL texture. The shared pointer must be kept alive as long as the texture is used.
 
std::shared_ptr
< SFMLTextureWrapper
GetSFMLTexture (const gd::String &name) const
 Get a shared pointer to a SFML texture. The shared pointer must be kept alive as long as the texture is used. More...
 
void SetResourcesManager (gd::ResourcesManager *resourcesManager_)
 Set the gd::ResourcesManager used by the ImageManager.
 
void LoadPermanentImages ()
 Load all images of the project which are flagged as alwaysLoaded. More...
 
bool HasLoadedSFMLTexture (const gd::String &name) const
 Check if a SFML texture with the specified name is available and loaded in memory. More...
 
void SetSFMLTextureAsPermanentlyLoaded (const gd::String &name, std::shared_ptr< SFMLTextureWrapper > &texture) const
 Add the SFMLTextureWrapper to loaded images ( so that it can be accessed thanks to ImageManager::GetSFMLTexture ) with the specified name and mark it as permanently loaded ( so that is is unloaded only when the layout is unloaded ).
 
void ReloadImage (const gd::String &name) const
 Reload a single image from the game resources.
 
void PreventImagesUnloading ()
 When called, images won't be unloaded from memory until EnableImagesUnloading is called. Can be used when reloading a layout so as to prevent images from being unloaded and then immediately reloaded.
 
void EnableImagesUnloading ()
 Enable again unused images to be unloaded from memory.
 

Detailed Description

Manage images for the IDE as well as at runtime for GD C++ Platform, providing an easy way to get SFML images or OpenGL textures.

Image manager is used by objects to obtain their images from the image name.

Images are loaded dynamically when necessary, and are unloaded if there is no more shared_ptr pointing on an image.

You should in particular be interested by gd::ImageManager::GetOpenGLTexture and gd::ImageManager::GetSFMLTexture.

See also
SFMLTextureWrapper
OpenGLTextureWrapper

Member Function Documentation

std::shared_ptr< SFMLTextureWrapper > gd::ImageManager::GetSFMLTexture ( const gd::String name) const

Get a shared pointer to a SFML texture. The shared pointer must be kept alive as long as the texture is used.

For example, if the texture is used in an object, you should store the shared pointer in a member to make sure the texture is available as long as the object is alive.

bool gd::ImageManager::HasLoadedSFMLTexture ( const gd::String name) const

Check if a SFML texture with the specified name is available and loaded in memory.

Returns
true if the texture called name if available and loaded in memory.
void gd::ImageManager::LoadPermanentImages ( )

Load all images of the project which are flagged as alwaysLoaded.

See also
ImageResource

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