OpenTTD Source  20241121-master-g67a0fccfad
SpriteLoader::Sprite Struct Reference

Structure for passing information from the sprite loader to the blitter. More...

#include <spriteloader.hpp>

Public Member Functions

void AllocateData (ZoomLevel zoom, size_t size)
 Allocate the sprite data of this sprite. More...
 

Data Fields

uint16_t height
 Height of the sprite.
 
uint16_t width
 Width of the sprite.
 
int16_t x_offs
 The x-offset of where the sprite will be drawn.
 
int16_t y_offs
 The y-offset of where the sprite will be drawn.
 
SpriteType type
 The sprite type.
 
SpriteColourComponent colours
 The colour components of the sprite with useful information.
 
SpriteLoader::CommonPixeldata
 The sprite itself.
 

Static Private Attributes

static ReusableBuffer< SpriteLoader::CommonPixelbuffer [ZOOM_LVL_END]
 Allocated memory to pass sprite data around.
 

Detailed Description

Structure for passing information from the sprite loader to the blitter.

You can only use this struct once at a time when using AllocateData to allocate the memory as that will always return the same memory address. This to prevent thousands of malloc + frees just to load a sprite.

Definition at line 47 of file spriteloader.hpp.

Member Function Documentation

◆ AllocateData()

void SpriteLoader::Sprite::AllocateData ( ZoomLevel  zoom,
size_t  size 
)
inline

Allocate the sprite data of this sprite.

Parameters
zoomZoom level to allocate the data for.
sizethe minimum size of the data field.

Definition at line 61 of file spriteloader.hpp.

Referenced by DecodeSingleSprite().


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