summaryrefslogtreecommitdiff
path: root/noncore/games/sfcave-sdl/bfont.cpp
Unidiff
Diffstat (limited to 'noncore/games/sfcave-sdl/bfont.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/sfcave-sdl/bfont.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/noncore/games/sfcave-sdl/bfont.cpp b/noncore/games/sfcave-sdl/bfont.cpp
index 0f29104..7dec8f5 100644
--- a/noncore/games/sfcave-sdl/bfont.cpp
+++ b/noncore/games/sfcave-sdl/bfont.cpp
@@ -70,16 +70,12 @@ void BFont::LoadFont (const char *filename)
70 Chars[x].h = 0; 70 Chars[x].h = 0;
71 Chars[x].w = 0; 71 Chars[x].w = 0;
72 } 72 }
73 InitFont(); // Init the font 73 InitFont(); // Init the font
74 } 74 }
75 } 75 }
76 else
77 {
78 cerr << "Error! The font has not been loaded!" << endl;
79 }
80} 76}
81 77
82BFont * BFont :: SetFontColor(Uint8 r, Uint8 g, Uint8 b) 78BFont * BFont :: SetFontColor(Uint8 r, Uint8 g, Uint8 b)
83{ 79{
84 int x,y; 80 int x,y;
85 81
@@ -110,13 +106,12 @@ BFont * BFont :: SetFontColor(Uint8 r, Uint8 g, Uint8 b)
110 106
111 if (SDL_MUSTLOCK(surface)) SDL_LockSurface(surface); 107 if (SDL_MUSTLOCK(surface)) SDL_LockSurface(surface);
112 if (SDL_MUSTLOCK(Surface)) SDL_LockSurface(Surface); 108 if (SDL_MUSTLOCK(Surface)) SDL_LockSurface(Surface);
113 109
114 color_key = xGetPixel(Surface, 0, Surface->h-1); 110 color_key = xGetPixel(Surface, 0, Surface->h-1);
115 111
116 printf("looking...\n");
117 for( x=0; x < Surface->w; x++) { 112 for( x=0; x < Surface->w; x++) {
118 for( y=0; y < Surface->h; y++) { 113 for( y=0; y < Surface->h; y++) {
119 old_r = old_g = old_b = 0; 114 old_r = old_g = old_b = 0;
120 pixel = xGetPixel(Surface,x,y); 115 pixel = xGetPixel(Surface,x,y);
121 116
122 if (pixel != color_key) { 117 if (pixel != color_key) {
@@ -128,13 +123,13 @@ BFont * BFont :: SetFontColor(Uint8 r, Uint8 g, Uint8 b)
128 123
129 pixel = SDL_MapRGB(surface->format,new_r,new_g,new_b); 124 pixel = SDL_MapRGB(surface->format,new_r,new_g,new_b);
130 } 125 }
131 PutPixel(surface,x,y,pixel); 126 PutPixel(surface,x,y,pixel);
132 } 127 }
133 } 128 }
134 printf("unlooking...\n"); 129
135 if (SDL_MUSTLOCK(surface)) SDL_UnlockSurface(surface); 130 if (SDL_MUSTLOCK(surface)) SDL_UnlockSurface(surface);
136 if (SDL_MUSTLOCK(Surface)) SDL_UnlockSurface(Surface); 131 if (SDL_MUSTLOCK(Surface)) SDL_UnlockSurface(Surface);
137 132
138 SDL_SetColorKey(surface, SDL_SRCCOLORKEY, color_key); 133 SDL_SetColorKey(surface, SDL_SRCCOLORKEY, color_key);
139 } 134 }
140 135