Mana
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Palette Class Reference

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

#include <palette.h>

Inheritance diagram for Palette:
UserPalette

Classes

struct  ColorElem
 

Public Types

enum  GradientType { STATIC , PULSE , SPECTRUM , RAINBOW }
 Colors can be static or can alter over time. More...
 

Public Member Functions

 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.
 

Static Public Member Functions

static void advanceGradients ()
 Updates all colors, that are non-static.
 

Protected Types

using Palettes = std::set< Palette * >
 

Protected Member Functions

void advanceGradient (int advance)
 

Protected Attributes

std::vector< ColorElemmColors
 Vector containing the colors.
 
std::vector< ColorElem * > mGradVector
 

Static Protected Attributes

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 41 of file palette.h.

Member Typedef Documentation

◆ Palettes

using Palette::Palettes = std::set<Palette *>
protected

Definition at line 121 of file palette.h.

Member Enumeration Documentation

◆ GradientType

Colors can be static or can alter over time.

Enumerator
STATIC 
PULSE 
SPECTRUM 
RAINBOW 

Definition at line 53 of file palette.h.

Constructor & Destructor Documentation

◆ Palette() [1/3]

Palette::Palette ( int  size)

Definition at line 43 of file palette.cpp.

◆ Palette() [2/3]

Palette::Palette ( const Palette )
delete

◆ Palette() [3/3]

Palette::Palette ( Palette &&  pal)

Definition at line 49 of file palette.cpp.

◆ ~Palette()

Palette::~Palette ( )

Definition at line 56 of file palette.cpp.

Member Function Documentation

◆ advanceGradient()

void Palette::advanceGradient ( int  advance)
protected

Definition at line 94 of file palette.cpp.

◆ advanceGradients()

void Palette::advanceGradients ( )
static

Updates all colors, that are non-static.

Definition at line 82 of file palette.cpp.

◆ getColor()

const gcn::Color & Palette::getColor ( int  type) const
inline

Gets the color associated with the type.

Parameters
typethe color type requested
Returns
the requested color

Definition at line 72 of file palette.h.

◆ getGradientDelay()

int Palette::getGradientDelay ( int  type) const
inline

Gets the gradient delay for the specified type.

Parameters
typethe color type of the color
Returns
the gradient delay of the color with the given index

Definition at line 105 of file palette.h.

◆ getGradientType()

GradientType Palette::getGradientType ( int  type) const
inline

Gets the GradientType associated with the specified type.

Parameters
typethe color type of the color
Returns
the gradient type of the color with the given index

Definition at line 94 of file palette.h.

◆ getOutlineColor()

const std::optional< gcn::Color > & Palette::getOutlineColor ( int  type) const
inline

Gets the optional outline color associated with the type.

Parameters
typethe color type requested
Returns
the requested outline color, if any

Definition at line 83 of file palette.h.

◆ operator=() [1/2]

Palette & Palette::operator= ( const Palette )
delete

◆ operator=() [2/2]

Palette & Palette::operator= ( Palette &&  pal)

Definition at line 61 of file palette.cpp.

◆ setColor()

void Palette::setColor ( int  type,
const gcn::Color &  color,
const std::optional< gcn::Color > &  outlineColor,
GradientType  grad,
int  delay 
)

Definition at line 71 of file palette.cpp.

Member Data Documentation

◆ mColors

std::vector<ColorElem> Palette::mColors
protected

Vector containing the colors.

Definition at line 157 of file palette.h.

◆ mGradVector

std::vector<ColorElem*> Palette::mGradVector
protected

Definition at line 158 of file palette.h.

◆ mInstances

Palette::Palettes Palette::mInstances
staticprotected

Definition at line 122 of file palette.h.

◆ mRainbowTimer

Timer Palette::mRainbowTimer
staticprotected

Timer used when updating gradient-type colors.

Definition at line 119 of file palette.h.

◆ RAINBOW_COLOR_COUNT

const int Palette::RAINBOW_COLOR_COUNT = 7
staticprotected

Number of Elemets of RAINBOW_COLORS.

Definition at line 116 of file palette.h.

◆ RAINBOW_COLORS

const gcn::Color Palette::RAINBOW_COLORS
staticprotected
Initial value:
= {
gcn::Color(255, 0, 0),
gcn::Color(255, 153, 0),
gcn::Color(255, 255, 0),
gcn::Color(0, 153, 0),
gcn::Color(0, 204, 204),
gcn::Color(51, 0, 153),
gcn::Color(153, 0, 153)
}

Colors used for the rainbow gradient.

Definition at line 31 of file palette.h.


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