Mana
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | List of all members
UserPalette Class Reference

Class controlling the game's color palette. More...

#include <userpalette.h>

Inheritance diagram for UserPalette:
Palette

Public Types

enum  {
  BEING , PC , SELF , GM ,
  NPC , MONSTER , PARTY , GUILD ,
  PARTICLE , EXP_INFO , PICKUP_INFO , HIT_PLAYER_MONSTER ,
  HIT_MONSTER_PLAYER , HIT_CRITICAL , HIT_LOCAL_PLAYER_MONSTER , HIT_LOCAL_PLAYER_CRITICAL ,
  HIT_LOCAL_PLAYER_MISS , MISS , USER_COLOR_LAST
}
 List of all colors that are configurable. More...
 
- Public Types inherited from Palette
enum  GradientType { STATIC , PULSE , SPECTRUM , RAINBOW }
 Colors can be static or can alter over time. More...
 

Public Member Functions

 UserPalette ()
 
 ~UserPalette () override
 
const gcn::Color & getCommittedColor (int type)
 Gets the committed color associated with the specified type.
 
const gcn::Color & getTestColor (int type)
 Gets the test color associated with the specified type.
 
void setTestColor (int type, const gcn::Color &color)
 Sets the test color associated with the specified type.
 
void setColor (int type, int r, int g, int b)
 Sets the color for the specified type.
 
void setGradient (int type, Palette::GradientType grad)
 Sets the gradient type for the specified color.
 
void setGradientDelay (int type, int delay)
 Sets the gradient delay for the specified color.
 
int getNumberOfElements () override
 Returns the number of colors known.
 
std::string getElementAt (int i) override
 Returns the name of the ith color.
 
void commit ()
 Commit the colors.
 
void rollback ()
 Rollback the colors.
 
int getColorTypeAt (int i)
 Gets the ColorType used by the color for the element at index i in the current color model.
 
- Public Member Functions inherited from Palette
 Palette (int size)
 
 Palette (const Palette &)=delete
 
 Palette (Palette &&)
 
 ~Palette ()
 
Paletteoperator= (const Palette &)=delete
 
Paletteoperator= (Palette &&)
 
void setColor (int type, const gcn::Color &color, const std::optional< gcn::Color > &outlineColor, GradientType grad, int delay)
 
const gcn::Color & getColor (int type) const
 Gets the color associated with the type.
 
const std::optional< gcn::Color > & getOutlineColor (int type) const
 Gets the optional outline color associated with the type.
 
GradientType getGradientType (int type) const
 Gets the GradientType associated with the specified type.
 
int getGradientDelay (int type) const
 Gets the gradient delay for the specified type.
 

Private Member Functions

void setColorAt (int i, int r, int g, int b)
 Define a color replacement.
 
void commit (bool commitNonStatic)
 Commit the colors.
 
void addColor (int type, unsigned int rgb, GradientType grad, const std::string &text, int delay=GRADIENT_DELAY)
 Initialise color.
 

Additional Inherited Members

- Static Public Member Functions inherited from Palette
static void advanceGradients ()
 Updates all colors, that are non-static.
 
- Protected Types inherited from Palette
using Palettes = std::set< Palette * >
 
- Protected Member Functions inherited from Palette
void advanceGradient (int advance)
 
- Protected Attributes inherited from Palette
std::vector< ColorElemmColors
 Vector containing the colors.
 
std::vector< ColorElem * > mGradVector
 
- Static Protected Attributes inherited from Palette
static const gcn::Color RAINBOW_COLORS []
 Colors used for the rainbow gradient.
 
static const int RAINBOW_COLOR_COUNT = 7
 Number of Elemets of RAINBOW_COLORS.
 
static Timer mRainbowTimer
 Timer used when updating gradient-type colors.
 
static Palettes mInstances
 

Detailed Description

Class controlling the game's color palette.

Definition at line 32 of file userpalette.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

List of all colors that are configurable.

Enumerator
BEING 
PC 
SELF 
GM 
NPC 
MONSTER 
PARTY 
GUILD 
PARTICLE 
EXP_INFO 
PICKUP_INFO 
HIT_PLAYER_MONSTER 
HIT_MONSTER_PLAYER 
HIT_CRITICAL 
HIT_LOCAL_PLAYER_MONSTER 
HIT_LOCAL_PLAYER_CRITICAL 
HIT_LOCAL_PLAYER_MISS 
MISS 
USER_COLOR_LAST 

Definition at line 36 of file userpalette.h.

Constructor & Destructor Documentation

◆ UserPalette()

UserPalette::UserPalette ( )

Definition at line 51 of file userpalette.cpp.

◆ ~UserPalette()

UserPalette::~UserPalette ( )
override

Definition at line 86 of file userpalette.cpp.

Member Function Documentation

◆ addColor()

void UserPalette::addColor ( int  type,
unsigned int  rgb,
GradientType  grad,
const std::string &  text,
int  delay = GRADIENT_DELAY 
)
private

Initialise color.

Parameters
rgbdefault color if not found in config
textidentifier of color

Definition at line 193 of file userpalette.cpp.

◆ commit() [1/2]

void UserPalette::commit ( )
inline

Commit the colors.

Definition at line 139 of file userpalette.h.

◆ commit() [2/2]

void UserPalette::commit ( bool  commitNonStatic)
private

Commit the colors.

Commit the non-static color values, if commitNonStatic is true. Only needed in the constructor.

Definition at line 146 of file userpalette.cpp.

◆ getColorTypeAt()

int UserPalette::getColorTypeAt ( int  i)

Gets the ColorType used by the color for the element at index i in the current color model.

Parameters
ithe index of the color
Returns
the color type of the color with the given index

Definition at line 183 of file userpalette.cpp.

◆ getCommittedColor()

const gcn::Color & UserPalette::getCommittedColor ( int  type)
inline

Gets the committed color associated with the specified type.

Parameters
typethe color type requested
Returns
the requested committed color

Definition at line 69 of file userpalette.h.

◆ getElementAt()

std::string UserPalette::getElementAt ( int  i)
override

Returns the name of the ith color.

Parameters
iindex of color interested in
Returns
the name of the color

Definition at line 137 of file userpalette.cpp.

◆ getNumberOfElements()

int UserPalette::getNumberOfElements ( )
inlineoverride

Returns the number of colors known.

Returns
the number of colors known

Definition at line 125 of file userpalette.h.

◆ getTestColor()

const gcn::Color & UserPalette::getTestColor ( int  type)
inline

Gets the test color associated with the specified type.

Parameters
typethe color type requested
Returns
the requested test color

Definition at line 81 of file userpalette.h.

◆ rollback()

void UserPalette::rollback ( )

Rollback the colors.

Definition at line 163 of file userpalette.cpp.

◆ setColor()

void UserPalette::setColor ( int  type,
int  r,
int  g,
int  b 
)

Sets the color for the specified type.

Parameters
typecolor to be set
rred component
ggreen component
bblue component

Definition at line 105 of file userpalette.cpp.

◆ setColorAt()

void UserPalette::setColorAt ( int  i,
int  r,
int  g,
int  b 
)
private

Define a color replacement.

Parameters
ithe index of the color to replace
rred component
ggreen component
bblue component

◆ setGradient()

void UserPalette::setGradient ( int  type,
Palette::GradientType  grad 
)

Sets the gradient type for the specified color.

Parameters
gradgradient type to set

Definition at line 112 of file userpalette.cpp.

◆ setGradientDelay()

void UserPalette::setGradientDelay ( int  type,
int  delay 
)
inline

Sets the gradient delay for the specified color.

Definition at line 117 of file userpalette.h.

◆ setTestColor()

void UserPalette::setTestColor ( int  type,
const gcn::Color &  color 
)
inline

Sets the test color associated with the specified type.

Parameters
typethe color type requested
colorthe color that should be tested

Definition at line 92 of file userpalette.h.


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