// // Created by my on 2019/11/16. // #ifndef TEXTRENDERER_TEXTRENDERER_H #define TEXTRENDERER_TEXTRENDERER_H #include "Font.h" #include #include #include #include #include /** * @author: Yajie Qi, Shaohua Tong * @since: v0.0.0 * @brief: gets a string from the Shared Memory and converts the text into a bitmap-array. */ class TextRenderer { public: TextRenderer(); void update(std::string text); void updateParameters(); std::vector> getCharacter(unsigned char character); void setLeftMargin(int margin); void setBottomMargin(int margin); void clear(); void clear(int startX, int startY, int endX, int endY); private: int left_margin = 1; int bottom_margin = 1; Font font; void translateToSharedMemory(std::vector> characterBitmap, int startX, int startY, bool flipColors); vkvm::Color backgroundColor; vkvm::Color foregroundColor; int windowWidth; int windowHeight; char returnCharacter = '\n'; char specialCharacter = -127; int specialCharacterCurrentX; int specialCharacterCurrentY; char _specialCharacter; int fontSize = 1; int currentX; int currentY; int oldTextsize{}; int blinkX = 0; int blinkY = 0; std::string adjustText(std::string newText); std::string adjustText(std::string newText, int startLine, int endLine); }; #endif //TEXTRENDERER_TEXTRENDERER_H