+ update text on RenderText event

This commit is contained in:
Julian Hinxlage 2019-11-27 12:02:14 +01:00
parent d531266b27
commit 0102a74906

View File

@ -1,7 +1,7 @@
//#include "add.h"
#include "Bitmap.h"
#include "Font.h"
#include "TextRenderer.h"
#include "internal.hpp"
#include <iostream>
bool isQuit(std::string command);
@ -13,8 +13,6 @@ bool isQuit(std::string command);
* A string is converted and displayed in the console.
* Currently only to test.
*/
#include "TextRenderer.h"
void outPutPixel(int windowHeight, int windowWidth, vkvm::Color fontColor);
int main() {
@ -22,6 +20,7 @@ int main() {
std::string currentText;
/*************************set back to shared memory(only for test)********************************************/
int windowWidth = vkvm::getWidth();
int windowHeight = vkvm::getHeight();
@ -45,6 +44,14 @@ int main() {
textRenderer.setBottomMargin(1);
/*************************get Text and update back to shared meomory********************************************/
vkvm::registerEvent(vkvm::EventType::RenderText, [&textRenderer](){
std::string currentText = vkvm::getText();
textRenderer.update(currentText);
vkvm::callEvent(vkvm::EventType::Redraw);
});
std::string command;
std::cout << "TextRender: ";
std::getline(std::cin, command);
@ -61,6 +68,7 @@ int main() {
}
}
std::cout << "TextRender finished." << std::endl;
return 0;