summaryrefslogtreecommitdiff
path: root/mogltk/glfont.cpp
diff options
context:
space:
mode:
authorpixel <pixel>2003-09-05 22:01:00 +0000
committerpixel <pixel>2003-09-05 22:01:00 +0000
commit343acb603be88ce4e9ac75de1d5ff64c086dfd77 (patch)
treef5fa96509a5c0fa6fd70805860a912003bfe1770 /mogltk/glfont.cpp
parent2103fd655288946ef7353f05aed4d76a0f4f7f6c (diff)
Removing mogltk...
Diffstat (limited to 'mogltk/glfont.cpp')
-rw-r--r--mogltk/glfont.cpp110
1 files changed, 0 insertions, 110 deletions
diff --git a/mogltk/glfont.cpp b/mogltk/glfont.cpp
deleted file mode 100644
index 82058c8..0000000
--- a/mogltk/glfont.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-#include "glbase.h"
-#include "glfont.h"
-#include "Input.h"
-
-Uint8 prescale2[4] = { 0, 85, 170, 255 }, prescale3[8] = { 0, 36, 72, 109, 145, 182, 218, 255 };
-
-mogltk::font::font(const String & file) {
- Input ffont(file);
- int i;
-
-#ifdef HAVE_ZLIB
- ffont.SetZ();
-#endif
-
- ffont.read(&nbentries, 2);
- ffont.read(&flags, 1);
- ffont.read(&maxX, 1);
- ffont.read(&maxY, 1);
-
- nbcU = 256 / maxX;
- nbcV = 256 / maxY;
-
- nbcT = nbcU * nbcV;
-
- nbT = nbentries / nbcT;
-
- if (nbentries % nbcT) {
- nbT++;
- }
-
- fonttex = (texture **) malloc(nbT * sizeof(texture *));
-
- for (i = 0; i < nbT; i++) {
- fonttex[i] = new texture(256, 256, true);
- }
-
- sizes = (Uint8 *) malloc(nbentries * sizeof(Uint8));
-
- Uint8 * curtex = (Uint8 *) fonttex[0]->GetSurface()->pixels;
- Uint8 curU = 0, curV = 0, curT = 0;
- for (int i = 0; i < nbentries; i++) {
- ffont.read(&sizes[i], 1);
- for (int v = 0; v < maxY; v++) {
- for (int u = 0; u < maxX; u++) {
- Uint8 f;
- ffont.read(&f, 1);
- if (flags) {
- Uint8 r, g, b, a;
- r = f & 3;
- g = (f >> 2) & 7;
- b = (f >> 5) & 3;
- a = (f >> 7) & 1;
- curtex[(curU + u + (curV + v) * 256) * 4 + 0] = prescale2[r];
- curtex[(curU + u + (curV + v) * 256) * 4 + 1] = prescale3[g];
- curtex[(curU + u + (curV + v) * 256) * 4 + 2] = prescale2[b];
- curtex[(curU + u + (curV + v) * 256) * 4 + 3] = a ? 255 : 0;
- } else {
- curtex[(curU + u + (curV + v) * 256) * 4 + 0] = 255;
- curtex[(curU + u + (curV + v) * 256) * 4 + 1] = 255;
- curtex[(curU + u + (curV + v) * 256) * 4 + 2] = 255;
- curtex[(curU + u + (curV + v) * 256) * 4 + 3] = f;
- }
- }
- }
- curU += maxX;
- if (curU >= 256) {
- curU = 0;
- curV += maxY;
- if (curV >= 256) {
- curV = 0;
- curT++;
- curtex = (Uint8 *) fonttex[curT]->GetSurface()->pixels;
- }
- }
- }
-
- for (int i = 0; i < nbT; i++) {
- fonttex[i]->Generate();
- }
-
- corresp = (Uint16 *) malloc(nbentries * 2 * sizeof(Uint16));
-
- ffont.read(corresp, 2 * sizeof(Uint16) * nbentries);
-}
-
-mogltk::font::~font() {
- int i;
- for (i = 0; i < nbT; i++) {
- delete fonttex[i];
- }
-
- free((void *) fonttex);
- free(sizes);
-}
-
-void mogltk::font::drawentry(Uint16 entry, Color c, int x, int y) {
- bool was2D;
-
- was2D = mogltk::glbase::is2D();
-
- if (!was2D) {
- mogltk::glbase::Enter2DMode();
- }
-
-
-
- if (!was2D) {
- mogltk::glbase::Leave2DMode();
- }
-}