OpenTTD
null.hpp
Go to the documentation of this file.
1 /* $Id: null.hpp 26209 2014-01-02 22:41:58Z rubidium $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * 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.
6  * 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.
7  * 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/>.
8  */
9 
12 #ifndef BLITTER_NULL_HPP
13 #define BLITTER_NULL_HPP
14 
15 #include "factory.hpp"
16 
18 class Blitter_Null : public Blitter {
19 public:
20  /* virtual */ uint8 GetScreenDepth() { return 0; }
21  /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) {};
22  /* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) {};
23  /* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
24  /* virtual */ void *MoveTo(void *video, int x, int y) { return NULL; };
25  /* virtual */ void SetPixel(void *video, int x, int y, uint8 colour) {};
26  /* virtual */ void DrawRect(void *video, int width, int height, uint8 colour) {};
27  /* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) {};
28  /* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height) {};
29  /* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height) {};
30  /* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) {};
31  /* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) {};
32  /* virtual */ int BufferSize(int width, int height) { return 0; };
33  /* virtual */ void PaletteAnimate(const Palette &palette) { };
35 
36  /* virtual */ const char *GetName() { return "null"; }
37  /* virtual */ int GetBytesPerPixel() { return 0; }
38 };
39 
41 class FBlitter_Null : public BlitterFactory {
42 public:
43  FBlitter_Null() : BlitterFactory("null", "Null Blitter (does nothing)") {}
44  /* virtual */ Blitter *CreateInstance() { return new Blitter_Null(); }
45 };
46 
47 #endif /* BLITTER_NULL_HPP */
uint32 PaletteID
The number of the palette.
Definition: gfx_type.h:20
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal)
Draw a colourtable to the screen.
Definition: null.hpp:22
Information about the currently used palette.
Definition: gfx_type.h:309
Data structure describing a sprite.
Definition: spritecache.h:18
No palette animation.
Definition: base.hpp:52
Blitter::PaletteAnimation UsePaletteAnimation()
Check if the blitter uses palette animation at all.
Definition: null.hpp:34
Blitter that does nothing.
Definition: null.hpp:18
How all blitters should look like.
Definition: base.hpp:30
void CopyToBuffer(const void *video, void *dst, int width, int height)
Copy from the screen to a buffer.
Definition: null.hpp:29
int GetBytesPerPixel()
Get how many bytes are needed to store a pixel.
Definition: null.hpp:37
int BufferSize(int width, int height)
Calculate how much memory there is needed for an image of this size in the video-buffer.
Definition: null.hpp:32
void PaletteAnimate(const Palette &palette)
Called when the 8bpp palette is changed; you should redraw all pixels on the screen that are equal to...
Definition: null.hpp:33
Parameters related to blitting.
Definition: base.hpp:33
void * MoveTo(void *video, int x, int y)
Move the destination pointer the requested amount x and y, keeping in mind any pitch and bpp of the r...
Definition: null.hpp:24
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
Copy from the screen to a buffer in a palette format for 8bpp and RGBA format for 32bpp...
Definition: null.hpp:30
Structure for passing information from the sprite loader to the blitter.
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
Draw a line with a given colour.
Definition: null.hpp:27
void CopyFromBuffer(void *video, const void *src, int width, int height)
Copy from a buffer to the screen.
Definition: null.hpp:28
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y)
Scroll the videobuffer some &#39;x&#39; and &#39;y&#39; value.
Definition: null.hpp:31
void SetPixel(void *video, int x, int y, uint8 colour)
Draw a pixel with a given colour on the video-buffer.
Definition: null.hpp:25
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
Draw an image to the screen, given an amount of params defined above.
Definition: null.hpp:21
ZoomLevel
All zoom levels we know.
Definition: zoom_type.h:21
uint8 GetScreenDepth()
Get the screen depth this blitter works for.
Definition: null.hpp:20
Sprite * Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
Convert a sprite from the loader to our own format.
Definition: null.cpp:20
Blitter * CreateInstance()
Create an instance of this Blitter-class.
Definition: null.hpp:44
const char * GetName()
Get the name of the blitter, the same as the Factory-instance returns.
Definition: null.hpp:36
Factory for the blitter that does nothing.
Definition: null.hpp:41
BlitterMode
The modes of blitting we can do.
Definition: base.hpp:19
PaletteAnimation
Types of palette animation.
Definition: base.hpp:51
The base factory, keeping track of all blitters.
Definition: factory.hpp:28
void DrawRect(void *video, int width, int height, uint8 colour)
Make a single horizontal line in a single colour on the video-buffer.
Definition: null.hpp:26
Factory to &#39;query&#39; all available blitters.