OpenTTD
null.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #include "../stdafx.h"
11 #include "null.hpp"
12 
13 #include "../safeguards.h"
14 
17 
18 Sprite *Blitter_Null::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
19 {
20  Sprite *dest_sprite;
21  dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite));
22 
23  dest_sprite->height = sprite->height;
24  dest_sprite->width = sprite->width;
25  dest_sprite->x_offs = sprite->x_offs;
26  dest_sprite->y_offs = sprite->y_offs;
27 
28  return dest_sprite;
29 }
static FBlitter_Null iFBlitter_Null
Instantiation of the null blitter factory.
Definition: null.cpp:16
Data structure describing a sprite.
Definition: spritecache.h:16
int16 y_offs
Number of pixels to shift the sprite downwards.
Definition: spritecache.h:20
int16 x_offs
The x-offset of where the sprite will be drawn.
Structure for passing information from the sprite loader to the blitter.
Sprite * Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override
Convert a sprite from the loader to our own format.
Definition: null.cpp:18
uint16 height
Height of the sprite.
Definition: spritecache.h:17
uint16 width
Width of the sprite.
uint16 width
Width of the sprite.
Definition: spritecache.h:18
uint16 height
Height of the sprite.
int16 x_offs
Number of pixels to shift the sprite to the right.
Definition: spritecache.h:19
The blitter that doesn&#39;t blit.
int16 y_offs
The y-offset of where the sprite will be drawn.
Factory for the blitter that does nothing.
Definition: null.hpp:39