check cga pos bounds and debug print

This commit is contained in:
Eggert Jung
2025-05-13 15:35:47 +02:00
parent bddcebefae
commit ae3980cfa2
2 changed files with 23 additions and 4 deletions

View File

@@ -14,12 +14,23 @@ TextWindow::TextWindow(unsigned from_col, unsigned to_col, unsigned from_row,
setPos(0,0);
}
extern unsigned int testx, testy;
void TextWindow::setPos(unsigned rel_x, unsigned rel_y) {
unsigned abs_x = from_col + rel_x;
unsigned abs_y = from_row + rel_y;
if(abs_x >= CGA::COLUMNS)
return;
if(abs_y >= CGA::ROWS)
return;
if(use_cursor){
CGA::setCursor(from_col + rel_x, from_row + rel_y);
testx = abs_x;
testy = abs_y;
CGA::setCursor(abs_x, abs_y);
}else{
pos_x = from_col + rel_x;
pos_y = from_row + rel_y;
pos_x = abs_x;
pos_y = abs_y;
}
}