#pragma once
#include "texture.hpp"
#include "shader.hpp"
#include "buffer.hpp"
#include "font.hpp"
#include "ogl.hpp"
#include "common.hpp"
#include <stdarg.h>
#include <vector>
class TextRenderer {
private:
static const char* vert_glsl;
static const char* frag_glsl;
ArrayBuffer vbo;
Buffer ebo;
Font font;
Program* program;
Texture* texture;
static Program* get_prog();
public:
TextRenderer();
~TextRenderer();
unsigned max_height() const;
bool draw(const char*, unsigned, unsigned, const Window*, unsigned=1);
};
class Logger {
private:
static Logger* inst;
TextRenderer renderer;
static const size_t max_lines;
std::vector<char*> lines;
bool dirty;
Logger(): dirty(false), blocked(true) {}
public:
bool blocked;
static Logger* getInst() { return inst ?: (inst = new Logger()); }
~Logger();
static void log(const char*, ...);
bool logall(const Window*, bool);
};