Support Forum       Library Source       SourceForge Page       G3D Web Page     
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
G3D::IconSet Class Reference

A set of small image files packed into a single G3D::Texture for efficiency. More...

Inherits G3D::ReferenceCountedObject.

Public Types

typedef shared_ptr< IconSetRef
 

Public Member Functions

const std::stringfilename (int index) const
 Returns the filename of the icon with the given index.
 
Icon get (int index) const
 
Icon get (const std::string &s) const
 
Icon get (const char *s) const
 
int getIndex (const std::string &s) const
 Returns the index of the icon named s.
 
int getIndex (const char *s) const
 
const Rect2Drect (int index) const
 Texture coordinates.
 
int size () const
 Number of icons.
 
const shared_ptr< Texture > & texture () const
 

Static Public Member Functions

static IconSet::Ref fromFile (const std::string &filename)
 Load an existing icon set from a file.
 
static void makeIconSet (const std::string &sourceDir, const std::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.
 

Detailed Description

A set of small image files packed into a single G3D::Texture for efficiency.

Examples:

IconSet::Ref 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));

Member Typedef Documentation

typedef shared_ptr<IconSet> G3D::IconSet::Ref

Member Function Documentation

const std::string& G3D::IconSet::filename ( int  index) const
inline

Returns the filename of the icon with the given index.

static IconSet::Ref G3D::IconSet::fromFile ( const std::string filename)
static

Load an existing icon set from a file.

Icon G3D::IconSet::get ( int  index) const
Icon G3D::IconSet::get ( const std::string s) const
inline
Icon G3D::IconSet::get ( const char *  s) const
inline
int G3D::IconSet::getIndex ( const std::string s) const

Returns the index of the icon named s.

Referenced by get(), and getIndex().

int G3D::IconSet::getIndex ( const char *  s) const
inline
static void G3D::IconSet::makeIconSet ( const std::string sourceDir,
const std::string outFile 
)
static

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.

const Rect2D& G3D::IconSet::rect ( int  index) const
inline

Texture coordinates.

int G3D::IconSet::size ( ) const
inline

Number of icons.

const shared_ptr<Texture>& G3D::IconSet::texture ( ) const
inline

documentation generated on Sat Jan 12 2013 22:49:55 using doxygen 1.8.2