Skip to content

Commit

Permalink
Refactor|Fonts|Resources|Client: Continued revising bitmap font repre…
Browse files Browse the repository at this point in the history
…sentation
  • Loading branch information
danij-deng committed Nov 13, 2013
1 parent d95b821 commit 0d1e452
Show file tree
Hide file tree
Showing 11 changed files with 191 additions and 243 deletions.
8 changes: 6 additions & 2 deletions doomsday/client/include/gl/gl_draw.h
Expand Up @@ -25,6 +25,7 @@
#ifndef LIBDENG_GRAPHICS_DRAW_H
#define LIBDENG_GRAPHICS_DRAW_H

#include <de/Rectangle>
#include <de/Vector>
#include <de/rect.h>

Expand All @@ -34,10 +35,13 @@ extern "C" {

void GL_DrawLine(float x1, float y1, float x2, float y2, float r, float g, float b, float a);

void GL_DrawRect(RectRaw const *rect);
void GL_DrawRect(de::Rectanglei const &rect);
void GL_DrawRect2(int x, int y, int w, int h);

void GL_DrawRectWithCoords(RectRaw const *rect, de::Vector2i coords[4]);
/**
* @param coords [topLeft, topRight, bottomRight, bottomLeft]
*/
void GL_DrawRectWithCoords(de::Rectanglei const &rect, de::Vector2i const coords[4]);

void GL_DrawRectf(const RectRawf* rect);
void GL_DrawRectf2(double x, double y, double w, double h);
Expand Down
9 changes: 2 additions & 7 deletions doomsday/client/include/resource/abstractfont.h
Expand Up @@ -54,8 +54,6 @@ class AbstractFont
int _ascent;
int _descent;

de::Vector2ui _noCharSize;

/// Do fonts have margins? Is this a pixel border in the composited character
/// map texture (perhaps per-glyph)?
de::Vector2ui _margin;
Expand All @@ -79,11 +77,8 @@ class AbstractFont
virtual void glInit();
virtual void glDeinit();

virtual de::Rectanglei const &charGeometry(uchar ch) = 0;
virtual int charWidth(uchar ch) = 0;
virtual int charHeight(uchar ch) = 0;

de::Vector2i charSize(uchar ch);
virtual de::Rectanglei const &charPosCoords(uchar ch) = 0;
virtual de::Rectanglei const &charTexCoords(uchar ch) = 0;
};

#endif // CLIENT_RESOURCE_ABSTRACTFONT_H
9 changes: 3 additions & 6 deletions doomsday/client/include/resource/bitmapfont.h
Expand Up @@ -38,7 +38,7 @@ class BitmapFont : public AbstractFont
struct bitmapfont_char_t
{
de::Rectanglei geometry;
de::Vector2i coords[4];
de::Rectanglei coords;
};

public:
Expand All @@ -53,14 +53,11 @@ class BitmapFont : public AbstractFont
GLuint textureGLName() const;
de::Vector2i const &textureDimensions() const;

void charCoords(unsigned char ch, de::Vector2i coords[4]);

void glInit();
void glDeinit();

de::Rectanglei const &charGeometry(unsigned char ch);
int charWidth(unsigned char ch);
int charHeight(unsigned char ch);
de::Rectanglei const &charPosCoords(uchar ch);
de::Rectanglei const &charTexCoords(uchar ch);

private:
DENG2_PRIVATE(d)
Expand Down
10 changes: 4 additions & 6 deletions doomsday/client/include/resource/compositebitmapfont.h
Expand Up @@ -41,6 +41,7 @@ class CompositeBitmapFont : public AbstractFont
patchid_t patch;
de::Texture::Variant *tex;
uint8_t border;
bool haveSourceImage;
};

public:
Expand All @@ -66,16 +67,13 @@ class CompositeBitmapFont : public AbstractFont

de::Texture::Variant *charTexture(uchar ch);

uint8_t charBorder(uchar chr);

void charCoords(uchar chr, de::Vector2i coords[4]);
uint charBorder(uchar ch);

void glInit();
void glDeinit();

de::Rectanglei const &charGeometry(uchar ch);
int charWidth(uchar ch);
int charHeight(uchar ch);
de::Rectanglei const &charPosCoords(uchar ch);
de::Rectanglei const &charTexCoords(uchar ch);

private:
DENG2_PRIVATE(d)
Expand Down

0 comments on commit 0d1e452

Please sign in to comment.