31#include "ConsoleFont.h"
33#include "GraphicsApi.h"
35#include "Portability.h"
37#include "Transformable.h"
41#ifndef DOXYGEN_SHOULD_SKIP_THIS
243 return m_data.getSize().width;
250 return m_data.getSize().height;
397 int printRect(const
RectI& rect, const
ConsoleStyle& style, const
char *fmt, ...) GF_FORMAT(4, 5);
411 int getHeight(const
RectI& rect, const
char *fmt, ...) GF_FORMAT(3, 4);
502 m_fadingAmount = amount;
503 m_fadingColor = color;
512 return m_fadingAmount;
521 return m_fadingColor;
546 enum class PrintOption {
560 const ConsoleFont *m_font;
561 Array2D<Cell, int> m_data;
563 struct ColorControl {
568 static constexpr char ColorControlCount = 5;
569 ColorControl m_controls[ColorControlCount];
571 float m_fadingAmount;
575#ifndef DOXYGEN_SHOULD_SKIP_THIS
A console effect on the background color.
Definition: Console.h:127
constexpr Kind getKind() const noexcept
Get the kind of effect.
Definition: Console.h:183
constexpr float getAlpha() const noexcept
Get the alpha value.
Definition: Console.h:190
constexpr ConsoleEffect(Kind kind, float alpha)
Constructor with a kind and .
Definition: Console.h:173
Kind
The kind of console effect.
Definition: Console.h:133
@ Darken
Definition: Console.h:138
@ None
Do not change the background color.
Definition: Console.h:134
@ Lighten
Definition: Console.h:137
@ Overlay
Definition: Console.h:145
@ Set
Definition: Console.h:135
@ Burn
Definition: Console.h:144
@ ColorBurn
Definition: Console.h:141
@ Screen
Definition: Console.h:139
@ Alpha
Definition: Console.h:146
@ Multiply
Definition: Console.h:136
@ ColorDodge
Definition: Console.h:140
@ Add
Definition: Console.h:142
@ AddAlpha
Definition: Console.h:143
constexpr ConsoleEffect(Kind kind)
Constructor with a kind only.
Definition: Console.h:157
A console font.
Definition: ConsoleFont.h:111
A virtual console.
Definition: Console.h:221
void clear(const ConsoleStyle &style=ConsoleStyle())
Clear the console.
char16_t getChar(Vector2i position) const
Get a character.
Color4f getCharBackground(Vector2i position) const
Get the character background color.
int getHeight() const
Get the height of the console.
Definition: Console.h:249
Console(const ConsoleFont &font, Vector2i size)
Constructor.
int getWidth() const
Get the width of the console.
Definition: Console.h:242
Color4f getFadingColor() const
Get the fading color.
Definition: Console.h:520
PrintAction
An action when printing.
Definition: Console.h:226
virtual void draw(RenderTarget &target, const RenderStates &states) override
Draw the object to a render target.
void setCharBackground(Vector2i position, Color4f color, ConsoleEffect effect=ConsoleEffect::Set)
Set the character background color.
void putChar(Vector2i position, char16_t c, const ConsoleStyle &style=ConsoleStyle())
Modify a cell in the console.
Color4f getCharForeground(Vector2i position) const
Get the character foreground color.
void setCharForeground(Vector2i position, Color4f color)
Set the character foreground color.
void setChar(Vector2i position, char16_t c)
Set a character.
void print(Vector2i position, const ConsoleStyle &style, const char *fmt,...)
Print a formatted string.
float getFadingAmount() const
Get the fading amount.
Definition: Console.h:511
void blit(const RectI &src, Console &con, Vector2i dst, float foregroundAlpha=1.0f, float backgroundAlpha=1.0f) const
Blit a console on another console.
void putChar(Vector2i position, char16_t c, Color4f foreground, Color4f background)
Modify a cell in the console.
Bitfield relying on an enumeration.
Definition: Flags.h:48
Base class for all render targets (window, texture, ...)
Definition: RenderTarget.h:102
Color4< float > Color4f
A float color vector with 4 components.
Definition: Vector.h:1287
constexpr NoneType None
Constant to represent "none".
Definition: Types.h:45
constexpr ConsoleColorControl ConsoleColorControl5
The constant for color control #5.
Definition: Console.h:104
char ConsoleColorControl
A type for color controls in a console.
Definition: Console.h:64
ConsoleAlignment
The alignment of the text in the console.
Definition: Console.h:52
constexpr ConsoleColorControl ConsoleColorControl1
The constant for color control #1.
Definition: Console.h:72
constexpr ConsoleColorControl ConsoleColorControl4
The constant for color control #4.
Definition: Console.h:96
constexpr ConsoleColorControl ConsoleColorControl3
The constant for color control #3.
Definition: Console.h:88
constexpr ConsoleColorControl ConsoleColorControl2
The constant for color control #2.
Definition: Console.h:80
constexpr ConsoleColorControl ConsoleColorControlStop
The constant for color control stop.
Definition: Console.h:112
@ Center
Centered alignment.
The namespace for gf classes.
static constexpr Color4< T > White
White predefined color.
Definition: Color.h:168
static constexpr Color4< T > Black
Black predefined color.
Definition: Color.h:163
A console style.
Definition: Console.h:204
Define the states used for drawing to a RenderTarget.
Definition: RenderStates.h:82
A 4D vector.
Definition: Vector.h:852