all todos for textwindow should be done

main
Eggert Jung 6 months ago
parent 2d9d72e162
commit f03e33928b

@ -20,9 +20,15 @@ void TextWindow::setPos(unsigned rel_x, unsigned rel_y) {
}
void TextWindow::getPos(unsigned& rel_x, unsigned& rel_y) const {
if(use_cursor){
CGA::getCursor(rel_x, rel_y);
rel_x -= from_col;
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) {
@ -35,8 +41,10 @@ void TextWindow::setPos(int rel_x, int rel_y) {
}
void TextWindow::getPos(int& rel_x, int& rel_y) const {
(void)rel_x;
(void)rel_y;
unsigned x, y;
getPos(x,y);
rel_x = x;
rel_y = y;
}
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
* store the current position
*
* \todo(11) Implement constructor
*/
TextWindow(unsigned from_col, unsigned to_col, unsigned from_row,
unsigned to_row, bool use_cursor = false);
@ -71,8 +70,6 @@ class TextWindow {
*
* \param rel_x Column 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);
@ -87,8 +84,6 @@ class TextWindow {
* Negative coordinates are interpreted relative to the right and bottom
* 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);
@ -100,8 +95,6 @@ class TextWindow {
*
* \param rel_x Column 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;
@ -128,7 +121,6 @@ class TextWindow {
* \param string Text to be printed
* \param length Length of text
* \param attrib Attribute for text
* \todo(11) Implement Method
*/
void print(const char* string, size_t length,
CGA::Attribute attrib = CGA::Attribute()); // NOLINT
@ -137,7 +129,6 @@ class TextWindow {
*
* \param character Fill character
* \param attrib Attribute for fill character
* \todo(11) Implement Method
*/
void reset(char character = ' ', CGA::Attribute attrib = CGA::Attribute());
};

@ -27,6 +27,11 @@ extern "C" int main() {
tw.reset();
tw.setPos(0,0);
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
* To avoid unexpected behaviour, make sure that interrupts are not

Loading…
Cancel
Save