|
nsnake
Classic snake game for the terminal
|
A segment of the terminal screen (2D char matrix). More...
#include <Window.hpp>
Public Types | |
| enum | BorderType { BORDER_NONE, BORDER_REGULAR, BORDER_FANCY } |
| enum | WindowTitlePosition { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT } |
Public Member Functions | |
| Window (int x, int y, int w, int h) | |
| Window (Window *parent, int x, int y, int width, int height) | |
| virtual void | resize (int w, int h) |
| bool | isValid () |
| void | print (std::string str, int x, int y, ColorPair pair=0) |
| Shows text #str at #x #y on the window with color #pair. More... | |
| void | print (std::vector< std::string > lines, int x, int y, ColorPair pair=0) |
| Shows multiple text lines #lines at #x #y on the window with color #pair. More... | |
| void | printChar (int c, int x, int y, ColorPair pair=0) |
| Shows #c at #x #y with color #pair. More... | |
| void | setBackground (chtype ch, ColorPair pair) |
| void | refresh () |
| void | clear () |
| int | getW () const |
| int | getH () const |
| int | getX () const |
| int | getY () const |
| void | borders (BorderType type) |
| void | horizontalLine (int x, int y, int c, int width, ColorPair pair) |
| void | setTitle (std::string title, WindowTitlePosition position=Window::TOP_LEFT) |
| Sets a text that will appear at the top of the Window. More... | |
Public Attributes | |
| WINDOW * | win |
| Ncurses' internal data structure. More... | |
Protected Attributes | |
| bool | error |
| Tells if we've got some initialization error. | |
| int | x |
| int | y |
| int | width |
| int | height |
| BorderType | borderType |
| std::string | topLeftTitle |
| std::string | topRightTitle |
| std::string | bottomLeftTitle |
| std::string | bottomRightTitle |
A segment of the terminal screen (2D char matrix).
Definition at line 16 of file Window.hpp.
| void Window::print | ( | std::string | str, |
| int | x, | ||
| int | y, | ||
| ColorPair | pair = 0 |
||
| ) |
Shows text #str at #x #y on the window with color #pair.
Definition at line 94 of file Window.cpp.
| void Window::print | ( | std::vector< std::string > | lines, |
| int | x, | ||
| int | y, | ||
| ColorPair | pair = 0 |
||
| ) |
Shows multiple text lines #lines at #x #y on the window with color #pair.
Utils::String::split: window.print(Utils::String::split("multiple\nlines", '\n'),
x, y, color_pair); Definition at line 100 of file Window.cpp.
| void Window::printChar | ( | int | c, |
| int | x, | ||
| int | y, | ||
| ColorPair | pair = 0 |
||
| ) |
Shows #c at #x #y with color #pair.
Definition at line 105 of file Window.cpp.
| void Window::setTitle | ( | std::string | title, |
| WindowTitlePosition | position = Window::TOP_LEFT |
||
| ) |
Sets a text that will appear at the top of the Window.
By default it's shown on top of the borders, with a highlighted color tone.
Definition at line 214 of file Window.cpp.
| WINDOW* Window::win |
Ncurses' internal data structure.
IT'S PUBLIC BECAUSE SOMETIMES I NEED TO CALL DIRECT NCURSES CALLS - FIX THIS
Definition at line 85 of file Window.hpp.
1.8.14