Logic Fehler changed.

This commit is contained in:
my 2019-12-18 17:29:36 +01:00
parent 43f042ebdf
commit 00127d17f9
3 changed files with 11 additions and 4 deletions

View File

@ -69,8 +69,9 @@ TextRenderer generateTextRender() {
vkvm::Color speicialFontColor = vkvm::Color(100, 100, 100); vkvm::Color speicialFontColor = vkvm::Color(100, 100, 100);
// vkvm::FontType fontType = vkvm::getFont(); // vkvm::FontType fontType = vkvm::getFont();
int fontSize = std::stoi(command); // int fontSize = std::stoi(command);
int fontSize = 2;
// int font_id = fontType.getId(); // int font_id = fontType.getId();
std::string fontResourcePath = "../res/font" + std::to_string(3) + ".bmp"; std::string fontResourcePath = "../res/font" + std::to_string(3) + ".bmp";
std::string fontConfigureFilePath = "../res/font" + std::to_string(3) + ".toml"; std::string fontConfigureFilePath = "../res/font" + std::to_string(3) + ".toml";
@ -92,7 +93,7 @@ void test1() {
while(command.compare("quit") != 0) { while(command.compare("quit") != 0) {
if(command.compare("RenderText") == 0) { if(command.compare("RenderText") == 0) {
vkvm::callEvent(vkvm::EventType::RenderText); 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) { else if(command.compare("Redraw") == 0) {

View File

@ -55,6 +55,8 @@ void TextRenderer::update(std::string newText) {
int fontNumbersInOneLine = windowWidth / (fontWidth + left_margin); int fontNumbersInOneLine = windowWidth / (fontWidth + left_margin);
std::vector<std::vector<bool>> characterBitmap; std::vector<std::vector<bool>> characterBitmap;
// std::cout << fontNumbersInOneLine << "..." << std::endl;
if(newText.size() < oldTextsize) { if(newText.size() < oldTextsize) {
clear(currentX, currentY, fontWidth, currentY + fontHeight); clear(currentX, currentY, fontWidth, currentY + fontHeight);
} }
@ -76,10 +78,15 @@ void TextRenderer::update(std::string newText) {
// blink.setCurrentX(currentX + fontWidth); // blink.setCurrentX(currentX + fontWidth);
// blink.setCurrentY(currentY); // blink.setCurrentY(currentY);
int tempBlinkX = blinkX;
int tempBlinkY = blinkY;
blinkX = currentX + fontWidth; blinkX = currentX + fontWidth;
blinkY = currentY; 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); translateToSharedMemory(characterBitmap, currentX, currentY, speicialFontColor);
} else { } else {

View File

@ -87,7 +87,6 @@ private:
// void setPixelRange(int startX, int startY, int endX, int endY, int type); // void setPixelRange(int startX, int startY, int endX, int endY, int type);
std::string adjustText(std::string newText); std::string adjustText(std::string newText);
std::string adjustText(std::string newText, int startLine, int endLine); std::string adjustText(std::string newText, int startLine, int endLine);
}; };