/* render/text.cc This file is part of the Osirion project and is distributed under the terms of the GNU General Public License version 2 */ #include "render/render.h" #include "GL/glut.h" namespace render { void draw_text(float x, float y, std::string text) { for (size_t i =0; i < text.size(); i++) { if (text[i] != ' ') { int row = (int) text[i] >> 4; int col = (int) text[i] & 15; float frow = row * 0.0625f; float fcol = col * 0.0625f; gl::begin(gl::Quads); glTexCoord2f(fcol, frow); gl::vertex(x,y,0); glTexCoord2f(fcol + 0.0625f, frow); gl::vertex(x+CHARSIZE,y,0); glTexCoord2f(fcol +0.0625f, frow + 0.0625f); gl::vertex(x+CHARSIZE,y+CHARSIZE,0); glTexCoord2f(fcol, frow+0.0625f); gl::vertex(x,y+CHARSIZE,0); gl::end(); } x += CHARSIZE; } } }