2017-07-22 22:08:25 +02:00
|
|
|
/*****************************************************************************
|
2023-01-01 11:58:01 +01:00
|
|
|
* Copyright (c) 2014-2023 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,
|
|
|
|
};
|
|
|
|
|
2022-10-12 18:27:05 +02:00
|
|
|
enum class TextDarkness
|
|
|
|
{
|
|
|
|
Regular = 0,
|
|
|
|
Dark = 1,
|
|
|
|
ExtraDark = 2,
|
|
|
|
};
|
|
|
|
|
2017-07-22 22:08:25 +02:00
|
|
|
struct TextPaint
|
|
|
|
{
|
2021-02-27 12:49:14 +01:00
|
|
|
colour_t Colour = COLOUR_BLACK;
|
2022-10-12 22:40:59 +02:00
|
|
|
::FontStyle FontStyle = FontStyle::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;
|
2022-10-12 18:27:05 +02:00
|
|
|
TextDarkness Darkness = TextDarkness::Regular;
|
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)
|
|
|
|
{
|
|
|
|
}
|
2022-10-12 22:40:59 +02:00
|
|
|
TextPaint(::FontStyle fontStyle)
|
|
|
|
: FontStyle(fontStyle)
|
2021-02-27 13:04:52 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(TextUnderline underlineText)
|
|
|
|
: UnderlineText(underlineText)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(TextAlignment alignment)
|
|
|
|
: Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-10-12 22:40:59 +02:00
|
|
|
TextPaint(colour_t colour, ::FontStyle fontStyle)
|
2021-02-27 13:04:52 +01:00
|
|
|
: Colour(colour)
|
2022-10-12 22:40:59 +02:00
|
|
|
, FontStyle(fontStyle)
|
2021-02-27 13:04:52 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(colour_t colour, TextUnderline underlineText)
|
|
|
|
: Colour(colour)
|
|
|
|
, UnderlineText(underlineText)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
TextPaint(colour_t colour, TextAlignment alignment)
|
|
|
|
: Colour(colour)
|
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-10-12 22:40:59 +02:00
|
|
|
TextPaint(::FontStyle fontStyle, TextUnderline underlineText)
|
|
|
|
: FontStyle(fontStyle)
|
2021-02-27 13:04:52 +01:00
|
|
|
, UnderlineText(underlineText)
|
|
|
|
{
|
|
|
|
}
|
2022-10-12 22:40:59 +02:00
|
|
|
TextPaint(::FontStyle fontStyle, TextAlignment alignment)
|
|
|
|
: FontStyle(fontStyle)
|
2021-02-27 13:04:52 +01:00
|
|
|
, 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
|
|
|
|
2022-10-12 22:40:59 +02:00
|
|
|
TextPaint(colour_t colour, ::FontStyle fontStyle, TextUnderline underlineText)
|
2021-02-27 13:04:52 +01:00
|
|
|
: Colour(colour)
|
2022-10-12 22:40:59 +02:00
|
|
|
, FontStyle(fontStyle)
|
2021-02-27 13:04:52 +01:00
|
|
|
, UnderlineText(underlineText)
|
|
|
|
{
|
|
|
|
}
|
2022-10-12 22:40:59 +02:00
|
|
|
TextPaint(colour_t colour, ::FontStyle fontStyle, TextAlignment alignment)
|
2021-02-27 13:04:52 +01:00
|
|
|
: Colour(colour)
|
2022-10-12 22:40:59 +02:00
|
|
|
, FontStyle(fontStyle)
|
2021-02-27 13:04:52 +01:00
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
2022-10-12 22:40:59 +02:00
|
|
|
TextPaint(colour_t colour, ::FontStyle fontStyle, TextDarkness darkness)
|
2022-10-12 18:27:05 +02:00
|
|
|
: Colour(colour)
|
2022-10-12 22:40:59 +02:00
|
|
|
, FontStyle(fontStyle)
|
2022-10-12 18:27:05 +02:00
|
|
|
, Darkness(darkness)
|
|
|
|
{
|
|
|
|
}
|
2021-02-27 13:04:52 +01:00
|
|
|
TextPaint(colour_t colour, TextUnderline underlineText, TextAlignment alignment)
|
|
|
|
: Colour(colour)
|
|
|
|
, UnderlineText(underlineText)
|
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
2022-10-12 22:40:59 +02:00
|
|
|
TextPaint(::FontStyle fontStyle, TextUnderline underlineText, TextAlignment alignment)
|
|
|
|
: FontStyle(fontStyle)
|
2021-02-27 13:04:52 +01:00
|
|
|
, UnderlineText(underlineText)
|
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-10-12 22:40:59 +02:00
|
|
|
TextPaint(colour_t colour, ::FontStyle fontStyle, TextUnderline underlineText, TextAlignment alignment)
|
2021-02-27 13:04:52 +01:00
|
|
|
: Colour(colour)
|
2022-10-12 22:40:59 +02:00
|
|
|
, FontStyle(fontStyle)
|
2021-02-27 13:04:52 +01:00
|
|
|
, UnderlineText(underlineText)
|
|
|
|
, Alignment(alignment)
|
|
|
|
{
|
|
|
|
}
|
2022-10-12 22:40:59 +02:00
|
|
|
TextPaint(colour_t colour, ::FontStyle fontStyle, TextAlignment alignment, TextDarkness darkness)
|
2022-10-12 18:27:05 +02:00
|
|
|
: Colour(colour)
|
2022-10-12 22:40:59 +02:00
|
|
|
, FontStyle(fontStyle)
|
2022-10-12 18:27:05 +02:00
|
|
|
, Alignment(alignment)
|
|
|
|
, Darkness(darkness)
|
|
|
|
{
|
|
|
|
}
|
2017-07-22 22:08:25 +02:00
|
|
|
};
|
|
|
|
|
2022-07-31 14:22:58 +02:00
|
|
|
void DrawTextBasic(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, StringId format);
|
|
|
|
void DrawTextEllipsised(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, StringId format);
|
|
|
|
int32_t DrawTextWrapped(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, StringId format);
|
2021-12-12 00:06:06 +01:00
|
|
|
|
2021-02-27 13:10:00 +01:00
|
|
|
void DrawTextBasic(
|
2022-07-31 14:22:58 +02:00
|
|
|
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, StringId format, const Formatter& ft, TextPaint textPaint = {});
|
2020-08-26 14:57:49 +02:00
|
|
|
void DrawTextEllipsised(
|
2022-07-31 14:22:58 +02:00
|
|
|
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, StringId 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(
|
2022-07-31 14:22:58 +02:00
|
|
|
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, StringId format, const Formatter& ft,
|
2021-02-27 17:17:17 +01:00
|
|
|
TextPaint textPaint = {});
|