![]() |
V-Gears 0
Free Final Fantasy VII engine.
|
A background file representation. More...
#include <VGearsBackgroundFile.h>
Classes | |
struct | Layer |
A layer of a background. More... | |
struct | Page |
A background page/. More... | |
struct | SpriteData |
Data for sprites. More... | |
Public Types | |
enum | { PAGE_DATA_WIDTH = 256 , PAGE_DATA_HEIGHT = PAGE_DATA_WIDTH , PAGE_DATA_SIZE = PAGE_DATA_WIDTH * PAGE_DATA_HEIGHT , SPRITE_WIDTH = 16 , SPRITE_HEIGHT = SPRITE_WIDTH , SPRITE_PIXEL_COUNT = SPRITE_WIDTH * SPRITE_HEIGHT , LAYER_COUNT = 4 , PALETTE_ENTRY_COUNT = 20 , PAGE_COUNT = 42 } |
typedef std::vector< SpriteData > | SpriteList |
typedef std::vector< SpriteData * > | SpritePtrList |
typedef PaletteFile::Color | Color |
typedef std::vector< uint8 > | Buffer |
typedef std::vector< Color > | Colors |
Public Member Functions | |
BackgroundFile (Ogre::ResourceManager *creator, const String &name, Ogre::ResourceHandle handle, const String &group, bool is_manual=false, Ogre::ManualResourceLoader *loader=NULL) | |
Constructor. More... | |
virtual | ~BackgroundFile () |
Destructor. More... | |
void | SortSprites () |
Sorts the sprites. More... | |
std::array< Layer, LAYER_COUNT > & | GetLayers (void) |
Retrieves the background layers. More... | |
std::array< uint8, PALETTE_ENTRY_COUNT > & | GetPalette (void) |
Retrieves the background palette. More... | |
std::array< Page, PAGE_COUNT > & | GetPages (void) |
Retrieves the background pages. More... | |
Ogre::Image * | CreateImage (const PaletteFilePtr &palette) |
Creates an image from a palette. More... | |
void | AddAllSprites (SpritePtrList &sprites) |
Adds all sprites to the background. More... | |
Static Public Attributes | |
static const String | RESOURCE_TYPE |
The type of resource. More... | |
Protected Member Functions | |
virtual void | loadImpl () override final |
Loads the file. More... | |
virtual void | unloadImpl () override final |
Unloads the file. More... | |
virtual size_t | CalculateSize () const |
Calculates the size of the background. More... | |
virtual size_t | CalculateSize (const Layer &layer) const |
Calculates the size of a background layer. More... | |
virtual size_t | CalculateSize (const Page &page) const |
Calculates the size of a background page. More... | |
Static Private Member Functions | |
static bool | SpriteSorter (SpriteData sprite1, SpriteData sprite2) |
Sorting algorithm for sprite sorting. More... | |
Private Attributes | |
std::array< Layer, LAYER_COUNT > | layers_ |
The list of layers. More... | |
std::array< uint8, PALETTE_ENTRY_COUNT > | palette_ |
The color palette. More... | |
std::array< Page, PAGE_COUNT > | pages_ |
The background pages. More... | |
A background file representation.
typedef std::vector<uint8> VGears::BackgroundFile::Buffer |
typedef std::vector<Color> VGears::BackgroundFile::Colors |
typedef std::vector<SpriteData> VGears::BackgroundFile::SpriteList |
typedef std::vector<SpriteData*> VGears::BackgroundFile::SpritePtrList |
anonymous enum |
Enumerator | |
---|---|
PAGE_DATA_WIDTH | Width of the background page, in pixels. Same as {
|
PAGE_DATA_HEIGHT | Height of the background page, in pixels. Same as {
|
PAGE_DATA_SIZE | Size of the background page, in pixels. Same as {
|
SPRITE_WIDTH | Width of sprites, in pixels. Same as {
|
SPRITE_HEIGHT | Height of sprites, in pixels. Same as {
|
SPRITE_PIXEL_COUNT | Size of sprites, in pixels. Same as {
|
LAYER_COUNT | Number of layers in a background. |
PALETTE_ENTRY_COUNT | Number of palettes in a background. |
PAGE_COUNT | Number of pages in a background.
|
VGears::BackgroundFile::BackgroundFile | ( | Ogre::ResourceManager * | creator, |
const String & | name, | ||
Ogre::ResourceHandle | handle, | ||
const String & | group, | ||
bool | is_manual = false , |
||
Ogre::ManualResourceLoader * | loader = NULL |
||
) |
Constructor.
[in] | creator | Pointer to the ResourceManager that is creating this resource. |
[in] | name | The unique name of the resource. |
[in] | handle |
[in] | group | The name of the resource group to which this resource belong. |
[in] | is_manual | True if the resource is manually loaded, false otherwise. |
[in] | loader | Pointer to a ManualResourceLoader implementation which will be called when the Resource wishes to load (should be supplied if is_manual is set to true). It can be null, but the Resource will never be able to reload if anything ever causes it to unload. Therefore provision of a proper ManualResourceLoader instance is strongly recommended. |
|
virtual |
Destructor.
void VGears::BackgroundFile::AddAllSprites | ( | SpritePtrList & | sprites | ) |
Adds all sprites to the background.
[in] | sprites | The list of sprites to add. |
|
protectedvirtual |
Calculates the size of the background.
It includes all layers and pages.
|
protectedvirtual |
Calculates the size of a background layer.
[in] | layer | The layer to calculate size from. |
|
protectedvirtual |
Calculates the size of a background page.
[in] | page | The layer to calculate size from. |
Ogre::Image * VGears::BackgroundFile::CreateImage | ( | const PaletteFilePtr & | palette | ) |
Creates an image from a palette.
[in] | palette | The color palette for the image. |
|
inline |
Retrieves the background layers.
|
inline |
Retrieves the background pages.
|
inline |
Retrieves the background palette.
|
finaloverrideprotectedvirtual |
Loads the file.
void VGears::BackgroundFile::SortSprites | ( | ) |
Sorts the sprites.
|
staticprivate |
Sorting algorithm for sprite sorting.
[in] | sprite1 | First sprite to compare. |
[in] | sprite2 | Second sprite to compare. |
|
finaloverrideprotectedvirtual |
Unloads the file.
|
private |
The list of layers.
|
private |
The background pages.
|
private |
The color palette.
|
static |
The type of resource.