50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
//
|
|
// Created by my on 2019/11/16.
|
|
//
|
|
|
|
#ifndef TEXTRENDERER_TEXTRENDERER_H
|
|
#define TEXTRENDERER_TEXTRENDERER_H
|
|
|
|
#define BOLD 0b001
|
|
#define ITALICS 0b010
|
|
#define UNDERLINE 0b100
|
|
|
|
#include <string>
|
|
#include <Color.hpp>
|
|
#include <vkvm.hpp>
|
|
#include <iostream>
|
|
#include "Font.h"
|
|
|
|
/**
|
|
* @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(vkvm::Color defaultBackgroundColor, vkvm::Color fontColor, Font font);
|
|
|
|
void update(std::string text);
|
|
void setOldText(std::string text);
|
|
bool** getCharacter(unsigned char character, Font font);
|
|
|
|
private:
|
|
std::string oldText;
|
|
vkvm::Color backgroundColor;
|
|
vkvm::Color fontColor;
|
|
vkvm::FontType fontType = vkvm::getFont();
|
|
Font font;
|
|
int type;
|
|
int windowWidth;
|
|
int fontWidth;
|
|
int fontHeight;
|
|
bool isBold();
|
|
bool isItalics();
|
|
bool isUnderline();
|
|
void fontProcessing(bool **characterBitmap);
|
|
void translateToSharedMemory(bool **characterBitmap, int startX, int startY);
|
|
};
|
|
|
|
|
|
#endif //TEXTRENDERER_TEXTRENDERER_H
|