39 #ifndef DOXYGEN_SHOULD_SKIP_THIS 62 using ConsoleColorControl =
char;
246 return m_data.getSize().width;
253 return m_data.getSize().height;
268 m_background = color;
288 m_foreground = color;
360 void setChar(Vector2i position,
char16_t c);
370 char16_t getChar(Vector2i position)
const;
399 void putChar(Vector2i position,
char16_t c,
const Color4f& foreground,
const Color4f& background);
442 m_alignment = alignment;
470 void print(Vector2i position,
const char *fmt, ...)
GF_FORMAT(3, 4);
552 void setColorControl(ConsoleColorControl ctrl,
const Color4f& foreground,
const Color4f& background);
627 void setFade(
float amount,
const Color4f& color) {
628 m_fadingAmount = amount;
629 m_fadingColor = color;
638 return m_fadingAmount;
647 return m_fadingColor;
663 void blit(
const RectI& src,
Console& con, Vector2i dst,
float foregroundAlpha = 1.0f,
float backgroundAlpha = 1.0f)
const;
668 Color4f computeColor(
ConsoleEffect effect,
const Color4f& existing,
const Color4f& current);
670 int putWord(Vector2i position,
ConsoleEffect effect,
const std::u32string& message,
const Color4f& foreground,
const Color4f& background);
672 enum class PrintOption {
677 using PrintOptionFlags =
Flags<PrintOption>;
679 int printInternal(
const RectI& rect,
ConsoleEffect effect,
ConsoleAlignment alignment,
const std::string& message, PrintOptionFlags flags = None);
690 Color4f m_background;
691 Color4f m_foreground;
696 struct ColorControl {
701 static constexpr char ColorControlCount = 5;
702 ColorControl m_controls[ColorControlCount];
704 float m_fadingAmount;
705 Color4f m_fadingColor;
708 #ifndef DOXYGEN_SHOULD_SKIP_THIS
Definition: Console.h:144
PrintAction
An action when printing.
Definition: Console.h:229
const Color4f & getDefaultForeground() const
Get the default foreground color.
Definition: Console.h:297
void setDefaultForeground(const Color4f &color)
Set the default foreground color.
Definition: Console.h:287
A two-dimensional array.
Definition: Array2D.h:63
Kind
The kind of console effect.
Definition: Console.h:132
void setDefaultConsoleEffect(ConsoleEffect effect)
Set the default console effect.
Definition: Console.h:417
A virtual console.
Definition: Console.h:224
int printRect(const RectI &rect, ConsoleEffect effect, ConsoleAlignment alignment, const char *fmt,...)
Print a multi-line formatted string.
constexpr ConsoleColorControl ConsoleColorControlStop
The constant for color control stop.
Definition: Console.h:110
Definition: Console.h:135
constexpr ConsoleEffect(Kind kind)
Constructor with a kind only.
Definition: Console.h:157
Console(const ConsoleFont &font, Vector2i size)
Constructor.
Definition: Console.h:143
Base class for all render targets (window, texture, ...)
Definition: RenderTarget.h:66
Define the states used for drawing to a RenderTarget.
Definition: RenderStates.h:82
int getHeight(const RectI &rect, const char *fmt,...)
Get the expected number of console lines of a multi-line formatted string.
Bitfield relying on an enumeration.
Definition: Flags.h:68
const Color4f & getFadingColor() const
Get the fading color.
Definition: Console.h:646
void drawHorizontalLine(Vector2i left, int width, ConsoleEffect effect=ConsoleEffect::Default)
Draw a horizontal line.
constexpr ConsoleColorControl ConsoleColorControl3
The constant for color control #3.
Definition: Console.h:86
constexpr ConsoleEffect(Kind kind, float alpha)
Constructor with a kind and .
Definition: Console.h:173
void drawFrame(const RectI &rect, PrintAction action=PrintAction::None, ConsoleEffect effect=ConsoleEffect::Default, const char *title=nullptr,...)
Draw a frame.
void print(Vector2i position, const char *fmt,...)
Print a formatted string.
void print(Vector2i position, ConsoleEffect effect, ConsoleAlignment alignment, const char *fmt,...)
Print a formatted string.
constexpr ConsoleColorControl ConsoleColorControl5
The constant for color control #5.
Definition: Console.h:102
void setCharBackground(Vector2i position, const Color4f &color, ConsoleEffect effect=ConsoleEffect::Set)
Set the character background color.
constexpr ConsoleColorControl ConsoleColorControl2
The constant for color control #2.
Definition: Console.h:78
Definition: Console.h:140
void setChar(Vector2i position, char16_t c)
Set a character.
Use the default console effect.
Definition: Console.h:146
constexpr float getAlpha() const noexcept
Get the alpha value.
Definition: Console.h:197
Definition: Console.h:139
constexpr bool isDefault() const noexcept
Check if the effect if Console::Default.
Definition: Console.h:190
void setFade(float amount, const Color4f &color)
Set the fading parameters.
Definition: Console.h:627
Definition: Console.h:145
void setCharForeground(Vector2i position, const Color4f &color)
Set the character foreground color.
void drawVerticalLine(Vector2i top, int height, ConsoleEffect effect=ConsoleEffect::Default)
Draw a vertical line.
Definition: Console.h:137
const Color4f & getCharForeground(Vector2i position) const
Get the character foreground color.
ConsoleAlignment
The alignment of the text in the console.
Definition: Console.h:50
Definition: Console.h:138
Do not change the background color.
Definition: Console.h:133
The namespace for gf classes.
Definition: Action.h:34
ConsoleEffect getDefaultConsoleEffect() const
Get the default console effect.
Definition: Console.h:430
virtual void draw(RenderTarget &target, RenderStates states) override
Draw the object to a render target.
char16_t getChar(Vector2i position) const
Get a character.
void clear()
Clear the console.
constexpr ConsoleColorControl ConsoleColorControl1
The constant for color control #1.
Definition: Console.h:70
Fill the area with space characters.
constexpr ConsoleColorControl ConsoleColorControl4
The constant for color control #4.
Definition: Console.h:94
Definition: Console.h:141
void setDefaultBackground(const Color4f &color)
Set the default background color.
Definition: Console.h:267
float getFadingAmount() const
Get the fading amount.
Definition: Console.h:637
Definition: Console.h:136
void blit(const RectI &src, Console &con, Vector2i dst, float foregroundAlpha=1.0f, float backgroundAlpha=1.0f) const
Blit a console on another console.
A console font.
Definition: ConsoleFont.h:110
Definition: Console.h:142
Definition: Console.h:134
int printRect(const RectI &rect, const char *fmt,...)
Print a multi-line formatted string.
A console effect on the background color.
Definition: Console.h:126
ConsoleAlignment getDefaultAlignment() const
Get the default alignment.
Definition: Console.h:452
void setColorControl(ConsoleColorControl ctrl, const Color4f &foreground, const Color4f &background)
Set a color for color control.
constexpr Kind getKind() const noexcept
Get the kind of effect.
Definition: Console.h:183
#define GF_API
Definition: Portability.h:35
void setDefaultAlignment(ConsoleAlignment alignment)
Set the default alignment.
Definition: Console.h:441
int getHeight() const
Get the height of the console.
Definition: Console.h:252
const Color4f & getDefaultBackground() const
Get the default background color.
Definition: Console.h:277
const Color4f & getCharBackground(Vector2i position) const
Get the character background color.
int getWidth() const
Get the width of the console.
Definition: Console.h:245
#define GF_FORMAT(X, Y)
Definition: Portability.h:42
void putChar(Vector2i position, char16_t c, const Color4f &foreground, const Color4f &background)
Modify a cell in the console.
void drawRectangle(const RectI &rect, PrintAction action=PrintAction::None, ConsoleEffect effect=ConsoleEffect::Default)
Draw a filled rectangle.
void putChar(Vector2i position, char16_t c, ConsoleEffect effect=ConsoleEffect::Default)
Modify a cell in the console.