summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpixel <pixel>2003-03-26 10:44:20 +0000
committerpixel <pixel>2003-03-26 10:44:20 +0000
commita749e5e0f870dc2acde2de55cba2cd074d524442 (patch)
tree5507643f186bd7a454e2d6c3dfa446a16e11f0e7 /lib
parentc1057d096fa2e1421d881732922a929829799263 (diff)
Fixed Big endian support
Diffstat (limited to 'lib')
-rw-r--r--lib/glfont.cc6
-rw-r--r--lib/gltexture.cc7
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/glfont.cc b/lib/glfont.cc
index 9b77c8c..80a8b1d 100644
--- a/lib/glfont.cc
+++ b/lib/glfont.cc
@@ -111,7 +111,7 @@ mogltk::font::font(Handle * ffont) : textcolor(255, 255, 255, 255), shadow(0), w
Uint8 * curtex = (Uint8 *) fonttex[0]->GetSurface()->pixels;
Uint32 curU = 0, curV = 0, curT = 0;
- for (int i = 0; i < nbentries; i++) {
+ for (i = 0; i < nbentries; i++) {
sizes[i] = ffont->readU8();
for (int v = 0; v < maxY; v++) {
for (int u = 0; u < maxX; u++) {
@@ -147,7 +147,9 @@ mogltk::font::font(Handle * ffont) : textcolor(255, 255, 255, 255), shadow(0), w
corresp = (Uint16 *) malloc(nbentries * 2 * sizeof(Uint16));
- ffont->read(corresp, 2 * sizeof(Uint16) * nbentries);
+ for (i = 0; i < 2 * nbentries; i++) {
+ corresp[i] = ffont->readU16();
+ }
}
mogltk::font::~font() {
diff --git a/lib/gltexture.cc b/lib/gltexture.cc
index b0bc7c4..c0a940f 100644
--- a/lib/gltexture.cc
+++ b/lib/gltexture.cc
@@ -279,10 +279,17 @@ SDL_Surface * mogltk::texture::LoadNTEX(Handle * h) throw (GeneralException) {
width = h->readU16();
if (!(r = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ 0xff000000,
+ 0x00ff0000,
+ 0x0000ff00,
+ 0x000000ff
+#else
0x000000ff,
0x0000ff00,
0x00ff0000,
0xff000000
+#endif
))) {
throw GeneralException(_("Can't create RGB Surface for LoadNTEX"));
}