OpenTTD Source 20241224-master-gee860a5c8e
null.hpp
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#ifndef BLITTER_NULL_HPP
11#define BLITTER_NULL_HPP
12
13#include "factory.hpp"
14
16class Blitter_Null : public Blitter {
17public:
18 uint8_t GetScreenDepth() override { return 0; }
20 void DrawColourMappingRect(void *, int, int, PaletteID) override {};
21 Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override;
22 void *MoveTo(void *, int, int) override { return nullptr; };
23 void SetPixel(void *, int, int, uint8_t) override {};
24 void DrawRect(void *, int, int, uint8_t) override {};
25 void DrawLine(void *, int, int, int, int, int, int, uint8_t, int, int) override {};
26 void CopyFromBuffer(void *, const void *, int, int) override {};
27 void CopyToBuffer(const void *, void *, int, int) override {};
28 void CopyImageToBuffer(const void *, void *, int, int, int) override {};
29 void ScrollBuffer(void *, int &, int &, int &, int &, int, int) override {};
30 size_t BufferSize(uint, uint) override { return 0; };
31 void PaletteAnimate(const Palette &) override { };
33
34 std::string_view GetName() override { return "null"; }
35};
36
39public:
40 FBlitter_Null() : BlitterFactory("null", "Null Blitter (does nothing)") {}
41 Blitter *CreateInstance() override { return new Blitter_Null(); }
42};
43
44#endif /* BLITTER_NULL_HPP */
BlitterMode
The modes of blitting we can do.
Definition base.hpp:17
The base factory, keeping track of all blitters.
Definition factory.hpp:21
Blitter that does nothing.
Definition null.hpp:16
void DrawColourMappingRect(void *, int, int, PaletteID) override
Draw a colourtable to the screen.
Definition null.hpp:20
Sprite * Encode(const SpriteLoader::SpriteCollection &sprite, SpriteAllocator &allocator) override
Convert a sprite from the loader to our own format.
Definition null.cpp:18
std::string_view GetName() override
Get the name of the blitter, the same as the Factory-instance returns.
Definition null.hpp:34
void SetPixel(void *, int, int, uint8_t) override
Draw a pixel with a given colour on the video-buffer.
Definition null.hpp:23
size_t BufferSize(uint, uint) override
Calculate how much memory there is needed for an image of this size in the video-buffer.
Definition null.hpp:30
void PaletteAnimate(const Palette &) override
Called when the 8bpp palette is changed; you should redraw all pixels on the screen that are equal to...
Definition null.hpp:31
void * MoveTo(void *, int, int) override
Move the destination pointer the requested amount x and y, keeping in mind any pitch and bpp of the r...
Definition null.hpp:22
uint8_t GetScreenDepth() override
Get the screen depth this blitter works for.
Definition null.hpp:18
void ScrollBuffer(void *, int &, int &, int &, int &, int, int) override
Scroll the videobuffer some 'x' and 'y' value.
Definition null.hpp:29
void DrawRect(void *, int, int, uint8_t) override
Make a single horizontal line in a single colour on the video-buffer.
Definition null.hpp:24
void DrawLine(void *, int, int, int, int, int, int, uint8_t, int, int) override
Draw a line with a given colour.
Definition null.hpp:25
void CopyToBuffer(const void *, void *, int, int) override
Copy from the screen to a buffer.
Definition null.hpp:27
Blitter::PaletteAnimation UsePaletteAnimation() override
Check if the blitter uses palette animation at all.
Definition null.hpp:32
void CopyImageToBuffer(const void *, void *, int, int, int) override
Copy from the screen to a buffer in a palette format for 8bpp and RGBA format for 32bpp.
Definition null.hpp:28
void Draw(Blitter::BlitterParams *, BlitterMode, ZoomLevel) override
Draw an image to the screen, given an amount of params defined above.
Definition null.hpp:19
void CopyFromBuffer(void *, const void *, int, int) override
Copy from a buffer to the screen.
Definition null.hpp:26
How all blitters should look like.
Definition base.hpp:29
PaletteAnimation
Types of palette animation.
Definition base.hpp:50
@ PALETTE_ANIMATION_NONE
No palette animation.
Definition base.hpp:51
Factory for the blitter that does nothing.
Definition null.hpp:38
Blitter * CreateInstance() override
Create an instance of this Blitter-class.
Definition null.hpp:41
Interface for something that can allocate memory for a sprite.
std::array< Sprite, ZOOM_LVL_END > SpriteCollection
Type defining a collection of sprites, one for each zoom level.
Factory to 'query' all available blitters.
uint32_t PaletteID
The number of the palette.
Definition gfx_type.h:19
Parameters related to blitting.
Definition base.hpp:32
Information about the currently used palette.
Definition gfx_type.h:328
Data structure describing a sprite.
Definition spritecache.h:17
ZoomLevel
All zoom levels we know.
Definition zoom_type.h:16