all todos for textwindow should be done
This commit is contained in:
@@ -20,10 +20,16 @@ void TextWindow::setPos(unsigned rel_x, unsigned rel_y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TextWindow::getPos(unsigned& rel_x, unsigned& rel_y) const {
|
void TextWindow::getPos(unsigned& rel_x, unsigned& rel_y) const {
|
||||||
|
if(use_cursor){
|
||||||
CGA::getCursor(rel_x, rel_y);
|
CGA::getCursor(rel_x, rel_y);
|
||||||
rel_x -= from_col;
|
rel_x -= from_col;
|
||||||
rel_y -= from_row;
|
rel_y -= from_row;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
rel_x = pos_x - from_col;
|
||||||
|
rel_y = pos_y - from_row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TextWindow::setPos(int rel_x, int rel_y) {
|
void TextWindow::setPos(int rel_x, int rel_y) {
|
||||||
if(rel_x < 0)
|
if(rel_x < 0)
|
||||||
@@ -35,8 +41,10 @@ void TextWindow::setPos(int rel_x, int rel_y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TextWindow::getPos(int& rel_x, int& rel_y) const {
|
void TextWindow::getPos(int& rel_x, int& rel_y) const {
|
||||||
(void)rel_x;
|
unsigned x, y;
|
||||||
(void)rel_y;
|
getPos(x,y);
|
||||||
|
rel_x = x;
|
||||||
|
rel_y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextWindow::print(const char* str, size_t length, CGA::Attribute attrib) {
|
void TextWindow::print(const char* str, size_t length, CGA::Attribute attrib) {
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ class TextWindow {
|
|||||||
* software cursor/variable (`false`) should be used to
|
* software cursor/variable (`false`) should be used to
|
||||||
* store the current position
|
* store the current position
|
||||||
*
|
*
|
||||||
* \todo(11) Implement constructor
|
|
||||||
*/
|
*/
|
||||||
TextWindow(unsigned from_col, unsigned to_col, unsigned from_row,
|
TextWindow(unsigned from_col, unsigned to_col, unsigned from_row,
|
||||||
unsigned to_row, bool use_cursor = false);
|
unsigned to_row, bool use_cursor = false);
|
||||||
@@ -71,8 +70,6 @@ class TextWindow {
|
|||||||
*
|
*
|
||||||
* \param rel_x Column in window
|
* \param rel_x Column in window
|
||||||
* \param rel_y Row in window
|
* \param rel_y Row in window
|
||||||
* \todo(11) Implement method, use \ref CGA::setCursor() for the hardware
|
|
||||||
* cursor
|
|
||||||
*/
|
*/
|
||||||
void setPos(unsigned rel_x, unsigned rel_y);
|
void setPos(unsigned rel_x, unsigned rel_y);
|
||||||
|
|
||||||
@@ -87,8 +84,6 @@ class TextWindow {
|
|||||||
* Negative coordinates are interpreted relative to the right and bottom
|
* Negative coordinates are interpreted relative to the right and bottom
|
||||||
* border of the window.
|
* border of the window.
|
||||||
*
|
*
|
||||||
* \todo(11) Implement this method (it can either use or replace
|
|
||||||
* \ref setPos(unsigned, unsigned))
|
|
||||||
*/
|
*/
|
||||||
void setPos(int rel_x, int rel_y);
|
void setPos(int rel_x, int rel_y);
|
||||||
|
|
||||||
@@ -100,8 +95,6 @@ class TextWindow {
|
|||||||
*
|
*
|
||||||
* \param rel_x Column in window
|
* \param rel_x Column in window
|
||||||
* \param rel_y Row in window
|
* \param rel_y Row in window
|
||||||
* \todo(11) Implement Method, use \ref CGA::getCursor() for the hardware
|
|
||||||
* cursor
|
|
||||||
*/
|
*/
|
||||||
void getPos(unsigned& rel_x, unsigned& rel_y) const;
|
void getPos(unsigned& rel_x, unsigned& rel_y) const;
|
||||||
|
|
||||||
@@ -128,7 +121,6 @@ class TextWindow {
|
|||||||
* \param string Text to be printed
|
* \param string Text to be printed
|
||||||
* \param length Length of text
|
* \param length Length of text
|
||||||
* \param attrib Attribute for text
|
* \param attrib Attribute for text
|
||||||
* \todo(11) Implement Method
|
|
||||||
*/
|
*/
|
||||||
void print(const char* string, size_t length,
|
void print(const char* string, size_t length,
|
||||||
CGA::Attribute attrib = CGA::Attribute()); // NOLINT
|
CGA::Attribute attrib = CGA::Attribute()); // NOLINT
|
||||||
@@ -137,7 +129,6 @@ class TextWindow {
|
|||||||
*
|
*
|
||||||
* \param character Fill character
|
* \param character Fill character
|
||||||
* \param attrib Attribute for fill character
|
* \param attrib Attribute for fill character
|
||||||
* \todo(11) Implement Method
|
|
||||||
*/
|
*/
|
||||||
void reset(char character = ' ', CGA::Attribute attrib = CGA::Attribute());
|
void reset(char character = ' ', CGA::Attribute attrib = CGA::Attribute());
|
||||||
};
|
};
|
||||||
|
|||||||
5
main.cc
5
main.cc
@@ -27,6 +27,11 @@ extern "C" int main() {
|
|||||||
tw.reset();
|
tw.reset();
|
||||||
tw.setPos(0,0);
|
tw.setPos(0,0);
|
||||||
tw.print("lorem ipsum dolor sit amit", 26);
|
tw.print("lorem ipsum dolor sit amit", 26);
|
||||||
|
tw.setPos(0,-1);
|
||||||
|
tw.print("test", 4, CGA::Attribute(CGA::BLACK, CGA::BLUE));
|
||||||
|
int x,y;
|
||||||
|
tw.getPos(x,y);
|
||||||
|
tw.setPos(x+1,y);
|
||||||
|
|
||||||
/* Start application processors
|
/* Start application processors
|
||||||
* To avoid unexpected behaviour, make sure that interrupts are not
|
* To avoid unexpected behaviour, make sure that interrupts are not
|
||||||
|
|||||||
Reference in New Issue
Block a user