Buchempfehlung
Visual Basic 6 Kochbuch
Visual Basic 6 Kochbuch
Viele praktische Tipps zum Programmieren mit Visual Basic 6, die sich oft auch auf FB übertragen lassen. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

Spiel-Code, Fehlermeldungen - gfx.bas

Uploader:RedakteurMao
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