// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <config.h>
+
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
#endif
-#include "../video/screen.h"
-#include "../app/globals.h"
-#include "../video/drawing_context.h"
-#include "../special/base.h"
-#include "../math/vector.h"
+#include "screen.h"
+#include "app/globals.h"
+#include "video/drawing_context.h"
+#include "math/vector.h"
using namespace SuperTux;
/* 'Stolen' from the SDL documentation.
+ * Return the pixel value at (x, y)
+ * NOTE: The surface must be locked before calling this!
+ */
+Uint32 SuperTux::getpixel(SDL_Surface *surface, int x, int y)
+{
+ int bpp = surface->format->BytesPerPixel;
+ /* Here p is the address to the pixel we want to retrieve */
+ Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
+
+ switch(bpp) {
+ case 1:
+ return *p;
+
+ case 2:
+ return *(Uint16 *)p;
+
+ case 3:
+ if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
+ return p[0] << 16 | p[1] << 8 | p[2];
+ else
+ return p[0] | p[1] << 8 | p[2] << 16;
+
+ case 4:
+ return *(Uint32 *)p;
+
+ default:
+ return 0; /* shouldn't happen, but avoids warnings */
+ }
+}
+
+/* 'Stolen' from the SDL documentation.
* Set the pixel at (x, y) to the given value
* NOTE: The surface must be locked before calling this!
*/
}
fillrect(0, 0, screen->w, screen->h, 0, 0, 0, 255);
-
- DrawingContext context;
- context.draw_text_center(white_text, "Loading...",
- Vector(0, screen->h/2), LAYER_FOREGROUND1);
- context.do_drawing();
+
}
void SuperTux::shrink_fade(const Vector& point, int fade_time)