9#ifndef MAXOS_CONSOLE_CONSOLE_H
10#define MAXOS_CONSOLE_CONSOLE_H
14#include <libcommon/outputStream.h>
15#include <libcommon/colour.h>
18namespace MaxOS::console {
30 virtual uint16_t
width();
43 virtual void put_character(uint16_t x, uint16_t y,
char c, common::ConsoleColour foreground, common::ConsoleColour background);
44 virtual void put_string(uint16_t x, uint16_t y,
string string, common::ConsoleColour foreground = common::ConsoleColour::LightGrey, common::ConsoleColour background = common::ConsoleColour::Black);
47 virtual void scroll_up(uint16_t left, uint16_t top, uint16_t
width, uint16_t
height, common::ConsoleColour foreground = common::ConsoleColour::LightGrey, common::ConsoleColour background = common::ConsoleColour::Black,
char fill =
' ');
50 virtual void clear(uint16_t left, uint16_t top, uint16_t
width, uint16_t
height, common::ConsoleColour foreground = common::ConsoleColour::LightGrey, common::ConsoleColour background = common::ConsoleColour::Black,
char fill =
' ');
70 ConsoleArea(
Console* console, uint16_t left, uint16_t top, uint16_t
width, uint16_t
height, common::ConsoleColour foreground, common::ConsoleColour background);
73 uint16_t
width()
override;
74 uint16_t
height()
override;
81 void scroll_up(uint16_t left, uint16_t top, uint16_t
width, uint16_t
height, common::ConsoleColour foreground = common::ConsoleColour::LightGrey, common::ConsoleColour background = common::ConsoleColour::Black,
char fill =
' ')
override;
96 common::ConsoleColour m_foreground { common::ConsoleColour::LightGrey };
97 common::ConsoleColour m_background { common::ConsoleColour::Black };
100 uint16_t m_cursor_x { 0 };
101 uint16_t m_cursor_y { 0 };
A console that is a subsection of another console, limited by a width and height.
char get_character(uint16_t x, uint16_t y) override
Return the character at the given coordinates if the coordinates are within the console area.
common::ConsoleColour get_foreground_color(uint16_t x, uint16_t y) override
Return the foreground color of the character at the given coordinates if the coordinates are within t...
void set_background_color(uint16_t x, uint16_t y, common::ConsoleColour background) override
Change the background color of a character on the console area if the coordinates are within the area...
uint16_t height() override
Return the height of the console area.
void scroll_up() override
Scroll the console area up by 1 line.
void put_character(uint16_t x, uint16_t y, char c) override
Place a character on the console area if the coordinates are within the area.
void set_foreground_color(uint16_t x, uint16_t y, common::ConsoleColour foreground) override
Change the foreground color of a character on the console area if the coordinates are within the area...
common::ConsoleColour get_background_color(uint16_t x, uint16_t y) override
Return the background color of the character at the given coordinates if the coordinates are within t...
uint16_t width() override
Return the width of the console area.
A stream that can be used to write to a console.
void write_char(char c) override
write a character to the console stream
void set_cursor(uint16_t x, uint16_t y)
Set the m_position of the cursor.
Abstract class for a console, allows for the printing of characters and strings with colours.
virtual void put_string(uint16_t x, uint16_t y, string string, common::ConsoleColour foreground=common::ConsoleColour::LightGrey, common::ConsoleColour background=common::ConsoleColour::Black)
Put a string on the console.
virtual void set_foreground_color(uint16_t x, uint16_t y, common::ConsoleColour foreground)
Set the foreground color of a character on the console.
virtual common::ConsoleColour get_background_color(uint16_t x, uint16_t y)
Get the background color of a character on the console.
virtual void scroll_up()
Scroll the entire console up by 1 line.
virtual char get_character(uint16_t x, uint16_t y)
Get the character at a given coordinate on the console.
virtual uint16_t height()
Get the height of the console in characters.
virtual void put_character(uint16_t x, uint16_t y, char c)
Put a character on the console.
virtual void invert_colors(uint16_t x, uint16_t y)
Invert the colors of a character on the console.
virtual uint16_t width()
Get the width of the console in characters.
virtual common::ConsoleColour get_foreground_color(uint16_t x, uint16_t y)
Get the background color of a character on the console.
virtual void set_background_color(uint16_t x, uint16_t y, common::ConsoleColour background)
Set the background color of a character on the console.