Game Develop Core: gd::ImageManager Class Reference

| Game Develop Core Core library for developing platforms and tools compatible with Game Develop.

- Main Page
- Modules
- Classes

- Class List
- Class Index
- Class Hierarchy

All Classes Files Functions Variables Typedefs Enumerations Macros Groups 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

boost::shared_ptr < OpenGLTextureWrapper > | GetOpenGLTexture (const std::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.
boost::shared_ptr < SFMLTextureWrapper > | GetSFMLTexture (const std::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 | SetGame (gd::Project *game_)
| Set the project associated with the image manager.
void | LoadPermanentImages ()
| Load all images of the project which are flagged as alwaysLoaded. More...
bool | HasLoadedSFMLTexture (const std::string &name) const
| Check if a SFML texture with the specified name is available and loaded in memory. More...
void | SetSFMLTextureAsPermanentlyLoaded (const std::string &name, boost::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 std::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

boost::shared_ptr< SFMLTextureWrapper > gd::ImageManager::GetSFMLTexture | ( | const std::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 std::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:

- ImageManager.h
- ImageManager.cpp