HoverRace  2.0
Public Member Functions | Private Types | Private Attributes | List of all members
HoverRace::Display::SpriteTextureRes Class Reference

Loads a legacy 8-bit sprite as a texture. More...

#include <SpriteTextureRes.h>

+ Inheritance diagram for HoverRace::Display::SpriteTextureRes:

Public Member Functions

 SpriteTextureRes (const std::string &recordName, Parcel::ObjStream &archive, bool flipped=false)
 Constructor. More...
 
virtual ~SpriteTextureRes ()
 
std::string GetId () const override
 Retrieve the ID for this resource. More...
 
const ImageData * GetImageData () override
 If IsGenerated() is true, returns the image data necessary to create the texture. More...
 
bool IsGenerated () const override
 Check if this texture is generated from memory rather than an input stream. More...
 
std::unique_ptr< std::istream > Open () const override
 Open the stream for reading. More...
 
- Public Member Functions inherited from HoverRace::Display::Res< Texture >
virtual ~Res ()
 
- Public Member Functions inherited from HoverRace::Display::BaseRes
virtual ~BaseRes ()
 

Private Types

typedef Res< TextureSUPER
 

Private Attributes

std::string id
 
ImageData imageData
 

Detailed Description

Loads a legacy 8-bit sprite as a texture.

Author
Michael Imamura

Member Typedef Documentation

Constructor & Destructor Documentation

HoverRace::Display::SpriteTextureRes::SpriteTextureRes ( const std::string &  recordName,
Parcel::ObjStream archive,
bool  flipped = false 
)

Constructor.

Parameters
recordNameThe name of the record being loaded.
archiveThe input object stream.
flippedtrue if the sprite data is stored upside-down.
virtual HoverRace::Display::SpriteTextureRes::~SpriteTextureRes ( )
inlinevirtual

Member Function Documentation

std::string HoverRace::Display::SpriteTextureRes::GetId ( ) const
inlineoverridevirtual

Retrieve the ID for this resource.

The ID should be unique for every resource being pointed at, so two instances that point to the same resource (e.g. a file) should return the same ID.

This allows loaded resources to be cached, so if two instances point to, say, the same file, then the resource will be loaded once (although this is left as an exercise for the Display).

Returns
The identifier.

Implements HoverRace::Display::BaseRes.

const ImageData* HoverRace::Display::SpriteTextureRes::GetImageData ( )
inlineoverridevirtual

If IsGenerated() is true, returns the image data necessary to create the texture.

Returns
The image data, or nullptr if not a generated texture.

Reimplemented from HoverRace::Display::Res< Texture >.

bool HoverRace::Display::SpriteTextureRes::IsGenerated ( ) const
inlineoverridevirtual

Check if this texture is generated from memory rather than an input stream.

If this texture is generated, then the image data is retrieved via GetImageData() instead of Open().

Returns
true if generated, false if not.

Reimplemented from HoverRace::Display::Res< Texture >.

std::unique_ptr<std::istream> HoverRace::Display::SpriteTextureRes::Open ( ) const
inlineoverridevirtual

Open the stream for reading.

Returns
The input stream.
Exceptions
ResourceLoadExn

Implements HoverRace::Display::BaseRes.

Member Data Documentation

std::string HoverRace::Display::SpriteTextureRes::id
private
ImageData HoverRace::Display::SpriteTextureRes::imageData
private

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