156 |
QuadGlyph() {} |
QuadGlyph() {} |
157 |
QuadGlyph(Glyph glyph, Rect &rect) : glyph(glyph), rect(rect) { } |
QuadGlyph(Glyph glyph, Rect &rect) : glyph(glyph), rect(rect) { } |
158 |
bool valid() { return rect.tex.isGood() ; } |
bool valid() { return rect.tex.isGood() ; } |
159 |
template<class Vertex> void draw(int &cx, int &cy, Vertex &vertex) { |
template<class Vertex> void draw(float &cx, float &cy, Vertex &vertex) { |
160 |
if(glyph.extents.width != 0) { |
if(glyph.extents.width != 0) { |
161 |
int cx1 = cx + glyph.extents.left; |
float cx1 = cx + glyph.extents.left; |
162 |
int cy1 = cy + glyph.extents.top; |
float cy1 = cy + glyph.extents.top; |
163 |
int cx2 = cx1 + glyph.extents.width; |
float cx2 = cx1 + glyph.extents.width; |
164 |
int cy2 = cy1 + glyph.extents.height; |
float cy2 = cy1 + glyph.extents.height; |
165 |
rect.texcoord(0, 0); |
rect.texcoord(0, 0); |
166 |
vertex(cx1, cy1); |
vertex(cx1, cy1); |
167 |
rect.texcoord(0, 1); |
rect.texcoord(0, 1); |
247 |
/** Render a single character. |
/** Render a single character. |
248 |
* @return New x position. |
* @return New x position. |
249 |
*/ |
*/ |
250 |
template<class Vertex> int renderChar(Char c, int x, int y, Vertex &vertex) |
template<class Vertex> float renderChar(Char c, float x, float y, Vertex &vertex) |
251 |
{ // returns new x pos |
{ // returns new x pos |
252 |
QuadGlyph &glyph = g[(unsigned)c]; |
QuadGlyph &glyph = g[(unsigned)c]; |
253 |
if(!glyph.valid()) return x; |
if(!glyph.valid()) return x; |
273 |
* all vertex commands are routed through the Vertex object. |
* all vertex commands are routed through the Vertex object. |
274 |
*/ |
*/ |
275 |
template<class Iterator, class RandomRenderer, class Vertex> |
template<class Iterator, class RandomRenderer, class Vertex> |
276 |
int renderIter( |
float renderIter( |
277 |
RandomRenderer &r, |
RandomRenderer &r, |
278 |
Iterator begin, Iterator end, |
Iterator begin, Iterator end, |
279 |
int x, int y, |
float x, float y, |
280 |
Vertex &vertex) { |
Vertex &vertex) { |
281 |
r.startRendering(); |
r.startRendering(); |
282 |
while(begin != end) { |
while(begin != end) { |