2017-07-22 22:08:25 +02:00
|
|
|
/*****************************************************************************
|
2020-07-21 15:04:34 +02:00
|
|
|
* Copyright (c) 2014-2020 OpenRCT2 developers
|
2017-07-22 22:08:25 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2017-07-22 22:08:25 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2017-07-22 22:08:25 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../common.h"
|
2021-02-27 12:49:14 +01:00
|
|
|
#include "../interface/Colour.h"
|
2021-02-27 12:40:20 +01:00
|
|
|
#include "Font.h"
|
2018-03-13 13:14:02 +01:00
|
|
|
|
2020-07-08 14:14:43 +02:00
|
|
|
struct ScreenCoordsXY;
|
2018-03-13 13:14:02 +01:00
|
|
|
struct rct_drawpixelinfo;
|
2020-08-26 14:57:49 +02:00
|
|
|
class Formatter;
|
2017-07-22 22:08:25 +02:00
|
|
|
|
|
|
|
enum class TextAlignment
|
|
|
|
{
|
|
|
|
LEFT,
|
|
|
|
CENTRE,
|
|
|
|
RIGHT
|
|
|
|
};
|
|
|
|
|
2021-02-26 21:11:26 +01:00
|
|
|
enum class TextUnderline
|
|
|
|
{
|
|
|
|
Off,
|
|
|
|
On,
|
|
|
|
};
|
|
|
|
|
2017-07-22 22:08:25 +02:00
|
|
|
struct TextPaint
|
|
|
|
{
|
2021-02-27 12:49:14 +01:00
|
|
|
colour_t Colour = COLOUR_BLACK;
|
2021-02-27 14:42:04 +01:00
|
|
|
FontSpriteBase SpriteBase = FontSpriteBase::MEDIUM;
|
2021-02-26 21:11:26 +01:00
|
|
|
TextUnderline UnderlineText = TextUnderline::Off;
|
2018-06-22 22:59:03 +02:00
|
|
|
TextAlignment Alignment = TextAlignment::LEFT;
|
2021-02-27 13:04:52 +01:00
|
|
|
|
2022-04-25 15:37:32 +02:00
|
|
|
TextPaint() = default;
|
2021-02-27 13:04:52 +01:00
|
|
|
TextPaint(colour_t colour)
|
|
|
|
: Colour(colour)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(FontSpriteBase spriteBase)
|
|
|
|
: SpriteBase(spriteBase)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(TextUnderline underlineText)
|
|
|
|
: UnderlineText(underlineText)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(TextAlignment alignment)
|
|
|
|
: Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
TextPaint(colour_t colour, FontSpriteBase spriteBase)
|
|
|
|
: Colour(colour)
|
|
|
|
, SpriteBase(spriteBase)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(colour_t colour, TextUnderline underlineText)
|
|
|
|
: Colour(colour)
|
|
|
|
, UnderlineText(underlineText)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(colour_t colour, TextAlignment alignment)
|
|
|
|
: Colour(colour)
|
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
TextPaint(FontSpriteBase spriteBase, TextUnderline underlineText)
|
|
|
|
: SpriteBase(spriteBase)
|
|
|
|
, UnderlineText(underlineText)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(FontSpriteBase spriteBase, TextAlignment alignment)
|
|
|
|
: SpriteBase(spriteBase)
|
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
2021-02-27 14:32:13 +01:00
|
|
|
TextPaint(TextUnderline underlineText, TextAlignment alignment)
|
|
|
|
: UnderlineText(underlineText)
|
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
2021-02-27 13:04:52 +01:00
|
|
|
|
|
|
|
TextPaint(colour_t colour, FontSpriteBase spriteBase, TextUnderline underlineText)
|
|
|
|
: Colour(colour)
|
|
|
|
, SpriteBase(spriteBase)
|
|
|
|
, UnderlineText(underlineText)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(colour_t colour, FontSpriteBase spriteBase, TextAlignment alignment)
|
|
|
|
: Colour(colour)
|
|
|
|
, SpriteBase(spriteBase)
|
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(colour_t colour, TextUnderline underlineText, TextAlignment alignment)
|
|
|
|
: Colour(colour)
|
|
|
|
, UnderlineText(underlineText)
|
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(FontSpriteBase spriteBase, TextUnderline underlineText, TextAlignment alignment)
|
|
|
|
: SpriteBase(spriteBase)
|
|
|
|
, UnderlineText(underlineText)
|
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
TextPaint(colour_t colour, FontSpriteBase spriteBase, TextUnderline underlineText, TextAlignment alignment)
|
|
|
|
: Colour(colour)
|
|
|
|
, SpriteBase(spriteBase)
|
|
|
|
, UnderlineText(underlineText)
|
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
2017-07-22 22:08:25 +02:00
|
|
|
};
|
|
|
|
|
2021-12-12 00:06:06 +01:00
|
|
|
void DrawTextBasic(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, rct_string_id format);
|
|
|
|
void DrawTextEllipsised(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, rct_string_id format);
|
|
|
|
int32_t DrawTextWrapped(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, rct_string_id format);
|
|
|
|
|
2021-02-27 13:10:00 +01:00
|
|
|
void DrawTextBasic(
|
2021-12-12 00:06:06 +01:00
|
|
|
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, rct_string_id format, const Formatter& ft, TextPaint textPaint = {});
|
2020-08-26 14:57:49 +02:00
|
|
|
void DrawTextEllipsised(
|
|
|
|
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, const Formatter& ft,
|
2021-02-28 00:22:24 +01:00
|
|
|
TextPaint textPaint = {});
|
2021-02-27 17:17:17 +01:00
|
|
|
int32_t DrawTextWrapped(
|
2021-12-12 00:06:06 +01:00
|
|
|
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, const Formatter& ft,
|
2021-02-27 17:17:17 +01:00
|
|
|
TextPaint textPaint = {});
|