Demande Wrapper SDL

Sujets variés concernant le développement en PureBasic
Avatar de l’utilisateur
flaith
Messages : 1487
Inscription : jeu. 07/avr./2005 1:06
Localisation : Rennes
Contact :

Demande Wrapper SDL

Message par flaith »

hello,

personne n'aurait dans ses besaces un wrapper pour la Lib SDL sous windows quelque part ?

Merci par avance pour votre retour :wink:
Avatar de l’utilisateur
flaith
Messages : 1487
Inscription : jeu. 07/avr./2005 1:06
Localisation : Rennes
Contact :

Re: Demande Wrapper SDL

Message par flaith »

Bon j'ai trouvé sur le fofo Anglais, si ça intéresse quelqu'un je mettrais le pbi en ligne
Avatar de l’utilisateur
Ar-S
Messages : 9540
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: Demande Wrapper SDL

Message par Ar-S »

Si les exemples sont pas trop complexe pourquoi pas. Je viens de voir que cette Lib (que je ne connaissais pas) est pleine de ressources.
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Avatar de l’utilisateur
flaith
Messages : 1487
Inscription : jeu. 07/avr./2005 1:06
Localisation : Rennes
Contact :

Re: Demande Wrapper SDL

Message par flaith »

Voici le pbi:

Code : Tout sélectionner

#SDL_INIT_TIMER		    = $00000001
#SDL_INIT_AUDIO		    = $00000010
#SDL_INIT_VIDEO		    = $00000020
#SDL_INIT_CDROM		    = $00000100
#SDL_INIT_JOYSTICK	  = $00000200
#SDL_INIT_NOPARACHUTE	= $00100000	;/**< Don't catch fatal signals */
#SDL_INIT_EVENTTHREAD	= $01000000	;/**< Not supported on all OS's */
#SDL_INIT_EVERYTHING	= $0000FFFF

;/** Available For SDL_CreateRGBSurface() Or SDL_SetVideoMode() */
#SDL_SWSURFACE	      = $00000000	;/**< Surface is in system memory */
#SDL_HWSURFACE	      = $00000001	;/**< Surface is in video memory */
#SDL_ASYNCBLIT	      = $00000004	;/**< Use asynchronous blits If possible */

;/** Available For SDL_SetVideoMode() */
#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 */

;/** Available For SDL_CreateRGBSurface() Or SDL_SetVideoMode() */
#SDL_SWSURFACE	      = $00000000	;/**< Surface is in system memory */
#SDL_HWSURFACE	      = $00000001	;/**< Surface is in video memory */
#SDL_ASYNCBLIT	      = $00000004	;/**< Use asynchronous blits If possible */

;/** Available For SDL_SetVideoMode() */
#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 */

;/** Used internally (Read-only) */
#SDL_HWACCEL	        = $00000100	;/**< Blit uses hardware acceleration */
#SDL_SRCCOLORKEY	    = $00001000	;/**< Blit uses a source color key */
#SDL_RLEACCELOK	      = $00002000	;/**< Private flag */
#SDL_RLEACCEL	        = $00004000	;/**< Surface is RLE encoded */
#SDL_SRCALPHA	        = $00010000	;/**< Blit uses source alpha blending */
#SDL_PREALLOC	        = $01000000	;/**< Surface uses preallocated memory */

Structure Uint8
  val.a
EndStructure

Structure Sint16
  val.w
EndStructure

Structure Uint16
  val.c
EndStructure

Structure Uint32
  val.l
EndStructure

Structure SDL_Rect
  x.w;Sint16
  y.w;Sint16
  w.w;Uint16
  h.w;Uint16
EndStructure

Structure SDL_Color
	r.a;Uint8
	g.a;Uint8
	b.a;Uint8
	unused.a;Uint8
EndStructure

Structure SDL_Palette
	ncolors.i
	*colors.SDL_Color
EndStructure

Structure SDL_version
	major.a;Uint8
	minor.a;Uint8
	patch.a;Uint8
EndStructure

Structure SDL_PixelFormat
	*palette.SDL_Palette
	BitsPerPixel.a;Uint8
	BytesPerPixel.a;Uint8
	Rloss.a;Uint8
	Gloss.a;Uint8
	Bloss.a;Uint8
	Aloss.a;Uint8
	Rshift.a;Uint8
	Gshift.a;Uint8
	Bshift.a;Uint8
	Ashift.a;Uint8
	Rmask.l;Uint32
	Gmask.l;Uint32
	Bmask.l;Uint32
	Amask.l;Uint32

	;/** RGB color key information */
	colorkey.l;Uint32
	;/** Alpha value information (per-surface alpha) */
	alpha.a;Uint8
EndStructure

Structure SDL_Surface
	flags.l;Uint32;				/**< Read-only */
	*format.SDL_PixelFormat;		/**< Read-only */
	w.i
	h.i;				/**< Read-only */
	pitch.c;Uint16;				/**< Read-only */
	*pixels;				/**< Read-write */
	offset.i;				/**< Private */

	;/** Hardware-specific surface info */
	*hwdata.private_hwdata;

	;/** clipping information */
	clip_rect.SDL_Rect;			/**< Read-only */
	unused1.l;Uint32;				/**< for binary compatibility */

	;/** Allow recursive locks */
	locked.l;Uint32;				/**< Private */

	;/** info For fast blit mapping To other surfaces */
	*Map.SDL_BlitMap;		/**< Private */

	;/** format version, bumped at every change To invalidate blit maps */
	format_version.i;		/**< Private */

	;/** Reference count -- used when freeing surface */
	refcount.i;				/**< Read-mostly */
EndStructure

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; GENERAL SDL Function for windos by fsw
; http://forums.purebasic.com/english/viewtopic.php?p=43256&sid=d2f77e195bc83adff6dadbe3ceda0d7a#p43256
;
; SDL_Init
; Initializes SDL
Procedure SDL_Init_(Flag)
  If OpenLibrary(0, "SDL.DLL")
    *FunctionPointer = GetFunction(0, "SDL_Init")
    If *FunctionPointer
      ProcedureReturn CallCFunctionFast(*FunctionPointer, Flag);#SDL_INIT_EVERYTHING);#SDL_INIT_VIDEO|#SDL_INIT_NOPARACHUTE)
    Else
      MessageRequester("Error","Can't Initialize SDL Library",0)
      End
    EndIf
  Else
    MessageRequester("Error","Can't Open SDL Library",0)
    End
  EndIf
EndProcedure

; SDL_InitSubSystem
; Initialize subsystems
Procedure SDL_InitSubSystem_(Flag)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_InitSubSystem"),Flag)
EndProcedure

; SDL_QuitSubSystem
; Shut down a subsystem
Procedure SDL_QuitSubSystem_(Flag)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_QuitSubSystem"),Flag)
EndProcedure

; SDL_Quit
; Shut down SDL
Procedure SDL_Quit_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_Quit"))
EndProcedure

; SDL Version
;
Procedure SDL_Linked_Version_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_Linked_Version"))
EndProcedure

; Procedure SDL_Version_()
;   ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_Version"))
; EndProcedure

; SDL_WasInit
; Check which subsystems are initialized
Procedure SDL_WasInit_(Flag)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_WasInit"),Flag)
EndProcedure

; SDL_GetError
; Get SDL error string
Procedure SDL_GetError_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetError"))
EndProcedure

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; VIDEO
;
;
; SDL_GetVideoSurface
; Returns a pointer To the current display surface
Procedure SDL_GetVideoSurface_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetVideoSurface"))
EndProcedure

; SDL_GetVideoInfo
; Returns a pointer To information about the video hardware
Procedure SDL_GetVideoInfo_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetVideoInfo"))
EndProcedure

; SDL_VideoDriverName
; Obtain the name of the video driver
Procedure SDL_VideoDriverName_(namebuf, maxlen)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_VideoDriverName"), namebuf, maxlen)
EndProcedure

; SDL_ListModes
; Returns a pointer to an array of available screen dimensions for the given format and video flags
Procedure SDL_ListModes_(format, flags)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_ListModes"), format, flags)
EndProcedure

; SDL_VideoModeOK
; Check to see if a particular video mode is supported.
Procedure SDL_VideoModeOK_(width, height, bpp, flags)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_VideoModeOK"), width, height, bpp, flags)
EndProcedure

; SDL_SetVideoMode
; Set up a video mode with the specified width, height and bits-per-pixel.
Procedure SDL_SetVideoMode_(width, height, bpp, flags)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetVideoMode"),width, height, bpp, flags)
EndProcedure

; SDL_UpdateRect
; Makes sure the given area is updated on the given screen.
Procedure SDL_UpdateRect_( surface, x, y, w, h)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_UpdateRect"), surface, x, y, w, h)
EndProcedure

; SDL_UpdateRects
; Makes sure the given list of rectangles is updated on the given screen.
Procedure SDL_UpdateRects_( surface, numrects, rects)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_UpdateRects"), surface, numrects, rects)
EndProcedure

; SDL_Flip
; Swaps screen buffers
Procedure SDL_Flip_(surface)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_Flip"), surface)
EndProcedure

; SDL_SetColors
; Swaps screen buffers
Procedure SDL_SetColors_( surface, colors, firstcolor, ncolors)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetColors"), surface, colors, firstcolor, ncolors)
EndProcedure

; SDL_SetPalette
; Sets the colors in the palette of an 8-bit surface.
Procedure SDL_SetPalette_( surface, flags, colors, firstcolor, ncolors)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetPalette"),surface, flags, colors, firstcolor, ncolors)
EndProcedure

; SDL_SetGamma
; Sets the colors in the palette of an 8-bit surface.
Procedure SDL_SetGamma_( redgamma, greengamma, bluegamma)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetGamma"), redgamma, greengamma, bluegamma)
EndProcedure

; SDL_GetGammaRamp
; Gets the color gamma lookup tables for the display
Procedure SDL_GetGammaRamp_( redtable, greentable, bluetable)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetGammaRamp"), redtable, greentable, bluetable)
EndProcedure

; SDL_SetGammaRamp
; Sets the color gamma lookup tables for the display
Procedure SDL_SetGammaRamp_( redtable, greentable, bluetable)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetGammaRamp"), redtable, greentable, bluetable)
EndProcedure

; SDL_MapRGB
; Map a RGB color value To a pixel format.
Procedure SDL_MapRGB_( fmt, r, g, b)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_MapRGB"), fmt, r, g, b)
EndProcedure

; SDL_MapRGBA
; Map a RGBA color value To a pixel format.
Procedure SDL_MapRGBA_( fmt, r, g, b, a)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_MapRGBA"), fmt, r, g, b, a)
EndProcedure

; SDL_GetRGB
; Get RGB values from a pixel in the specified pixel format.
Procedure SDL_GetRGB_( pixelz, fmt, r, g, b)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetRGB"), pixelz, fmt, r, g, b)
EndProcedure

; SDL_GetRGBA
; Get RGBA values from a pixel in the specified pixel format.
Procedure SDL_GetRGBA( pixelz, fmt, r, g, b, a)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetRGBA"), pixelz, fmt, r, g, b, a)
EndProcedure       

; SDL_CreateRGBSurface
; Create an empty SDL_Surface
Procedure SDL_CreateRGBSurface_( flags, width, height, depth, Rmask, Gmask, Bmask, Amask)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CreateRGBSurface"), flags, width, height, depth, Rmask, Gmask, Bmask, Amask)
EndProcedure

; SDL_CreateRGBSurfaceFrom
; Create an SDL_Surface from pixel Data
Procedure SDL_CreateRGBSurfaceFrom_( pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CreateRGBSurfaceFrom"), pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask)
EndProcedure

; SDL_FreeSurface
; Frees (deletes) a SDL_Surface
Procedure SDL_FreeSurface_( surface)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_FreeSurface"), surface)
EndProcedure

; SDL_LockSurface
; Lock a surface for directly access
Procedure SDL_LockSurface( surface)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_LockSurface"), surface)
EndProcedure

; SDL_UnlockSurface
; Unlocks a previously locked surface.
Procedure SDL_UnlockSurface_( surface)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_UnlockSurface"), surface)
EndProcedure

; SDL_RWFromFile
Procedure SDL_RWFromFile_( fname, x.s)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_RWFromFile"), @fname, @x)
EndProcedure

; SDL_LoadBMP_RW
Procedure SDL_LoadBMP_RW_( src, freesrc)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_LoadBMP_RW"), src, freesrc)
EndProcedure

; SDL_LoadBMP
; Load a Windows BMP file into an SDL_Surface.
Procedure SDL_LoadBMP_(fname.s)
  ProcedureReturn SDL_LoadBMP_RW_(SDL_RWFromFile_(@fname,"rb"),1)
EndProcedure

; SDL_SaveBMP_RW
Procedure SDL_SaveBMP_RW_( surface, dst, freesrc)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SaveBMP_RW"), surface, dst, freesrc)
EndProcedure

; SDL_SaveBMP
; Save an SDL_Surface as a Windows BMP file
Procedure SDL_SaveBMP_( surface, fname)
  ProcedureReturn SDL_SaveBMP_RW_(surface,SDL_RWFromFile_(fname,"wb"),1)
EndProcedure

; SDL_SetColorKey
; Sets the color key (transparent pixel) in a blittable surface and RLE acceleration.
Procedure SDL_SetColorKey_( surface, flag, key)
    ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetColorKey"), surface, flag, key)
EndProcedure

; SDL_SetAlpha
; Adjust the alpha properties of a surface
Procedure SDL_SetAlpha_( surface, flag, alpha)
    ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetAlpha"), surface, flag, alpha)
EndProcedure

; SDL_SetClipRect
; Sets the clipping rectangle for a surface.
Procedure SDL_SetClipRect_( surface, rect)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetClipRect"), surface, rect)
EndProcedure

; SDL_GetClipRect
; Gets the clipping rectangle For a surface.
Procedure SDL_GetClipRect_( surface, rect)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetClipRect"), surface, rect)
EndProcedure

; SDL_ConvertSurface
; Converts a surface To the same format as another surface.
Procedure SDL_ConvertSurface_( src, fmt, flags)
    ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_ConvertSurface"), src, fmt, flags)
EndProcedure

; SDL_BlitSurface
; This performs a fast blit from the source surface to the destination surface.
Procedure SDL_BlitSurface_( src, srcrect, dst, dstrect)
  ;ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_BlitSurface"), src, srcrect, dst, dstrect)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_UpperBlit"), src, srcrect, dst, dstrect)
EndProcedure

; SDL_FillRect
; This function performs a fast fill of the given rectangle with some color
Procedure SDL_FillRect_( dst, dstrect, color)
    ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_FillRect"), dst, dstrect, color)
EndProcedure

; SDL_DisplayFormat
; Convert a surface to the display format
Procedure SDL_DisplayFormat_( surface)
    ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_DisplayFormat"), surface)
EndProcedure

; SDL_DisplayFormatAlpha
; Convert a surface to the display format
Procedure SDL_DisplayFormatAlpha_( surface)
    ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_DisplayFormatAlpha"), surface)
EndProcedure

; SDL_WarpMouse
; Set the position of the mouse cursor.
Procedure SDL_WarpMouse_( x, y)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_WarpMouse"), x, y)
EndProcedure

; SDL_CreateCursor
; Creates a new mouse cursor.
Procedure SDL_CreateCursor_( data_c, mask, w, h, hot_x, hot_y)
    ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CreateCursor"), data_c, mask, w, h, hot_x, hot_y)
EndProcedure

; SDL_FreeCursor
; Frees a cursor created with SDL_CreateCursor.
Procedure SDL_FreeCursor_( cursorz)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_FreeCursor"), cursorz)
EndProcedure

; SDL_SetCursor
; Set the currently active mouse cursor.
Procedure SDL_SetCursor_( cursorz)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetCursor"), cursorz)
EndProcedure

; SDL_GetCursor
; Get the currently active mouse cursor.
Procedure SDL_GetCursor_()
    ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetCursor"))
EndProcedure

; SDL_ShowCursor
; Toggle whether or not the cursor is shown on the screen.
Procedure SDL_ShowCursor_( toggle)
    ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_ShowCursor"), toggle)
EndProcedure

; SDL_GL_LoadLibrary
; Specify an OpenGL library
Procedure SDL_GL_LoadLibrary_(path.s)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GL_LoadLibrary"), @path)
EndProcedure

; SDL_GL_GetProcAddress
; Get the address of a GL function
Procedure SDL_GL_GetProcAddress_(proc)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GL_GetProcAddress"), @proc)
EndProcedure

; SDL_GL_GetAttribute
; Get the value of a special SDL/OpenGL attribute
Procedure SDL_GL_GetAttribute_( attr, valuez)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GL_GetAttribute"), attr, valuez)
EndProcedure

; SDL_GL_SetAttribute
; Set a special SDL/OpenGL attribute
Procedure SDL_GL_SetAttribute_( attr, valuez)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GL_SetAttribute"), attr, valuez)
EndProcedure

; SDL_GL_SwapBuffers
; Swap OpenGL framebuffers/Update Display
Procedure SDL_GL_SwapBuffers_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GL_SwapBuffers"))
EndProcedure

; SDL_CreateYUVOverlay
; Create a YUV video overlay
Procedure SDL_CreateYUVOverlay_( width, height, format, display)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CreateYUVOverlay"), width, height, format, display)
EndProcedure

; SDL_LockYUVOverlay
; Lock an overlay
Procedure SDL_LockYUVOverlay_( overlay)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_LockYUVOverlay"), overlay)
EndProcedure

; SDL_UnlockYUVOverlay
; Unlock an overlay
Procedure SDL_UnlockYUVOverlay_( overlay)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_UnlockYUVOverlay"), overlay)
EndProcedure     

; SDL_DisplayYUVOverlay
; Blit the overlay To the display
Procedure SDL_DisplayYUVOverlay_( overlay, dstrect)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_DisplayYUVOverlay"), overlay, dstrect)
EndProcedure

; SDL_FreeYUVOverlay
; Free a YUV video overlay
Procedure SDL_FreeYUVOverlay_( overlay)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_FreeYUVOverlay"),overlay)
EndProcedure     



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WINDOW MANAGEMENT
;
;
; SDL_WM_SetCaption
; Sets the window tile And icon name.
; It's not implemented in all architectures, because not all architectures support having separate titlebar and icon text.
; Actually, "icon name" refers to the text on the icon of the app...
Procedure SDL_WM_SetCaption_( title.s, icon)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_WM_SetCaption"), @title, @icon)
EndProcedure     

; SDL_WM_GetCaption
; Gets the window title and icon name.
Procedure SDL_WM_GetCaption_( title,  icon)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_WM_GetCaption"), title, icon)
EndProcedure     
         
; SDL_WM_SetIcon
; Sets the icon for the display window.
Procedure SDL_WM_SetIcon_( icon,  mask)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_WM_SetIcon"), icon, mask)
EndProcedure     

; SDL_WM_IconifyWindow
; Iconify/Minimise the window
Procedure SDL_WM_IconifyWindow_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_WM_IconifyWindow"))
EndProcedure

; SDL_WM_ToggleFullScreen
; Toggles fullscreen mode
Procedure SDL_WM_ToggleFullScreen_( surface)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_WM_ToggleFullScreen"), surface)
EndProcedure

; SDL_WM_GrabInput
; Grabs mouse And keyboard input.
Procedure SDL_WM_GrabInput_( mode)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_WM_GrabInput"), mode)
EndProcedure



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Event Handling
;
;
; SDL_PumpEvents
; Pumps the event loop, gathering events from the input devices.
Procedure SDL_PumpEvents_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_PumpEvents"))   
EndProcedure

; SDL_PeepEvents
; Checks the event queue for messages and optionally returns them
Procedure SDL_PeepEvents( events, numevents, eventaction, mask)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_PeepEvents"), events, numevents, eventaction, mask)
EndProcedure

; SDL_PollEvent
; Polls For currently pending events.
Procedure SDL_PollEvent_( event)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_PollEvent"), event)
EndProcedure

; SDL_WaitEvent
; Waits indefinitely For the Next available event.
Procedure SDL_WaitEvent_( event)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_WaitEvent"), event)
EndProcedure

; SDL_PushEvent
; Pushes an event onto the event queue
Procedure SDL_PushEvent_( event)
    ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_PushEvent"), event)
EndProcedure

; SDL_SetEventFilter
; Sets up a filter to process all events before they  are posted to the event queue.
Procedure SDL_SetEventFilter_( filter)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetEventFilter"), filter)
EndProcedure

; SDL_GetEventFilter
; Retrieves a pointer to the event filter
Procedure SDL_GetEventFilter_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetEventFilter"))
EndProcedure

; SDL_EventState
; This function allows to set the state of processing certain event type's.
Procedure SDL_EventState_( typez,  state)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_EventState"), typez, state)
EndProcedure

; SDL_GetKeyState
; Get a snapshot of the current keyboard state
Procedure SDL_GetKeyState_( numkeys)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetKeyState"), numkeys)
EndProcedure

; SDL_GetModState
; Get the state of modifier keys
Procedure SDL_GetModState_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetModState"))
EndProcedure

; SDL_SetModState
; Set the current key modifier state
Procedure SDL_SetModState_( modstate)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetModState"), modstate)
EndProcedure

; SDL_GetKeyName
; Get the name of an SDL virtual keysym
Procedure SDL_GetKeyName_( key)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetKeyName"), key)
EndProcedure

; SDL_EnableUNICODE
; Enable UNICODE translation
Procedure SDL_EnableUNICODE_( enable)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_EnableUNICODE"), enable)
EndProcedure

; SDL_EnableKeyRepeat
; Set keyboard Repeat rate
Procedure SDL_EnableKeyRepeat_( delay,  interval)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_EnableKeyRepeat"), delay, interval)
EndProcedure

;SDL_GetMouseState
; Retrieve the current state of the mouse
Procedure SDL_GetMouseState_( x,  y)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetMouseState"), x, y)
EndProcedure

; SDL_GetRelativeMouseState
; Retrieve the current state of the mouse
Procedure SDL_GetRelativeMouseState_( x,  y)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetRelativeMouseState"), x, y)
EndProcedure

; SDL_GetAppState
; Get the state of the application
Procedure SDL_GetAppState_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetAppState"))
EndProcedure

; SDL_JoystickEventState
; Enable/disable joystick event polling
Procedure SDL_JoystickEventState_( state)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickEventState"), state)
EndProcedure



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; JOYSTICK
;
;
; SDL_NumJoysticks
; Count available joysticks.
Procedure SDL_NumJoysticks_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_NumJoysticks"))
EndProcedure

; SDL_JoystickName
; Get joystick name.
Procedure SDL_JoystickName_( index)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickName"), index)
EndProcedure

; SDL_JoystickOpen
; Opens a joystick For use.
Procedure SDL_JoystickOpen_( index)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickOpen"), index)
EndProcedure

; SDL_JoystickOpened
; Determine If a joystick has been opened
Procedure SDL_JoystickOpened_( index)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickOpened"), index)
EndProcedure

; SDL_JoystickIndex
; Get the index of an SDL_Joystick.
Procedure SDL_JoystickIndex_( joystick)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickIndex"), joystick)
EndProcedure

; SDL_JoystickNumAxes
; Get the number of joystick axes
Procedure SDL_JoystickNumAxes_( joystick)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickNumAxes"), joystick)
EndProcedure

; SDL_JoystickNumBalls
; Get the number of joystick trackballs
Procedure SDL_JoystickNumBalls_( joystick)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickNumBalls"), joystick)
EndProcedure

; SDL_JoystickNumHats ; Get the number of joystick hats
Procedure SDL_JoystickNumHats_( joystick)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickNumHats"), joystick)
EndProcedure

; SDL_JoystickNumButtons ; Get the number of joysitck buttons
Procedure SDL_JoystickNumButtons_( joystick)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickNumButtons"), joystick)
EndProcedure

; SDL_JoystickUpdate
; Updates the state of all joysticks
Procedure SDL_JoystickUpdate_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickUpdate"))
EndProcedure

; SDL_JoystickGetAxis
; Get the current state of an axis
Procedure SDL_JoystickGetAxis_( joystick, axis)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickGetAxis"), joystick, axis)
EndProcedure

; SDL_JoystickGetHat
; Get the current state of a joystick hat
Procedure SDL_JoystickGetHat_( joystick, hat)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickGetHat"), joystick, hat)
EndProcedure

; SDL_JoystickGetButton
; Get the current state of a given button on a given joystick
Procedure SDL_JoystickGetButton_( joystick, button)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickGetButton"), joystick, button)
EndProcedure

; SDL_JoystickGetBall
; Get relative trackball motion
Procedure SDL_JoystickGetBall_( joystick, ball, dx, dy)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickGetBall"), joystick, ball, dx, dy)
EndProcedure

; SDL_JoystickClose
; Closes a previously opened joystick
Procedure SDL_JoystickClose_( joystick)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_JoystickClose"), joystick)
EndProcedure



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; AUDIO
;
;
; SDL_OpenAudio
; Opens the audio device with the desired parameters.
Procedure SDL_OpenAudio_( desired, obtained)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_OpenAudio"), desired, obtained)
EndProcedure

; SDL_PauseAudio
; Pauses And unpauses the audio callback processing
Procedure SDL_PauseAudio_( pause_on)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_PauseAudio"), pause_on)
EndProcedure

; SDL_GetAudioStatus
; Get the current audio state
Procedure SDL_GetAudioStatus_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetAudioStatus"))
EndProcedure

; SDL_LoadWAV_RW
Procedure SDL_LoadWAV_RW_( src, freesrc, spec, audio_buf, audio_len)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_LoadWAV_RW"), src, freesrc, spec, audio_buf, audio_len)
EndProcedure

; SDL_LoadWAV
; Load a WAVE file
Procedure SDL_LoadWAV_(fname, spec, audio_buf, audio_len )
  ProcedureReturn SDL_LoadWAV_RW_(SDL_RWFromFile_(fname,"rb"), 1, spec, audio_buf, audio_len)
EndProcedure

; SDL_FreeWAV
; Frees previously opened WAV Data
Procedure SDL_FreeWAV_( audio_buff)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_FreeWAV"), audio_buff)
EndProcedure

; SDL_BuildAudioCVT
; Initializes a SDL_AudioCVT Structure for conversion
Procedure SDL_BuildAudioCVT_( cvt, src_format, src_channels, src_rate, dst_format, dst_channels, dst_rate)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_BuildAudioCVT"), cvt, src_format, src_channels, src_rate, dst_format, dst_channels, dst_rate)
EndProcedure

; SDL_ConvertAudio
; Convert audio Data To a desired audio format.
Procedure SDL_ConvertAudio_( cvt)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_ConvertAudio"), cvt)
EndProcedure

; SDL_MixAudio
; Mix audio Data
Procedure SDL_MixAudio_( dst,  src,  len,  volume)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_MixAudio"), dst, src, len, volume)
EndProcedure

; SDL_LockAudio
; Lock out the callback function
Procedure SDL_LockAudio_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_LockAudio"))
EndProcedure

; SDL_UnlockAudio
; Unlock the callback function
Procedure SDL_UnlockAudio_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_UnlockAudio"))
EndProcedure

; SDL_CloseAudio
; Shuts down audio processing and closes the audio device.
Procedure SDL_CloseAudio_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CloseAudio"))
EndProcedure



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CD-ROM
;
;
; SDL_CDNumDrives
; Returns the number ofCD-ROM drives on the system.
Procedure SDL_CDNumDrives_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CDNumDrives"))
EndProcedure

; SDL_CDName
; Returns a human-readable, system-dependent identifier for the CD-ROM.
Procedure SDL_CDName_( drive)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CDName"), drive)
EndProcedure

; SDL_CDOpen
; Opens a CD-ROM drive For access
Procedure SDL_CDOpen_( drive)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CDOpen"), drive)
EndProcedure

; SDL_CDStatus
; Returns the current status of the given drive.
Procedure SDL_CDStatus_( cdrom)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CDStatus"), cdrom)
EndProcedure

; SDL_CDPlay
; Play a CD
Procedure SDL_CDPlay_( cdrom, start, lengthz)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CDPlay"), cdrom, start, lengthz)
EndProcedure

; SDL_CDPlayTracks
; Play the given CD track(s)
Procedure SDL_CDPlayTracks_( cdrom,  start_track,  frames,  ntracks,  nframes)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CDPlayTracks"), cdrom, start_track, frames, ntracks, nframes)
EndProcedure

; SDL_CDPause
; Pauses a CDROM
Procedure SDL_CDPause_( cdrom)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CDPause"), cdrom)
EndProcedure

; SDL_CDResume
; Resumes a CDRMOM
Procedure SDL_CDResume_( cdrom)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CDResume"), cdrom)
EndProcedure

; SDL_CDStop
; Stops a CDROM
Procedure SDL_CDStop_( cdrom)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CDStop"), cdrom)
EndProcedure

; SD_CDEject
; Ejects a CDROM
Procedure SDL_CDEject_( cdrom)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CDEject"), cdrom)
EndProcedure

; SDL_CDClose
; Closes a SDL_CD handle
Procedure SDL_CDClose_( cdrom)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CDClose"), cdrom)
EndProcedure



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Threads
;
;
; SDL_CreateThread
; Creates a new thread of execution that shares its parent's properties.
Procedure SDL_CreateThread_( fn, datat)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CreateThread"), fn, datat)
EndProcedure

; SDL_ThreadID
; Get the 32-bit thread identifier for the current thread.
Procedure SDL_ThreadID_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_ThreadID"))
EndProcedure

; SDL_GetThreadID
; Get the SDL thread ID of a SDL_Thread
Procedure SDL_GetThreadID_( thread)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetThreadID"), thread)
EndProcedure

; SDL_WaitThread
; Wait For a thread To finish.
Procedure SDL_WaitThread_( thread, status)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_WaitThread"), thread, status)
EndProcedure

; SDL_KillThread
; Gracelessly terminates the thread.
Procedure SDL_KillThread_( thread)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_KillThread"), thread)
EndProcedure

; Create a new, unlocked mutex.
Procedure SDL_CreateMutex_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CreateMutex"))
EndProcedure

; SDL_DestroyMutex
; Destroy a mutex
Procedure SDL_DestroyMutex_( mutex)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_DestroyMutex"), mutex)
EndProcedure

; SDL_mutexP
; Lock a mutex
Procedure SDL_mutexP_( mutex)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_mutexP"), mutex)
EndProcedure

; SDL_mutexV
; Unlock a mutex
Procedure SDL_mutexV_( mutex)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_mutexV"), mutex)
EndProcedure

; SDL_CreateSemaphore
; Creates a new semaphore and assigns an initial value to it.
Procedure SDL_CreateSemaphore_( initial_value)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CreateSemaphore"), initial_value)
EndProcedure

; SDL_DestroySemaphore
; Destroys a semaphore that was created by SDL_CreateSemaphore.
Procedure SDL_DestroySemaphore_( sem)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_DestroySemaphore"), sem)
EndProcedure

; SDL_SemWait
; Lock a semaphore and suspend the thread if the semaphore value is zero
Procedure SDL_SemWait_( sem)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SemWait"), sem)
EndProcedure

; SDL_SemTryWait
; Attempt To lock a semaphore but don't suspend the thread.
Procedure SDL_SemTryWait_( sem)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SemTryWait"), sem)
EndProcedure

; SDL_SemWaitTimeout
; Lock a semaphore, but only wait up to a specified maximum time.
Procedure SDL_SemWaitTimeout_( sem,  timeout)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SemWaitTimeout"), sem, timeout)
EndProcedure

; SDL_SemPost
; Unlock a semaphore.
Procedure SDL_SemPost_( sem)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SemPost"), sem)
EndProcedure

; SDL_SemValue
; Return the current value of a semaphore.
Procedure SDL_SemValue_( sem)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SemValue"), sem)
EndProcedure

; SDL_CreateCond
; Create a condition variable
Procedure SDL_CreateCond_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CreateCond"))
EndProcedure

; SDL_DestroyCond
; Destroy a condition variable
Procedure SDL_DestroyCond_( cond)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_DestroyCond"), cond)
EndProcedure

; SDL_CondSignal
; Restart a thread wait on a condition variable
Procedure SDL_CondSignal_( cond)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CondSignal"), cond)
EndProcedure

; SDL_CondBroadcast
; Restart all threads waiting on a condition variable
Procedure SDL_CondBroadcast_( cond)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CondBroadcast"), cond)
EndProcedure

; SDL_CondWait
; Wait on a condition variable
Procedure SDL_CondWait_( cond, mut)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CondWait"), cond, mut)
EndProcedure

; SDL_CondWaitTimeout
; Wait on a condition variable, with timeout
Procedure SDL_CondWaitTimeout_( cond, mut, ms)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_CondWaitTimeout"), cond, mut, ms)
EndProcedure

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Timers
;
;
; SDL_GetTicks
; Get the number of milliseconds since the SDL library initialization.
Procedure SDL_GetTicks_()
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_GetTicks"))
EndProcedure

; SDL_Delay
; Wait a specified number of milliseconds before returning.
Procedure SDL_Delay_( ms)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_Delay"), ms)
EndProcedure

; SDL_AddTimer
; Add a timer which will call a callback after the specified number of milliseconds has elapsed
Procedure SDL_AddTimer_( interval, callback, param)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_AddTimer"), interval, callback, param)
EndProcedure

; SDL_RemoveTimer
; Remove a timer which was added with SDL_AddTimer.
Procedure SDL_RemoveTimer_( timer)
  ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_RemoveTimer"), timer)
EndProcedure

; SDL_SetTimer
; Set a callback to run after the specified number of milliseconds has elapsed.
Procedure SDL_SetTimer_( interval, callback)
    ProcedureReturn CallCFunctionFast(GetFunction(0, "SDL_SetTimer"), interval, callback)
EndProcedure
Et un exemple de Guimauve :

Code : Tout sélectionner

XIncludeFile "SDL.pbi"

SDL_Init_(#SDL_INIT_EVERYTHING)

Procedure InitializeSDL_version(*SDL_versionA.SDL_version)
 *Version.SDL_version = SDL_Linked_Version_()
 CopyMemory(*Version, *SDL_versionA, SizeOf(SDL_version))
EndProcedure

Macro Format_SDL_Version(SDL_VersionA)
  "SDL Runtime Version : " + StrU(SDL_VersionA\major, #PB_Byte) + "." + StrU(SDL_VersionA\minor, #PB_Byte) + "." + StrU(SDL_VersionA\patch, #PB_Byte)
EndMacro

InitializeSDL_version(SDL_version.SDL_version)
Debug Format_SDL_Version(SDL_Version)

Debug "--- Joystick test"
 
Max = SDL_NumJoysticks_()

If max
  For Index = 0 To Max -1
  
    Debug PeekS(SDL_JoystickName_(Index))
   
    Joystick.i = SDL_JoystickOpen_(Index)
   
    JoyIndex.b = SDL_JoystickIndex_(Joystick)
    AxisCount.b = SDL_JoystickNumAxes_(Joystick)
    BallsCount.b = SDL_JoystickNumBalls_(Joystick)
    HatCount.b = SDL_JoystickNumHats_(Joystick)
    ButtonCount.b = SDL_JoystickNumButtons_(Joystick) 
    SDL_JoystickClose_(Joystick)
   
    Debug "JoyIndex = " + Str(JoyIndex)
    Debug "AxisCount = " + Str(AxisCount)
    Debug "BallsCount = " + Str(BallsCount)
    Debug "HatCount = " + Str(HatCount)
    Debug "ButtonCount = " + Str(ButtonCount)
    Debug ""
  Next
Else
  Debug "No Joystick connected"
EndIf

Debug "--- Screen Resolution test"

Restore ScreenRes

For Index = 0 To 63

  Read.l Width.l
  Read.l Height.l
  Read.s Aspect.s
 
  If SDL_VideoModeOK_(Width, Height, 16, #SDL_FULLSCREEN) <> 0
    Debug Str(Width) + " X " + Str(Height) + " X 16 (" + Aspect + ")"
  EndIf
 
  If SDL_VideoModeOK_(Width, Height, 24, #SDL_FULLSCREEN) <> 0
    Debug Str(Width) + " X " + Str(Height) + " X 24 (" + Aspect + ")"
  EndIf
 
  If SDL_VideoModeOK_(Width, Height, 32, #SDL_FULLSCREEN) <> 0
    Debug Str(Width) + " X " + Str(Height) + " X 32 (" + Aspect + ")"
  EndIf
 
Next

SDL_Quit_()

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Liste des résolutions standards <<<<<

DataSection

  ScreenRes:

  Data.l 640, 480
  Data.s "4:3"
 
  Data.l 640, 512
  Data.s "5:4"
 
  Data.l 720, 348
  Data.s "60:29"
 
  ; 3
 
  Data.l 720, 350
  Data.s "72:35"
 
  Data.l 720, 364
  Data.s "180:91"
 
  Data.l 768, 480
  Data.s "16:10"
 
  ; 6
 
  Data.l 800, 352
  Data.s "25:11"
 
  Data.l 800, 480
  Data.s "5:3"
 
  Data.l 800, 600
  Data.s "4:3"
 
  ; 9
 
  Data.l 832, 624
  Data.s "4:3"
 
  Data.l 856, 480
  Data.s "16:9"
 
  Data.l 960, 540
  Data.s "16:9"
 
  ; 12
 
  Data.l 960, 720
  Data.s "4:3"
 
  Data.l 1024,576
  Data.s "16:9"
 
  Data.l 1024,640
  Data.s "16:10"
 
  ; 15
 
  Data.l 1024,768
  Data.s "4:3"
 
  Data.l 1024,1024
  Data.s "1:1"
 
  Data.l 1120,832
  Data.s "35:26"
 
  ; 18
 
  Data.l 1152,720
  Data.s "16:10"
 
  Data.l 1152,768
  Data.s "3:2"
 
  Data.l 1152,864
  Data.s "4:3"
 
  ; 21
 
  Data.l 1152,900
  Data.s "32:25"
 
  Data.l 1280,768
  Data.s "5:3"
 
  Data.l 1280,800
  Data.s "16:10"
 
  ; 24
 
  Data.l 1280,854
  Data.s "3:2"
 
  Data.l 1280,960
  Data.s "4:3"
 
  Data.l 1280,1024
  Data.s "5:4"
 
  ; 27
 
  Data.l 1366,768
  Data.s "16:9"
 
  Data.l 1400,1050
  Data.s "4:3"
 
  Data.l 1440,900
  Data.s "16:10"
 
  ; 30
 
  Data.l 1440,1024
  Data.s "45:32"
 
  Data.l 1440, 1080
  Data.s "4:3"
 
  Data.l 1600,768
  Data.s "25:12"
 
  ; 33
 
  Data.l 1600,900
  Data.s "16:9"
 
  Data.l 1600,1024
  Data.s "25:16"
 
  Data.l 1600,1200
  Data.s "4:3"
 
  ; 36
 
  Data.l 1680,1050
  Data.s "16:10"
 
  Data.l 1792,1344
  Data.s "4:3"
 
  Data.l 1800,1440
  Data.s "5:4"
 
  ; 39
 
  Data.l 1856,1392
  Data.s "4:3"
 
  Data.l 1920,1080
  Data.s "16:9"

  Data.l 1920,1200
  Data.s "16:10"
 
  Data.l 1920,1400
  Data.s "48:35"
 
  ; 42
 
  Data.l 1920,1440
  Data.s "4:3"
 
  Data.l 2048,1152
  Data.s "16:9"
 
  Data.l 2048,1536
  Data.s "4:3"
 
  ; 45
 
  Data.l 2304,1440
  Data.s "16:10"
 
  Data.l 2560,1440
  Data.s "16:9"
 
  Data.l 2560,1600
  Data.s "16:10"
 
  ; 48
 
  Data.l 2560,1920
  Data.s "4:3"
 
  Data.l 2560,2048
  Data.s "5:4"
 
  Data.l 2800,2100
  Data.s "4:3"
 
  ; 51
 
  Data.l 3200,2048
  Data.s "25:16"
 
  Data.l 3200,2400
  Data.s "4:3"
 
  Data.l 3840,2160
  Data.s "16:9"
 
  ; 54
 
  Data.l 3840,2400
  Data.s "16:10"
 
  Data.l 4096,2304
  Data.s "16:9"
 
  Data.l 4096,3072
  Data.s "4:3"
 
  ; 57
 
  Data.l 5120,3200
  Data.s "16:10"
 
  Data.l 5120,4096
  Data.s "5:4"
 
  Data.l 6400,4096
  Data.s "5:4"
 
  ; 60
 
  Data.l 6400,4800
  Data.s "4:3"
 
  Data.l 7680,4320
  Data.s "16:9"
 
  Data.l 7680,4800
  Data.s "16:10"

  ; 63

EndDataSection
Ne pas oublier de mettre SDL.DLL dans le même répertoire
Il y a des modifications à apporter à l'include car elle a été faite pour Linux et j'ai modifié un peu le code (ajout des constantes et des structures) :wink:
Répondre