Text-Renderer/main/main.cpp

37 lines
878 B
C++
Raw Normal View History

#include "Bitmap.h"
2019-10-22 15:34:51 +02:00
#include "Font.h"
2019-10-15 14:00:06 +02:00
2019-10-23 12:18:43 +02:00
#include <iostream>
/**
* @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-10-15 14:00:06 +02:00
int main() {
2019-11-19 13:28:48 +01:00
Font font("../res/profont-IIx.bmp","../res/profont-IIx.toml");
//Font font("../res/font2.bmp","../res/font2.toml");
2019-10-16 12:17:59 +02:00
std::string str;
std::cout << "string to draw: ";
2019-10-23 11:42:32 +02:00
std::getline(std::cin, str);
2019-10-22 15:34:51 +02:00
for (int i = 0; i < font.height(); i++) {
for (char c : str) {
2019-10-22 15:34:51 +02:00
for (int j = 0; j < font.width(); j++) {
2019-10-23 11:42:32 +02:00
if (font.getPixel(c,j,i)) {
std::cout << "";
} else {
2019-10-23 11:42:32 +02:00
std::cout << " ";
}
}
std::cout << " ";
}
std::cout << std::endl;
}
2019-10-15 14:00:06 +02:00
return 0;
2019-10-23 12:18:43 +02:00
}