From 2e81a8b4199688360623c0ec41b51372ef7715c2 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 25 Apr 2025 18:03:20 +0200 Subject: [PATCH] window tests --- device/serialstream.cc | 18 +++++++++--------- main.cc | 44 +++++++++++++++++++++++++++----------------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/device/serialstream.cc b/device/serialstream.cc index bb029f1..03dd558 100644 --- a/device/serialstream.cc +++ b/device/serialstream.cc @@ -78,15 +78,15 @@ void SerialStream::reset() { } void SerialStream::setPos(int x, int y) { - //char out[] = {0x1b, '[', 0, 0, ';', 0, 0, 'H', 0}; - *this << 0x1b; - *this << '['; - *this << dec << x; - *this << ';' << y << 'H' << endl; - flush(); - //itoa(x, &out[2], 10); - //itoa(y, &out[5], 10); - //print( out , strlen(out)); + char out[] = {0x1b, '[', 0, 0, ';', 0, 0, 'H', 0}; + //*this << 0x1b; + //*this << '['; + //*this << dec << x; + //*this << ';' << y << 'H' << endl; + //flush(); + itoa(x, &out[2], 10); + itoa(y, &out[5], 10); + print( out , strlen(out)); } void SerialStream::print(char* str, int length) { diff --git a/main.cc b/main.cc index a6c23e7..eddd388 100644 --- a/main.cc +++ b/main.cc @@ -14,29 +14,39 @@ extern "C" int main() { DBG_VERBOSE << "Number of CPUs: " << numCPUs << endl; ////test cga implemantation - //CGA::setCursor(1, 2); - //unsigned x,y; - //CGA::getCursor(x, y); - //CGA::setCursor(x+1, y+1); - //for(uint8_t i = 0; i < 10; i++) - // CGA::show(i, i, i+0x30, CGA::Attribute()); + // CGA::setCursor(1, 2); + // unsigned x,y; + // CGA::getCursor(x, y); + // CGA::setCursor(x+1, y+1); + // for(uint8_t i = 0; i < 10; i++) + // CGA::show(i, i, i+0x30, CGA::Attribute()); ////test textwindow implemantation //TextWindow tw_global = TextWindow(0, 80, 0, 25, true); //tw_global.reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, CGA::BLUE, false)); - //TextWindow tw = TextWindow(0, 10, 0, 10, true); - //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); + + + + TextWindow kout = TextWindow(0, 80, 0, 12, true); + kout.reset(); + kout.setPos(0,0); + kout.print("Corem ipsum dolor sit amit", 26); + kout.setPos(0,-1); + kout.print("test", 4, CGA::Attribute(CGA::BLACK, CGA::BLUE)); + int x,y; + kout.getPos(x,y); + kout.setPos(x+1,y); + kout.reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, CGA::BLUE, false)); + + + TextWindow dout0 = TextWindow(0,20,13,10, false); + dout0.reset(); + dout0.reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, CGA::BLUE, false)); + ////test Serial - //Serial s = Serial(); - //s.write('a'); + Serial s = Serial(); + s.write('a'); // test SerialStream SerialStream ss = SerialStream();