diff --git a/main/main.cpp b/main/main.cpp index 025475e..b175a60 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -69,8 +69,9 @@ TextRenderer generateTextRender() { vkvm::Color speicialFontColor = vkvm::Color(100, 100, 100); // vkvm::FontType fontType = vkvm::getFont(); - int fontSize = std::stoi(command); +// int fontSize = std::stoi(command); + int fontSize = 2; // int font_id = fontType.getId(); std::string fontResourcePath = "../res/font" + std::to_string(3) + ".bmp"; std::string fontConfigureFilePath = "../res/font" + std::to_string(3) + ".toml"; @@ -92,7 +93,7 @@ void test1() { while(command.compare("quit") != 0) { if(command.compare("RenderText") == 0) { vkvm::callEvent(vkvm::EventType::RenderText); - outputWindow(vkvm::getHeight(), vkvm::getWidth(), vkvm::getForegroundColor()); +// outputWindow(vkvm::getHeight(), vkvm::getWidth(), vkvm::getForegroundColor()); } else if(command.compare("Redraw") == 0) { diff --git a/src/TextRenderer.cpp b/src/TextRenderer.cpp index 5ea0a9e..4334ef6 100644 --- a/src/TextRenderer.cpp +++ b/src/TextRenderer.cpp @@ -55,6 +55,8 @@ void TextRenderer::update(std::string newText) { int fontNumbersInOneLine = windowWidth / (fontWidth + left_margin); std::vector> characterBitmap; +// std::cout << fontNumbersInOneLine << "..." << std::endl; + if(newText.size() < oldTextsize) { clear(currentX, currentY, fontWidth, currentY + fontHeight); } @@ -76,10 +78,15 @@ void TextRenderer::update(std::string newText) { // blink.setCurrentX(currentX + fontWidth); // blink.setCurrentY(currentY); + int tempBlinkX = blinkX; + int tempBlinkY = blinkY; + blinkX = currentX + fontWidth; blinkY = currentY; - characterBitmap = getCharacter(newText[i], font); + clear(tempBlinkX, tempBlinkY, tempBlinkX + 1, tempBlinkY + fontHeight); + + characterBitmap = getCharacter(newText[i - 1], font); translateToSharedMemory(characterBitmap, currentX, currentY, speicialFontColor); } else { diff --git a/src/TextRenderer.h b/src/TextRenderer.h index c59d810..7c83796 100644 --- a/src/TextRenderer.h +++ b/src/TextRenderer.h @@ -87,7 +87,6 @@ private: // void setPixelRange(int startX, int startY, int endX, int endY, int type); std::string adjustText(std::string newText); - std::string adjustText(std::string newText, int startLine, int endLine); };