Study Dungeon  1.0.0
A group project for COSC345
Public Member Functions
ConsoleUI::ConsoleWindow Class Reference

Object repesenting the Console window. More...

#include <menu.h>

Public Member Functions

 ConsoleWindow ()
 Construct a new Console Window object.
 
virtual ~ConsoleWindow ()=default
 Destroy the Console Window object.
 
void updateSize ()
 Update the size of the console window.
 
void drawBorder ()
 Draws a border around the console.
 
void drawBox (int x, int y, size_t width, size_t height)
 Draws a box. More...
 
void drawHorizontalLine (int x, int y, size_t length, char ch='-')
 Draws a horizontal line using specified character. More...
 
void drawVerticalLine (int x, int y, size_t length, char ch='|')
 Draws a vertical line using specified character. More...
 
void drawCharacter (int x, int y, char ch)
 Puts a character on the screen at a position. More...
 
void drawText (const std::string &text, int x, int y)
 Puts a string of text on the srceen starting at a position. More...
 
void drawCenteredText (const std::string &text, int y)
 Put a string of text centered horizontally on the screen. More...
 
std::string getLine (int x, int y, size_t maxLength=0)
 Create a blank text input field to recieve and display user input. More...
 
void clear ()
 Clear everything on the screen.
 
COORD getSize () const
 Get the Size of the console window. More...
 
void checkWindowResize (UIManager &uiManager)
 Check to see if the console window has been resized. More...
 
void setDefaultSize (short width, short height)
 Set the default size of the console window. More...
 
void setConsoleWindowSize (short width, short height)
 Set the size of the console window. More...
 
void addTextToBox (const std::string &text)
 The text to be added to a text box. More...
 
void drawTextBox (int x, int y, size_t width, size_t height)
 Draws a text box of specified dimensions. More...
 
void addAsciiArt (const AsciiArt &art)
 
void drawAsciiArt (const std::string &name, int x=-1, int y=-1)
 
AsciiArtgetAsciiArtByName (const std::string &name)
 Get and ASCII art object by name. More...
 
void addANSIArt (const ANSIArt &art)
 Add an ansi art object to the consolewindow object. More...
 
void drawANSIArt (const std::string &name, int x, int y)
 Draws the ansi art object at a location. More...
 
ANSIArtgetANSIArtByName (const std::string &name)
 Get an ANSI artwork by name. More...
 
void drawANSICode (int code, int x, int y)
 Draws a 256bit colour on the screen at a position. More...
 
void drawWrappedText (const std::string &text, int x, int y, size_t width)
 Draws text on the screen wrapping the string to the next line if it reaches the width. More...
 

Detailed Description

Object repesenting the Console window.

Member Function Documentation

◆ addANSIArt()

void ConsoleUI::ConsoleWindow::addANSIArt ( const ANSIArt art)

Add an ansi art object to the consolewindow object.

Parameters
artthe ansi art oject to add

◆ addAsciiArt()

void ConsoleUI::ConsoleWindow::addAsciiArt ( const AsciiArt art)
Parameters
art

◆ addTextToBox()

void ConsoleUI::ConsoleWindow::addTextToBox ( const std::string &  text)

The text to be added to a text box.

Parameters
text

◆ checkWindowResize()

void ConsoleUI::ConsoleWindow::checkWindowResize ( UIManager uiManager)

Check to see if the console window has been resized.

Parameters
uiManager

◆ drawANSIArt()

void ConsoleUI::ConsoleWindow::drawANSIArt ( const std::string &  name,
int  x,
int  y 
)

Draws the ansi art object at a location.

Parameters
namename of the artwork to draw
xleft most position
ytop most position

◆ drawANSICode()

void ConsoleUI::ConsoleWindow::drawANSICode ( int  code,
int  x,
int  y 
)

Draws a 256bit colour on the screen at a position.

Parameters
code256bit colour code
xleft most position
ytop most position

◆ drawAsciiArt()

void ConsoleUI::ConsoleWindow::drawAsciiArt ( const std::string &  name,
int  x = -1,
int  y = -1 
)
Parameters
name
x
y

◆ drawBox()

void ConsoleUI::ConsoleWindow::drawBox ( int  x,
int  y,
size_t  width,
size_t  height 
)

Draws a box.

Parameters
xleft most position
ytop most position
widthwidth of the box
heightheight of the box

◆ drawCenteredText()

void ConsoleUI::ConsoleWindow::drawCenteredText ( const std::string &  text,
int  y 
)

Put a string of text centered horizontally on the screen.

Parameters
textstring of text to be displayed
ytop most position

◆ drawCharacter()

void ConsoleUI::ConsoleWindow::drawCharacter ( int  x,
int  y,
char  ch 
)

Puts a character on the screen at a position.

Parameters
xleft most position
ytop most position
chcharacter to draw

◆ drawHorizontalLine()

void ConsoleUI::ConsoleWindow::drawHorizontalLine ( int  x,
int  y,
size_t  length,
char  ch = '-' 
)

Draws a horizontal line using specified character.

Parameters
xleft most position
ytop most position
lengthlength of the line
chcharacter to use to make the line

◆ drawText()

void ConsoleUI::ConsoleWindow::drawText ( const std::string &  text,
int  x,
int  y 
)

Puts a string of text on the srceen starting at a position.

Parameters
textthe string to be displayed
xleft most position
ytop most position

◆ drawTextBox()

void ConsoleUI::ConsoleWindow::drawTextBox ( int  x,
int  y,
size_t  width,
size_t  height 
)

Draws a text box of specified dimensions.

Parameters
xleft most position
ytop most position
widthwidth of the box
heightheight of the box

◆ drawVerticalLine()

void ConsoleUI::ConsoleWindow::drawVerticalLine ( int  x,
int  y,
size_t  length,
char  ch = '|' 
)

Draws a vertical line using specified character.

Parameters
xleft most position
ytop most position
lengthlength of the line
chcharacter to use to make th line

◆ drawWrappedText()

void ConsoleUI::ConsoleWindow::drawWrappedText ( const std::string &  text,
int  x,
int  y,
size_t  width 
)

Draws text on the screen wrapping the string to the next line if it reaches the width.

Parameters
textstring of text to display
xleft most position
ytop most position
widthmaximum width of the text

◆ getANSIArtByName()

ANSIArt * ConsoleUI::ConsoleWindow::getANSIArtByName ( const std::string &  name)

Get an ANSI artwork by name.

Parameters
namename of the artwork
Returns
ANSIArt*

◆ getAsciiArtByName()

AsciiArt * ConsoleUI::ConsoleWindow::getAsciiArtByName ( const std::string &  name)

Get and ASCII art object by name.

Parameters
name
Returns
AsciiArt*

◆ getLine()

std::string ConsoleUI::ConsoleWindow::getLine ( int  x,
int  y,
size_t  maxLength = 0 
)

Create a blank text input field to recieve and display user input.

Parameters
xleft most positition
ytop most position
maxLengthmaximum length of the input field
Returns
std::string

◆ getSize()

COORD ConsoleUI::ConsoleWindow::getSize ( ) const

Get the Size of the console window.

Returns
COORD

◆ setConsoleWindowSize()

void ConsoleUI::ConsoleWindow::setConsoleWindowSize ( short  width,
short  height 
)

Set the size of the console window.

Parameters
widthconsole window width
heightconsole window height

◆ setDefaultSize()

void ConsoleUI::ConsoleWindow::setDefaultSize ( short  width,
short  height 
)

Set the default size of the console window.

Parameters
widthconsole window width
heightconsole window height

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