@@ -88,6 +88,8 @@ Extern
Function bmx_sdl_surface_Blit:Int(handle:Byte Ptr, sx:Int, sy:Int, sw:Int, sh:Int, dest:Byte Ptr, dx:Int, dy:Int)
Function bmx_sdl_surface_BlitScaled:Int(handle:Byte Ptr, sx:Int, sy:Int, sw:Int, sh:Int, dest:Byte Ptr, dx:Int, dy:Int)
+ Function bmx_sdl_LoadBMP:Byte Ptr(file:String)
+
End Extern
Rem
@@ -21,6 +21,7 @@
distribution.
*/
#include "SDL_surface.h"
+#include "brl.mod/blitz.mod/blitz.h"
SDL_PixelFormat * bmx_sdl_surface_Format(SDL_Surface * surface) {
return surface->format;
@@ -101,5 +102,12 @@ int bmx_sdl_surface_BlitScaled(SDL_Surface * surface, int sx, int sy, int sw, in
return SDL_BlitScaled(surface, (sw==0 && sh==0 && sx==0 && sy==0) ? NULL : &sr, dest, &dr);
}
+SDL_Surface * bmx_sdl_LoadBMP(BBString * file) {
+ char * f = bbStringToUTF8String(file);
+ SDL_Surface * surface = SDL_LoadBMP(f);
+ bbMemFree(f);
+ return surface;
+}
@@ -85,6 +85,13 @@ Type TSDLSurface
Return _create(SDL_CreateRGBSurfaceFrom(pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask))
End Function
+ Rem
+ bbdoc: Loads a surface from a BMP file.
+ End Rem
+ Function LoadBMP:TSDLSurface(file:String)
+ Return _create(bmx_sdl_LoadBMP(file))
+ End Function
bbdoc: Copies the surface to a new surface of the specified format.
returns: The new surface, or Null on failure.