- Main Page
- Classes
- Files
- Directories
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# KrSpriteResource Class Reference

Practically, a sprite resource is used to create a sprite. More...

`#include <spriteresource.h>`

Inheritance diagram for KrSpriteResource:

List of all members.

## Public Member Functions
virtual U32 | Type ()
| The type of the resource. ( ex, KYRATAG_SPRITE ).
virtual const std::string & | TypeName ()
| The name of the type. ( ex, "Sprite" ).
virtual KrSpriteResource * | ToSpriteResource ()
| Return a pointer if this is a sprite resource.
int | NumActions ()
| Return the count of actions in this sprite.
KrAction * | GetAction (const std::string &actionName)
| Fetch an action from this Sprite Resource by the name of the action.
KrAction * | GetAction (U32 actionId)
| Fetch an action from this Sprite Resource by the id of the action.
KrCanvasResource * | CreateCanvasResource (const std::string &actionName, int frame, int *hotx, int *hoty)
| It is sometimes useful to get a Canvas Resource that is created from a sprite.
KrCanvasResource * | CreateCanvasResource (U32 actionId, int frame, int *hotx, int *hoty)
| Same functionality, uses the id instead of the name.
virtual void | CacheScale (GlFixed xScale, GlFixed yScale)
| Create a cached resourced.
virtual bool | IsScaleCached (GlFixed xScale, GlFixed yScale)
| Check the cache for a given scale.
virtual void | FreeScaleCache ()
| Free up the cache.

## Detailed Description

Practically, a sprite resource is used to create a sprite.

A sprite resource is a type of resource and a container for actions.

SpriteResource Action Frames ( Rle )

## Member Function Documentation

virtual void KrSpriteResource::CacheScale | ( | GlFixed | xScale,
|  | GlFixed | yScale |
| ) |  |  | `[virtual]`

Create a cached resourced.

A resource can be drawn much more quickly if its scaled image is pre-calculated. This generates and scaled version of the resource and stores it for fast drawing. The cached version will always be used before a version generated on the fly.

Reimplemented from KrResource.

KrCanvasResource* KrSpriteResource::CreateCanvasResource | ( | const std::string & | actionName,
|  | int | frame,
|  | int * | hotx,
|  | int * | hoty |
| ) |  |  |

It is sometimes useful to get a Canvas Resource that is created from a sprite.

This method calculates the bounds, creates the Resource, and returns it. If there is an error, 0 is returned.

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

- spriteresource.h