10#ifndef SPRITELOADER_HPP
11#define SPRITELOADER_HPP
13#include "../core/alloc_type.hpp"
14#include "../core/enum_type.hpp"
15#include "../gfx_type.h"
A reusable buffer that can be used for places that temporary allocate a bit of memory and do that ver...
Interface for something that can allocate memory for a sprite.
virtual void * AllocatePtr(size_t size)=0
Allocate memory for a sprite.
T * Allocate(size_t size)
Allocate memory for a sprite.
Interface for something that can encode a sprite.
virtual Sprite * Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator)=0
Convert a sprite from the loader to our own format.
virtual bool Is32BppSupported()=0
Can the sprite encoder make use of RGBA sprites?
virtual uint GetSpriteAlignment()
Get the value which the height and width on a sprite have to be aligned by.
RandomAccessFile with some extra information specific for sprite files.
Interface for the loader of our sprites.
std::array< Sprite, ZOOM_LVL_END > SpriteCollection
Type defining a collection of sprites, one for each zoom level.
virtual uint8_t LoadSprite(SpriteLoader::SpriteCollection &sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, uint8_t control_flags)=0
Load a sprite from the disk and return a sprite struct which is the same for all loaders.
#define DECLARE_ENUM_AS_BIT_SET(enum_type)
Operators to allow to work with enum as with type safe bit set in C++.
SpriteType
Types of sprites that might be loaded.
Random Access File specialised for accessing sprites.
SpriteColourComponent
The different colour components a sprite can have.
@ SCC_MASK
Mask of valid colour bits.
@ SCC_ALPHA
Sprite has alpha.
@ SCC_PAL
Sprite has palette data.
Definition of a common pixel in OpenTTD's realm.
Structure for passing information from the sprite loader to the blitter.
void AllocateData(ZoomLevel zoom, size_t size)
Allocate the sprite data of this sprite.
SpriteColourComponent colours
The colour components of the sprite with useful information.
uint16_t width
Width of the sprite.
int16_t x_offs
The x-offset of where the sprite will be drawn.
SpriteLoader::CommonPixel * data
The sprite itself.
uint16_t height
Height of the sprite.
SpriteType type
The sprite type.
int16_t y_offs
The y-offset of where the sprite will be drawn.
Data structure describing a sprite.
ZoomLevel
All zoom levels we know.
@ ZOOM_LVL_END
End for iteration.