// Blending
scm_c_define ("GL_BLEND", scm_from_int (GL_BLEND));
scm_c_define ("GL_ONE", scm_from_int (GL_ONE));
+ scm_c_define ("GL_ONE_MINUS_SRC_ALPHA", scm_from_int (GL_ONE_MINUS_SRC_ALPHA));
scm_c_define ("GL_SRC_ALPHA", scm_from_int (GL_SRC_ALPHA));
// Fog
return scm_from_int (SDL_SetColorKey (get_surface_address (surface), scm_to_int (flag), scm_to_int (key)));
}
+SCM
+gacela_SDL_SetAlpha (SCM surface, SCM flag, SCM alpha)
+{
+ return scm_from_int (SDL_SetAlpha (get_surface_address (surface), scm_to_int (flag), scm_to_int (alpha)));
+}
+
SCM
gacela_SDL_LoadBMP (SCM file)
{
scm_c_define_gsubr ("SDL_DisplayFormat", 1, 0, 0, gacela_SDL_DisplayFormat);
scm_c_define_gsubr ("SDL_MapRGB", 4, 0, 0, gacela_SDL_MapRGB);
scm_c_define_gsubr ("SDL_SetColorKey", 3, 0, 0, gacela_SDL_SetColorKey);
+ scm_c_define_gsubr ("SDL_SetAlpha", 3, 0, 0, gacela_SDL_SetAlpha);
scm_c_define_gsubr ("SDL_LoadBMP", 1, 0, 0, gacela_SDL_LoadBMP);
scm_c_define_gsubr ("IMG_Load", 1, 0, 0, gacela_IMG_Load);
scm_c_define_gsubr ("SDL_GetVideoInfo", 0, 0, 0, gacela_SDL_GetVideoInfo);
(init-sdl)
(let ((image (IMG_Load filename)))
(cond (image
+ (SDL_SetAlpha image 0 0)
(let* ((width (surface-w image)) (height (surface-h image))
(power-2 (nearest-power-of-two (min width height)))
(resized-image #f))
(cond (image
(let ((width (surface-w image)) (height (surface-h image))
(byteorder (if (= SDL_BYTEORDER SDL_LIL_ENDIAN)
- (if (= (surface-format-BytesPerPixel image) 3) GL_BGR GL_BGRA)
- (if (= (surface-format-BytesPerPixel image) 3) GL_RGB GL_RGBA)))
+ (if (= (surface-format-BytesPerPixel image) 3) GL_RGB GL_RGBA)
+ (if (= (surface-format-BytesPerPixel image) 3) GL_BGR GL_BGRA)))
(texture (car (glGenTextures 1))))
(glBindTexture GL_TEXTURE_2D texture)