Gorgon Game Engine
Console Class Reference

Console manipulation functions. Not thread safe. Current only std::cout is supported. More...

Public Types

enum  Color {
  Default, Black, White, Red,
  Cyan, Blue, Yellow, Magenta,
  Green
}
 The colors that can be used for console coloring. This is a safe list. More...
 
enum  ColorSupportLevel { None, Safelist, RGB }
 Level of support for color. More...
 

Public Member Functions

 Console ()=default
 Empty console, nothing can be done with it. More...
 
 Console (ConsoleBackend &backend)
 Creates a new console with the specified backend. More...
 
 Console (const Console &other)
 Console objects can be copied. They are reference counted. More...
 
 ~Console ()
 
void ClearScreen ()
 Clears the console screen. More...
 
ColorSupportLevel ColorSupport () const
 Returns if color is supported in this terminal. More...
 
int GetHeight () const
 Returns the size of the console window in cols/rows. More...
 
Geometry::Size GetSize () const
 Returns the size of the console window in cols/rows. More...
 
int GetWidth () const
 Returns the size of the console window in cols/rows. More...
 
void GotoXY (Geometry::Point location)
 Changes the position of the caret to the given position. More...
 
void GotoXY (int x, int y)
 Changes the position of the caret to the given position. More...
 
void HideCaret ()
 Hides input cursor. More...
 
bool IsColorSupported () const
 Returns if the color is supported by this console. More...
 
bool IsReady () const
 Returns if the console is usable. More...
 
bool IsStylesSupported () const
 Returns if color is supported in this terminal. Even if this is false, bold can be emulated. More...
 
 operator bool () const
 Returns if the console is usable. More...
 
Consoleoperator= (const Console &other)
 Console objects can be copied. They are reference counted. More...
 
std::ostream & OutStream () const
 
void Reset ()
 Resets terminal attributes. More...
 
void SetBackground (Color color)
 Sets the background color to the given value. Use Default to set it to default color. More...
 
void SetBackground (Graphics::RGBA color)
 Sets the background color to the given value. Use Default to set it to default color. More...
 
void SetBold (bool bold=true)
 Sets terminal font to bold or normal. More...
 
void SetColor (Color color)
 Sets the color to the given value, avoid, black and white as console can have its background color reversed. More...
 
void SetColor (Graphics::RGBA color)
 Sets the color to the given value, avoid, black and white as console can have its background color reversed. More...
 
void SetItalic (bool italic=true)
 Enable/disable italic. Not all consoles support italic. More...
 
void SetNegative (bool negative=true)
 Background/foreground is switched. More...
 
void SetUnderline (bool underline=true)
 Enable/disable underline. Not all consoles support underline. More...
 
void ShowCaret ()
 Shows input cursor. More...
 

Detailed Description

Console manipulation functions. Not thread safe. Current only std::cout is supported.

Member Enumeration Documentation

◆ Color

enum Color

The colors that can be used for console coloring. This is a safe list.

Enumerator
Default 
Black 
White 
Red 
Cyan 
Blue 
Yellow 
Magenta 
Green 

◆ ColorSupportLevel

Level of support for color.

Enumerator
None 

Color is not supported.

Safelist 

Only colors in the safelist can be used.

RGB 

Graphics::RGBA can be used for color.

Constructor & Destructor Documentation

◆ Console() [1/3]

Console ( )
default

Empty console, nothing can be done with it.

◆ Console() [2/3]

Console ( ConsoleBackend &  backend)

Creates a new console with the specified backend.

◆ Console() [3/3]

Console ( const Console other)

Console objects can be copied. They are reference counted.

◆ ~Console()

~Console ( )

Member Function Documentation

◆ ClearScreen()

void ClearScreen ( )

Clears the console screen.

◆ ColorSupport()

ColorSupportLevel ColorSupport ( ) const

Returns if color is supported in this terminal.

◆ GetHeight()

int GetHeight ( ) const

Returns the size of the console window in cols/rows.

◆ GetSize()

Geometry::Size GetSize ( ) const

Returns the size of the console window in cols/rows.

◆ GetWidth()

int GetWidth ( ) const

Returns the size of the console window in cols/rows.

◆ GotoXY() [1/2]

void GotoXY ( Geometry::Point  location)

Changes the position of the caret to the given position.

◆ GotoXY() [2/2]

void GotoXY ( int  x,
int  y 
)

Changes the position of the caret to the given position.

References Console::GotoXY().

◆ HideCaret()

void HideCaret ( )

Hides input cursor.

◆ IsColorSupported()

bool IsColorSupported ( ) const

Returns if the color is supported by this console.

References Console::ColorSupport(), and Console::None.

◆ IsReady()

bool IsReady ( ) const

Returns if the console is usable.

◆ IsStylesSupported()

bool IsStylesSupported ( ) const

Returns if color is supported in this terminal. Even if this is false, bold can be emulated.

◆ operator bool()

operator bool ( ) const
explicit

Returns if the console is usable.

References Console::IsReady().

◆ operator=()

Console& operator= ( const Console other)

Console objects can be copied. They are reference counted.

◆ OutStream()

std::ostream& OutStream ( ) const

◆ Reset()

void Reset ( )

Resets terminal attributes.

◆ SetBackground() [1/2]

void SetBackground ( Color  color)

Sets the background color to the given value. Use Default to set it to default color.

◆ SetBackground() [2/2]

void SetBackground ( Graphics::RGBA  color)

Sets the background color to the given value. Use Default to set it to default color.

◆ SetBold()

void SetBold ( bool  bold = true)

Sets terminal font to bold or normal.

◆ SetColor() [1/2]

void SetColor ( Color  color)

Sets the color to the given value, avoid, black and white as console can have its background color reversed.

Use Default to set it to default color.

◆ SetColor() [2/2]

void SetColor ( Graphics::RGBA  color)

Sets the color to the given value, avoid, black and white as console can have its background color reversed.

Use Default to set it to default color.

◆ SetItalic()

void SetItalic ( bool  italic = true)

Enable/disable italic. Not all consoles support italic.

◆ SetNegative()

void SetNegative ( bool  negative = true)

Background/foreground is switched.

◆ SetUnderline()

void SetUnderline ( bool  underline = true)

Enable/disable underline. Not all consoles support underline.

◆ ShowCaret()

void ShowCaret ( )

Shows input cursor.


The documentation for this class was generated from the following file: