OpenTTD Source
20241121-master-g67a0fccfad
|
The base factory, keeping track of all blitters. More...
#include <factory.hpp>
Public Member Functions | |
std::string_view | GetName () const |
Get the long, human readable, name for the Blitter-class. | |
std::string_view | GetDescription () const |
Get a nice description of the blitter-class. | |
virtual Blitter * | CreateInstance ()=0 |
Create an instance of this Blitter-class. | |
Static Public Member Functions | |
static Blitter * | SelectBlitter (const std::string_view name) |
Find the requested blitter and return its class. More... | |
static BlitterFactory * | GetBlitterFactory (const std::string_view name) |
Get the blitter factory with the given name. More... | |
static Blitter * | GetCurrentBlitter () |
Get the current active blitter (always set by calling SelectBlitter). | |
static void | GetBlittersInfo (std::back_insert_iterator< std::string > &output_iterator) |
Fill a buffer with information about the blitters. More... | |
Protected Member Functions | |
BlitterFactory (const char *name, const char *description, bool usable=true) | |
Construct the blitter, and register it. More... | |
virtual bool | IsUsable () const |
Is the blitter usable with the current drivers and hardware config? More... | |
Private Types | |
typedef std::map< std::string, BlitterFactory * > | Blitters |
Map of blitter factories. | |
Static Private Member Functions | |
static Blitters & | GetBlitters () |
Get the map with currently known blitters. More... | |
static Blitter ** | GetActiveBlitter () |
Get the currently active blitter. More... | |
Private Attributes | |
const std::string | name |
The name of the blitter factory. | |
const std::string | description |
The description of the blitter. | |
The base factory, keeping track of all blitters.
Definition at line 21 of file factory.hpp.
|
inlineprotected |
Construct the blitter, and register it.
name | The name of the blitter. |
description | A longer description for the blitter. |
usable | Whether the blitter is usable (on the current computer). For example for disabling SSE blitters when the CPU can't handle them. |
Definition at line 58 of file factory.hpp.
References Debug, GetBlitters(), and name.
|
inlinestaticprivate |
Get the currently active blitter.
Definition at line 42 of file factory.hpp.
Referenced by GetCurrentBlitter(), and SelectBlitter().
|
inlinestatic |
Get the blitter factory with the given name.
name | the blitter factory to select. |
Definition at line 114 of file factory.hpp.
References GetBlitters(), IsUsable(), name, and StrEqualsIgnoreCase().
Referenced by SelectBlitter().
|
inlinestaticprivate |
Get the map with currently known blitters.
Definition at line 32 of file factory.hpp.
Referenced by BlitterFactory(), GetBlitterFactory(), and GetBlittersInfo().
|
inlinestatic |
Fill a buffer with information about the blitters.
p | The buffer to fill. |
last | The last element of the buffer. |
Definition at line 149 of file factory.hpp.
References GetBlitters(), GetDescription(), and name.
|
inlineprotectedvirtual |
Is the blitter usable with the current drivers and hardware config?
Reimplemented in FBlitter_40bppAnim.
Definition at line 79 of file factory.hpp.
Referenced by GetBlitterFactory().
|
inlinestatic |
Find the requested blitter and return its class.
name | the blitter to select. |
Definition at line 96 of file factory.hpp.
References CreateInstance(), Debug, GetActiveBlitter(), GetBlitterFactory(), Blitter::GetName(), and name.