Text-Renderer/main/main.cpp

70 lines
1.6 KiB
C++

//#include "add.h"
#include "Bitmap.h"
#include "Font.h"
#include <iostream>
bool isQuit(std::string command);
/**
* @author: Julian Hinxlage
* @since: v0.0.0
* @brief: An image is loaded and used as a font.
* A string is converted and displayed in the console.
* Currently only to test.
*/
#include "TextRenderer.h"
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));
std::string command;
std::cout << "TextRender: " << std::endl;
std::getline(std::cin, command);
while(!isQuit(command)) {
if(command.compare("update")) {
currentText = vkvm::getText();
textRenderer.update(currentText);
}
std::cout << "TextRender: " << std::endl;
std::getline(std::cin, command);
}
std::cout << "TextRender finished." << std::endl;
return 0;
}
// std::string str;
// std::cout << "string to draw: ";
// std::getline(std::cin, str);
//
// for (int i = 0; i < font.height(); i++) {
// for (char c : str) {
// for (int j = 0; j < font.width(); j++) {
// if (font.getPixel(c,j,i)) {
// std::cout << "█";
// } else {
// std::cout << " ";
// }
// }
// std::cout << " ";
// }
// std::cout << std::endl;
// }
//
// return 0;
bool isQuit(std::string command) {
return command.compare("quit") == 0;
}