From ab2d13f6bb3c43c6986244dc5ea3232964d6021a Mon Sep 17 00:00:00 2001 From: Shaohua Tong Date: Wed, 20 Nov 2019 12:50:32 +0100 Subject: [PATCH] add Bold and underline in TextRenderer --- main/main.cpp | 23 ++++++++++++++++++----- res/font3.bmp | Bin 458442 -> 0 bytes src/TextRenderer.cpp | 12 +++++------- src/TextRenderer.h | 4 ++-- 4 files changed, 25 insertions(+), 14 deletions(-) delete mode 100644 res/font3.bmp diff --git a/main/main.cpp b/main/main.cpp index 6accb89..e698eb3 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -19,18 +19,31 @@ bool isQuit(std::string command); int main() { vkvm::initialize(0); - Font font("../res/font1.bmp", "../res/font1.toml"); - - std::string oldText; std::string currentText; - TextRenderer textRenderer(vkvm::Color(255, 255, 255), vkvm::Color(0, 0, 0)); + + + /*************************set back to shared memory(only for test)********************************************/ + vkvm::Color fontColor1(0, 0, 0); + vkvm::Color backgroudColor1(255, 255, 255); + Font font1("../res/font3.bmp", "../res/font3.toml"); + vkvm::setFont(vkvm::FontType(3, "font", font1.height(), font1.width())); + vkvm::setForegroundColor(fontColor1); + vkvm::setBackgroundColor(backgroudColor1); + /**************************get text and font from shared memory*******************************************/ + std::string fontResourcePath = "../res/font" + std::to_string(vkvm::getFont().getId()) + ".bmp"; + std::string fontConfigureFilePath = "../res/font" + std::to_string(vkvm::getFont().getId()) + ".toml"; + Font font = Font(fontResourcePath, fontConfigureFilePath); + TextRenderer textRenderer(vkvm::Color(255, 255, 255), vkvm::Color(0, 0, 0). font); + vkvm::Color fontColor = vkvm::getForegroundColor(); + vkvm::Color backgroundColor = vkvm::getBackgroundColor(); + /*********************************************************************/ std::string command; - std::cout << "TextRender: " << std::endl; std::getline(std::cin, command); while(!isQuit(command)) { if(command.compare("update")) { + vkvm::setText("Hello World."); currentText = vkvm::getText(); textRenderer.update(currentText); } diff --git a/res/font3.bmp b/res/font3.bmp deleted file mode 100644 index 609d2668e6a8824d1b7a8ee7b1c01b249f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$9SLyuJ6w-#`T0tlrcJ@7+(^;6!O{WORG-A=eLLi zd`@O{N3fjl&?Wovk_Pw%T@vUJH{b?Z1MmNh_x_2`e9_zk#B=8r_uo4QAKQx8*l?|zzw*8)dp7o@(}rZuGQVFcLQ#~4Y&a};0D})8*l?|zzw(o zH{b@`fE#cFZomz=0XN_V+<+T!18%?#xB)ld2Hb!fa070@4Y&a};0D})8*l?|zzw(o WH{b@`fE#cFZomz=0XOh74g4RBoKZ&r diff --git a/src/TextRenderer.cpp b/src/TextRenderer.cpp index b3a90b1..ca0c4e0 100644 --- a/src/TextRenderer.cpp +++ b/src/TextRenderer.cpp @@ -3,14 +3,14 @@ // #include "TextRenderer.h" -TextRenderer::TextRenderer(vkvm::Color backgroundColor, vkvm::Color fontColor) - : backgroundColor(backgroundColor), fontColor(fontColor) { +TextRenderer::TextRenderer(vkvm::Color backgroundColor, vkvm::Color fontColor, Font font) + : backgroundColor(backgroundColor), fontColor(fontColor), font(font) { windowWidth = vkvm::getWidth(); fontWidth = font.width(); fontHeight = font.height(); } -void TextRenderer::update(std::string text) { +void TextRenderer::update(std::string newText) { int startX; int startY; int i; @@ -19,10 +19,6 @@ void TextRenderer::update(std::string text) { std::cout << "get window's width from shared memery: (" << windowWidth << ")" << std::endl; - std::string newText = vkvm::getText(); - - std::cout << "get text:" << newText << std::endl; - for(i = 0; i < newText.size(); i++) { if(i > oldText.size() || oldText[i] != newText[i]) { startX = i % fontNumbersInOneLine * fontWidth; @@ -32,6 +28,8 @@ void TextRenderer::update(std::string text) { translateToSharedMemory(characterBitmap, startX, startY); } } + + oldText = newText; } void TextRenderer::setOldText(std::string text) { diff --git a/src/TextRenderer.h b/src/TextRenderer.h index 8d3679b..65ced25 100644 --- a/src/TextRenderer.h +++ b/src/TextRenderer.h @@ -22,7 +22,7 @@ */ class TextRenderer { public: - TextRenderer(vkvm::Color defaultBackgroundColor, vkvm::Color fontColor); + TextRenderer(vkvm::Color defaultBackgroundColor, vkvm::Color fontColor, Font font); void update(std::string text); void setOldText(std::string text); @@ -33,7 +33,7 @@ private: vkvm::Color backgroundColor; vkvm::Color fontColor; vkvm::FontType fontType = vkvm::getFont(); - Font font = Font(fontType.getName(), "../res/font3.toml"); + Font font; int type; int windowWidth; int fontWidth;