class hiro::draw::TextPrinter

Overview

Helper class for easier state printing to the top left corner of the viewport. More…

#include <TextRenderer.h>

class TextPrinter {
public:
    // construction

    TextPrinter(hiro::draw::TextRenderer* t_renderer);

    // methods

    void PrintStr(const std::string& text);
    void PrintBool(const std::string& text, bool state);

    template <typename T>
    void PrintValue(const std::string& text, T value);
};

Detailed Documentation

Helper class for easier state printing to the top left corner of the viewport.

Outputs text records line by line, for every print call. Use this class by wrapping hiro::draw::TextRenderer in your code, before printing:

hiro::draw::StatePrinter printer(text_renderer);
printer.PrintStr("Hello World!");

Methods

void PrintStr(const std::string& text)

Print custom text line.

void PrintBool(const std::string& text, bool state)

Print text and boolean value. Text color changes according to the boolean state.

template <typename T>
void PrintValue(const std::string& text, T value)

Print text and value. Type of value parameter must be supported by any of the std::to_string overloads.