@@ -38,25 +38,26 @@ struct FontState {
std::stack<TextColour, std::vector<TextColour>> colour_stack; ///< Stack of colours to assist with colour switching.
FontState() : fontsize(FS_END), cur_colour(TC_INVALID) {}
FontState(TextColour colour, FontSize fontsize) : fontsize(fontsize), cur_colour(colour) {}
/**
* Switch to new colour \a c.
* @param c New colour to use.
*/
inline void SetColour(TextColour c)
{
assert(c >= TC_BLUE && c <= TC_BLACK);
assert((c & TC_COLOUR_MASK) >= TC_BLUE && (c & TC_COLOUR_MASK) <= TC_BLACK);
assert((c & (TC_COLOUR_MASK | TC_FLAGS_MASK)) == c);
if ((this->cur_colour & TC_FORCED) == 0) this->cur_colour = c;
}
* Switch to and pop the last saved colour on the stack.
inline void PopColour()
if (colour_stack.empty()) return;
SetColour(colour_stack.top());
colour_stack.pop();
@@ -270,24 +270,27 @@ enum TextColour {
TC_BROWN = 0x0B,
TC_WHITE = 0x0C,
TC_LIGHT_BLUE = 0x0D,
TC_GREY = 0x0E,
TC_DARK_BLUE = 0x0F,
TC_BLACK = 0x10,
TC_END,
TC_INVALID = 0xFF,
TC_IS_PALETTE_COLOUR = 0x100, ///< Colour value is already a real palette colour index, not an index of a StringColour.
TC_NO_SHADE = 0x200, ///< Do not add shading to this text colour.
TC_FORCED = 0x400, ///< Ignore colour changes from strings.
TC_COLOUR_MASK = 0xFF, ///< Mask to test if TextColour (without flags) is within limits.
TC_FLAGS_MASK = 0x700, ///< Mask to test if TextColour (with flags) is within limits.
};
DECLARE_ENUM_AS_BIT_SET(TextColour)
/** Defines a few values that are related to animations using palette changes */
enum PaletteAnimationSizes {
PALETTE_ANIM_SIZE = 28, ///< number of animated colours
PALETTE_ANIM_START = 227, ///< Index in the _palettes array from which all animations are taking places (table/palettes.h)
/** Define the operation GfxFillRect performs */
enum FillRectMode {
FILLRECT_OPAQUE, ///< Fill rectangle with a single colour
Status change: