diff --git a/main/main.cpp b/main/main.cpp index 449f2ee..d27b25f 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -6,6 +6,7 @@ int cursorPosX = 0; int cursorPosY = 0; +bool showCursor = false; /** * @author: Julian Hinxlage @@ -14,24 +15,30 @@ int cursorPosY = 0; */ void threadHandler(Font &font){ - static bool showCurser{false}; + static bool cursorState{false}; - int start = font.height() / 4; - int end = font.height() * 3 / 4 + 1; + int start = 0; + int end = font.height(); auto bc = vkvm::getBackgroundColor(); auto fc = vkvm::getForegroundColor(); while(true){ - for (int i = start; i < end; i++) { - if (showCurser) { - vkvm::setPixel(cursorPosX, cursorPosY + i, bc); + if(showCursor) { + int x = cursorPosX - 1; + if (x < 0) { + x = 0; } - else { - vkvm::setPixel(cursorPosX, cursorPosY + i, fc); + + for (int i = start; i < end; i++) { + if (cursorState) { + vkvm::setPixel(x, cursorPosY + i, bc); + } else { + vkvm::setPixel(x, cursorPosY + i, fc); + } } + vkvm::callEvent(vkvm::EventType::Redraw); + cursorState = !cursorState; } - vkvm::callEvent(vkvm::EventType::Redraw); - showCurser = !showCurser; std::this_thread::sleep_for(std::chrono::milliseconds(800)); } } @@ -56,6 +63,7 @@ int main() { } } + showCursor = false; int x = 0; int y = 0; for(char c : currentText){ @@ -65,6 +73,7 @@ int main() { }else if(c == -127){ cursorPosX = x * font.width(); cursorPosY = y * font.height(); + showCursor = true; } else{ if(x == perRow){