diff --git a/main/main.cpp b/main/main.cpp index b175a60..ae266d4 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -58,9 +58,9 @@ void renderText(TextRenderer *textRenderer) { } TextRenderer generateTextRender() { - std::string command; - std::cout << "fontSize: "; - std::getline(std::cin, command); +// std::string command; +// std::cout << "fontSize: "; +// std::getline(std::cin, command); int windowWidth = vkvm::getWidth(); int windowHeight = vkvm::getHeight(); diff --git a/src/TextRenderer.cpp b/src/TextRenderer.cpp index d2fd844..6acf67f 100644 --- a/src/TextRenderer.cpp +++ b/src/TextRenderer.cpp @@ -58,7 +58,7 @@ void TextRenderer::update(std::string newText) { // std::cout << fontNumbersInOneLine << "..." << std::endl; if(newText.size() < oldTextsize) { - clear(currentX, currentY, fontWidth, currentY + fontHeight); + clear(specialCharacterCurrentX, specialCharacterCurrentY, specialCharacterCurrentX + fontWidth + 1, specialCharacterCurrentX + fontHeight + 1); } newText = adjustText(newText); @@ -89,11 +89,15 @@ void TextRenderer::update(std::string newText) { blinkY = specialCharacterCurrentY; _specialCharacter = newText[i - 1]; - characterBitmap = getCharacter(_specialCharacter, font); - translateToSharedMemory(characterBitmap, specialCharacterCurrentX, specialCharacterCurrentY, speicialFontColor); + if(_specialCharacter != '\n') { + characterBitmap = getCharacter(_specialCharacter, font); + translateToSharedMemory(characterBitmap, specialCharacterCurrentX, specialCharacterCurrentY, speicialFontColor); + } - clear(tempBlinkX, tempBlinkY, tempBlinkX + 1, tempBlinkY + fontHeight); - translateToSharedMemory(getCharacter(tempSpecialChar), tempSpecialCharacterCurrentX, tempSpecialCharacterCurrentY, fontColor); + if(specialCharacterCurrentX != tempSpecialCharacterCurrentX && specialCharacterCurrentY != tempSpecialCharacterCurrentY) { + clear(tempBlinkX, tempBlinkY, tempBlinkX + 1, tempBlinkY + fontHeight); + translateToSharedMemory(getCharacter(tempSpecialChar, font), tempSpecialCharacterCurrentX, tempSpecialCharacterCurrentY, fontColor); + } } else { currentLine = ((i + space) / fontNumbersInOneLine);