OpenTTD Source 20260525-master-g39d4fe24a0
ExtendedTextColour Struct Reference

Container for the text colour and some text colour related flags for drawing. More...

#include <gfx_type.h>

Public Member Functions

constexpr ExtendedTextColour (TextColour colour=TextColour::Invalid, ExtendedTextColourFlags flags={})
 Create the extended text colour based on a TextColour and optional flags.
constexpr ExtendedTextColour (PixelColour pc)
 Create the extended text colour based on a PixelColour.
constexpr auto operator<=> (const ExtendedTextColour &) const =default
 Compare with another instance of this class.
constexpr uint16_t ToNetwork () const
 Encode this text colour for sending over the network.

Static Public Member Functions

static constexpr ExtendedTextColour FromNetwork (uint16_t tc)
 Decode the network encoded text colour.

Data Fields

TextColour colour
 The colour.
ExtendedTextColourFlags flags {}
 The flags.

Detailed Description

Container for the text colour and some text colour related flags for drawing.

Definition at line 348 of file gfx_type.h.

Constructor & Destructor Documentation

◆ ExtendedTextColour() [1/2]

ExtendedTextColour::ExtendedTextColour ( TextColour colour = TextColour::Invalid,
ExtendedTextColourFlags flags = {} )
inlineconstexpr

Create the extended text colour based on a TextColour and optional flags.

Parameters
colourThe colour.
flagsThe flags.

Definition at line 354 of file gfx_type.h.

References colour, flags, and Invalid.

Referenced by FromNetwork(), and operator<=>().

◆ ExtendedTextColour() [2/2]

ExtendedTextColour::ExtendedTextColour ( PixelColour pc)
inlineconstexpr

Create the extended text colour based on a PixelColour.

Parameters
pcThe pixel colour for this colour.

Definition at line 360 of file gfx_type.h.

References colour, and flags.

Member Function Documentation

◆ FromNetwork()

constexpr ExtendedTextColour ExtendedTextColour::FromNetwork ( uint16_t tc)
inlinestaticconstexpr

Decode the network encoded text colour.

Parameters
tcThe network encoded colour.
Returns
The decoded colour.

Definition at line 376 of file gfx_type.h.

References ExtendedTextColour().

Referenced by ServerNetworkAdminSocketHandler::ReceiveAdminExternalChat(), ClientNetworkGameSocketHandler::ReceiveServerExternalChat(), and ClientNetworkGameSocketHandler::ReceiveServerRemoteConsoleCommand().

◆ operator<=>()

auto ExtendedTextColour::operator<=> ( const ExtendedTextColour & ) const
constexprdefault

Compare with another instance of this class.

Returns
The std::strong_ordering of the comparison.

References ExtendedTextColour().

◆ ToNetwork()

uint16_t ExtendedTextColour::ToNetwork ( ) const
inlineconstexpr

Field Documentation

◆ colour

TextColour ExtendedTextColour::colour

◆ flags

ExtendedTextColourFlags ExtendedTextColour::flags {}

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