summaryrefslogtreecommitdiff
path: root/lib/font.cc
diff options
context:
space:
mode:
authorpixel <pixel>2003-03-28 13:36:38 +0000
committerpixel <pixel>2003-03-28 13:36:38 +0000
commit3e2e4fe9e05d73ba1c1b5de93160bb1cdb7cb56e (patch)
tree49b310acf67fb2dbad7a7f39841d67e01ea2c007 /lib/font.cc
parent541c00c93fcd98f766cce661aa83ef4ffe713e57 (diff)
SDL backend mostly finished
Diffstat (limited to 'lib/font.cc')
-rw-r--r--lib/font.cc40
1 files changed, 19 insertions, 21 deletions
diff --git a/lib/font.cc b/lib/font.cc
index 9e77ae2..93588bf 100644
--- a/lib/font.cc
+++ b/lib/font.cc
@@ -1,10 +1,12 @@
#include <stdarg.h>
+#include <SDL.h>
+#include <Input.h>
#include "base.h"
#include "font.h"
-#include "Input.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include "engine.h"
Uint8 prescale2[4] = { 0, 85, 170, 255 }, prescale3[8] = { 0, 36, 72, 109, 145, 182, 218, 255 };
@@ -163,16 +165,16 @@ mogltk::font::~font() {
}
void mogltk::font::drawentry(Uint16 entry, int x, int y, ColorP c) {
- bool was2D;
+ bool locked = false;
int trueentry, cx, cy, px, py;
+ SDL_Rect src, dst;
- return;
-#if 0
- was2D = mogltk::glbase::is2D();
-
- if (!was2D)
- mogltk::glbase::Enter2DMode();
-
+ if (SDL_MUSTLOCK(mogltk::engine::base_o->getsurface())) {
+ locked = true;
+ SDL_LockSurface(mogltk::engine::base_o->getsurface());
+ }
+
+#if 0
if (shadow) {
int os = shadow;
shadow = 0;
@@ -181,27 +183,23 @@ void mogltk::font::drawentry(Uint16 entry, int x, int y, ColorP c) {
shadow = os;
}
-
+#endif
+
y -= base;
- Bind(entry / nbcT);
- c.Bind();
trueentry = entry % nbcT;
cx = trueentry % nbcU;
cy = trueentry / nbcU;
px = cx * maxX;
py = cy * maxY;
- glBegin(GL_TRIANGLE_STRIP);
- glTexCoord2i(px , py ); glVertex2i(x , y );
- glTexCoord2i(px + maxX - 1, py ); glVertex2i(x + maxX - 1, y );
- glTexCoord2i(px , py + maxY - 1); glVertex2i(x , y + maxY - 1);
- glTexCoord2i(px + maxX - 1, py + maxY - 1); glVertex2i(x + maxX - 1, y + maxY - 1);
- glEnd();
+ src.x = px; src.y = py; src.w = maxX; src.h = maxY;
+ dst.x = x; dst.y = y; dst.w = maxX; dst.h = maxY;
- if (!was2D)
- mogltk::glbase::Leave2DMode();
-#endif
+ SDL_BlitSurface(fonttex[entry / nbcT]->GetSurface(), &src, mogltk::engine::base_o->getsurface(), &dst);
+
+ if (locked)
+ SDL_UnlockSurface(mogltk::engine::base_o->getsurface());
}
void mogltk::font::putcursor(int x, int y) {