je m'essaie à différents codes (test only) et là je bute sur un problème.
Je souhaites utiliser la SDL en PB mais j'y arrive pas, voilà mon code.
Code : Tout sélectionner
#sdl_lib = 0
#SDL_HWSURFACE = $00000001 ;/* Surface is IN video memory */
#SDL_ASYNCBLIT = $00000004 ;/* Use asynchronous blits If possible */
#SDL_ANYFORMAT = $10000000 ;/* Allow any video depth/pixel-format */
#SDL_HWPALETTE = $20000000 ;/* Surface has exclusive palette */
#SDL_DOUBLEBUF = $40000000 ;/* Set up double-buffered video mode */
#SDL_FULLSCREEN = $80000000 ;/* Surface is a full screen display */
#SDL_OPENGL = $00000002 ;/* Create an OpenGL rendering context */
#SDL_OPENGLBLIT = $0000000A ;/* Create an OpenGL rendering context And use it For blitting */
#SDL_RESIZABLE = $00000010 ;/* This video mode may be resized */
#SDL_NOFRAME = $00000020 ;/* No window caption Or edge frame */
Structure SDL_Surface
EndStructure
Prototype pSDL_Init()
Prototype pSDL_Quit()
Prototype pSetVideoMode(width.l,height.l,bpp.l,flags.l)
Prototype pBlit(*src.SDL_Surface,*rect.l,*dest.SDL_Surface,*p.l)
Prototype pLoadBMP(img.s)
If OpenLibrary(#sdl_lib,"SDL.dll")
vinit.pSDL_Init = GetFunction(#sdl_lib,"SDL_Init")
vquit.pSDL_Quit = GetFunction(#sdl_lib,"SDL_Quit")
setv.pSetVideoMode = GetFunction(#sdl_lib,"SDL_SetVideoMode")
blit.pBlit = GetFunction(#sdl_lib,"SDL_BlitSurface")
loadbmp.pLoadBMP = GetFunction(#sdl_lib,"SDL_LoadBMP")
*img.SDL_Surface = loadbmp("test.bmp") ; j'ai un "invalid access memory" ici
vinit()
*ecran.SDL_Surface = setv(800,600,32,#SDL_HWSURFACE | #SDL_DOUBLEBUF)
blit(*img,#Null,*ecran,#Null)
Delay(5000)
vquit()
EndIf
Prototype.SDL_Surface xxx
çà me sort :
a structure can't be use in a ProcedureReturn
donc voici mes questions :
1/ est on obliger de mettre un type de retour à un prototype ?
2/ comment on mets une struture ?
3/ Et un pointeur ?
merci.