2019-11-14 13:12:48 +01:00
|
|
|
//#include "add.h"
|
2019-10-15 16:12:56 +02:00
|
|
|
#include "Bitmap.h"
|
2019-11-19 13:27:18 +01:00
|
|
|
#include "Font.h"
|
2019-11-14 13:12:48 +01:00
|
|
|
|
|
|
|
#include <iostream>
|
2019-10-15 14:00:06 +02:00
|
|
|
|
2019-11-19 13:27:18 +01:00
|
|
|
bool isQuit(std::string command);
|
|
|
|
|
2019-10-16 15:44:13 +02:00
|
|
|
/**
|
2019-10-15 16:12:56 +02:00
|
|
|
* @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.
|
|
|
|
*/
|
2019-11-19 13:27:18 +01:00
|
|
|
|
|
|
|
#include "TextRenderer.h"
|
|
|
|
|
2019-10-15 14:00:06 +02:00
|
|
|
int main() {
|
2019-11-19 13:27:18 +01:00
|
|
|
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);
|
2019-10-15 16:12:56 +02:00
|
|
|
}
|
2019-11-19 13:27:18 +01:00
|
|
|
std::cout << "TextRender: " << std::endl;
|
|
|
|
std::getline(std::cin, command);
|
2019-10-15 16:12:56 +02:00
|
|
|
}
|
|
|
|
|
2019-11-19 13:27:18 +01:00
|
|
|
std::cout << "TextRender finished." << std::endl;
|
|
|
|
|
2019-10-15 14:00:06 +02:00
|
|
|
return 0;
|
2019-11-14 13:12:48 +01:00
|
|
|
}
|
2019-11-19 13:27:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
}
|