fb:porticula NoPaste
Spiel-Code, Fehlermeldungen - gfx.bas
Uploader: | Mao |
Datum/Zeit: | 21.06.2007 20:58:26 |
#include once "sdl\sdl.bi"
#include once "sdl\sdl_image.bi"
#include once "constants.bas"
#include once "main.bas"
Declare Sub BlitSurface(X As Integer, Y As Integer, Source As SrfcePtr, Destination As SrfcePtr)
Declare Function LoadImage Overload(Filename As String) As SrfcePtr
Declare Function LoadImage(Filename As String, TransColor As RGB_t) As SrfcePtr
Sub BlitSurface(X As Integer, Y As Integer, Source As SrfcePtr, Destination As SrfcePtr)
Dim As SDL_Rect offset
With offset
.x=x
.y=y
End With
SDL_BlitSurface(Source, NULL, Destination, @offset)
End Sub
Function LoadImage Overload(Filename As String) As SrfcePtr
Dim As SrfcePtr LoadedImage, OptimizedImage
LoadedImage=IMG_Load(Filename)
If LoadedImage<>NULL Then
OptimizedImage=SDL_DisplayFormat(LoadedImage)
If OptimizedImage<>NULL Then
SDL_FreeSurface(LoadedImage)
Function=OptimizedImage
Else
Function=LoadedImage
End If
End If
End Function
Function LoadImage(Filename As String, TransColor As RGB_t) As SrfcePtr
Dim As SrfcePtr LoadedImage
Dim As Unsigned Integer ColorKey
LoadedImage=LoadImage(Filename)
If LoadedImage<>NULL Then
ColorKey=SDL_MapRGB(LoadedImage->format, TransColor.R, TransColor.G, TransColor.B)
SDL_SetColorKey(LoadedImage, SDL_RLEACCEL Or SDL_SRCCOLORKEY, ColorKey)
End If
Function=LoadedImage
End Function