#include "fb/chfb.h" #include #include "math/vector.h" #include "o3d/vertex_data.h" using namespace engine::fb; CharacterFrameBuffer::CharacterFrameBuffer(unsigned int w, unsigned int h) { resize(w, h); } void CharacterFrameBuffer::resize(unsigned int w, unsigned int h) { this->w = w; this->h = h; chars_vector.resize(w * h); clear(); } unsigned int CharacterFrameBuffer::width() const { return w; } unsigned int CharacterFrameBuffer::height() const { return h; } const char* CharacterFrameBuffer::chars() const { return chars_vector.data(); } void CharacterFrameBuffer::clear() { std::fill(chars_vector.begin(), chars_vector.end(), ' '); } void CharacterFrameBuffer::draw_point(int x, int y, engine::math::Vector3 loc, const engine::o3d::VertexData& vd) { (void) loc; (void) vd; chars_vector[x + y * w] = face_char(0); } char CharacterFrameBuffer::face_char(int face_ind) const { int n = 1 + face_ind / 2; return (n < 10 ? '0' : 'A' - 10) + n; }