Support Forum G3D Web Page |
A set of small image files packed into a single G3D::Texture for efficiency.
More...
Inherits G3D::ReferenceCountedObject.
Public Member Functions | |
const String & | filename (int index) const |
Returns the filename of the icon with the given index. More... | |
Icon | get (int index) const |
Icon | get (const String &s) const |
Icon | get (const char *s) const |
int | getIndex (const String &s) const |
Returns the index of the icon named s. More... | |
int | getIndex (const char *s) const |
const Rect2D & | rect (int index) const |
Texture coordinates. More... | |
int | size () const |
Number of icons. More... | |
const shared_ptr< Texture > & | texture () const |
Static Public Member Functions | |
static shared_ptr< IconSet > | fromFile (const String &filename) |
Load an existing icon set from a file. More... | |
static void | makeIconSet (const String &sourceDir, const String &outFile) |
Load all of the image files (see G3D::Image::supportedFormat) from sourceDir and its subdirectories and pack them into a single G3D::IconSet named outFile. More... | |
Static Protected Member Functions | |
template<class T , class ... ArgTypes> | |
static shared_ptr< T > | createShared (ArgTypes &&... args) |
Like std::make_shared, but works for protected constructors. More... | |
A set of small image files packed into a single G3D::Texture for efficiency.
Examples:
shared_ptr<IconSet> icons = IconSet::fromFile("tango.icn"); debugPane->addButton(icons->get("16x16/actions/document-open.png"));
int index = icons->getIndex("16x16/actions/edit-clear.png"); debugPane->addButton(icons->get(index));
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
|
inline |
Returns the filename of the icon with the given index.
Load an existing icon set from a file.
Icon G3D::IconSet::get | ( | int | index | ) | const |
|
inline |
int G3D::IconSet::getIndex | ( | const String & | s | ) | const |
Returns the index of the icon named s.
Referenced by get(), and getIndex().
|
inline |
Load all of the image files (see G3D::Image::supportedFormat) from sourceDir and its subdirectories and pack them into a single G3D::IconSet named outFile.
The packing algorithm is not optimal. Future versions of G3D may provide improved packing, and you can also create icon sets with your own packing algorithm–the indexing scheme allows arbitrary packing algorithms within the same file format.
Ignores .svn and CVS directories.
|
inline |
Number of icons.
|
inline |