Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
WearBarParams Struct Reference

#include <tool.h>

+ Collaboration diagram for WearBarParams:

Public Types

enum  BlendMode : u8 { BLEND_MODE_CONSTANT , BLEND_MODE_LINEAR , BlendMode_END }
 

Public Member Functions

 WearBarParams (const std::map< f32, video::SColor > &colorStops, BlendMode blend)
 
 WearBarParams (const video::SColor color)
 
void serialize (std::ostream &os) const
 
void serializeJson (std::ostream &os) const
 
video::SColor getWearBarColor (f32 durabilityPercent)
 

Static Public Member Functions

static WearBarParams deserialize (std::istream &is)
 
static std::optional< WearBarParamsdeserializeJson (std::istream &is)
 

Public Attributes

std::map< f32, video::SColor > colorStops
 
BlendMode blend
 

Static Public Attributes

constexpr static const EnumString es_BlendMode [3]
 

Member Enumeration Documentation

◆ BlendMode

Enumerator
BLEND_MODE_CONSTANT 
BLEND_MODE_LINEAR 
BlendMode_END 

Constructor & Destructor Documentation

◆ WearBarParams() [1/2]

WearBarParams::WearBarParams ( const std::map< f32, video::SColor > &  colorStops,
BlendMode  blend 
)
inline

◆ WearBarParams() [2/2]

WearBarParams::WearBarParams ( const video::SColor  color)
inline

Member Function Documentation

◆ deserialize()

WearBarParams WearBarParams::deserialize ( std::istream &  is)
static

References blend, BlendMode_END, colorStops, readARGB8(), readF32(), readU16(), and readU8().

Referenced by ItemDefinition::deSerialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deserializeJson()

std::optional< WearBarParams > WearBarParams::deserializeJson ( std::istream &  is)
static

References blend, colorStops, es_BlendMode, parseColorString(), stof, and string_to_enum().

Referenced by ItemStackMetadata::updateWearBarParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWearBarColor()

video::SColor WearBarParams::getWearBarColor ( f32  durabilityPercent)

◆ serialize()

void WearBarParams::serialize ( std::ostream &  os) const

References blend, colorStops, writeARGB8(), writeF32(), writeU16(), and writeU8().

+ Here is the call graph for this function:

◆ serializeJson()

void WearBarParams::serializeJson ( std::ostream &  os) const

References blend, colorStops, encodeHexColorString(), es_BlendMode, fastWriteJson(), ftos(), and EnumString::str.

+ Here is the call graph for this function:

Member Data Documentation

◆ blend

◆ colorStops

std::map<f32, video::SColor> WearBarParams::colorStops

◆ es_BlendMode

constexpr static const EnumString WearBarParams::es_BlendMode[3]
staticconstexpr
Initial value:
= {
{0, nullptr}
}
@ BLEND_MODE_CONSTANT
Definition: tool.h:92
@ BLEND_MODE_LINEAR
Definition: tool.h:93

Referenced by deserializeJson(), push_wear_bar_params(), read_wear_bar_params(), and serializeJson().


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