PureBasic 3.81 for Linux released !

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Shannara wrote:You have windows SDL include files? I wanna.... :D
43Kb is maybe a little too big posting it here :wink:
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Just found out:
grab the sdl.res resource file from the linux distribution and put it where it belongs.
This way you save 13Kb code.
Nnow here are the functions:

Code: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
; GENERAL
;
;
; SDL_Init 
; Initializes SDL
Procedure SDL_Init_(Flag)
  If OpenLibrary(0, "SDL.DLL")
    *FunctionPointer = IsFunction(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(IsFunction(0, "SDL_InitSubSystem"),Flag)
EndProcedure

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

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

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

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




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

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

; SDL_VideoDriverName 
; Obtain the name of the video driver
Procedure SDL_VideoDriverName_(namebuf, maxlen)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(0, "SDL_UpdateRects"), surface, numrects, rects)
EndProcedure

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

; SDL_SetColors 
; Swaps screen buffers
Procedure SDL_SetColors_( surface, colors, firstcolor, ncolors)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(0, "SDL_FreeSurface"), surface)
EndProcedure

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

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

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

; SDL_LoadBMP_RW
Procedure SDL_LoadBMP_RW_( src, freesrc)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(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(IsFunction(0, "SDL_SetColorKey"), surface, flag, key)
EndProcedure

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

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

; SDL_GetClipRect 
; Gets the clipping rectangle For a surface.
Procedure SDL_GetClipRect_( surface, rect)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(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(IsFunction(0, "SDL_BlitSurface"), 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(IsFunction(0, "SDL_FillRect"), dst, dstrect, color)
EndProcedure

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

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

; SDL_WarpMouse 
; Set the position of the mouse cursor.
Procedure SDL_WarpMouse_( x, y)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(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(IsFunction(0, "SDL_FreeCursor"), cursorz)
EndProcedure

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

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

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

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

; SDL_GL_GetProcAddress 
; Get the address of a GL function
Procedure SDL_GL_GetProcAddress_(proc)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_GL_GetAttribute"), attr, valuez)
EndProcedure

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

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

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

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

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

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

; SDL_FreeYUVOverlay 
; Free a YUV video overlay
Procedure SDL_FreeYUVOverlay_( overlay)
  ProcedureReturn CallCFunctionFast(IsFunction(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.s)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(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(IsFunction(0, "SDL_WM_SetIcon"), icon, mask)
EndProcedure      

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

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

; SDL_WM_GrabInput 
; Grabs mouse And keyboard input.
Procedure SDL_WM_GrabInput_( mode)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(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(IsFunction(0, "SDL_PeepEvents"), events, numevents, eventaction, mask)
EndProcedure

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

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

; SDL_PushEvent 
; Pushes an event onto the event queue
Procedure SDL_PushEvent_( event)
    ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_SetEventFilter"), filter)
EndProcedure

; SDL_GetEventFilter 
; Retrieves a pointer to the event filter
Procedure SDL_GetEventFilter_()
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_EventState"), typez, state)
EndProcedure

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

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

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

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

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

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

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

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

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

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



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

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

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

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

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

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

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

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

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

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

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

; SDL_JoystickGetHat 
; Get the current state of a joystick hat
Procedure SDL_JoystickGetHat_( joystick, hat)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_JoystickGetButton"), joystick, button)
EndProcedure

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

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



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

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

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

; SDL_LoadWAV_RW
Procedure SDL_LoadWAV_RW_( src, freesrc, spec, audio_buf, audio_len)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(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(IsFunction(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(IsFunction(0, "SDL_ConvertAudio"), cvt)
EndProcedure

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

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

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

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



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

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

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

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

; SDL_CDPlay 
; Play a CD
Procedure SDL_CDPlay_( cdrom, start, lengthz)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_CDPlayTracks"), cdrom, start_track, frames, ntracks, nframes)
EndProcedure

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

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

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

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

; SDL_CDClose 
; Closes a SDL_CD handle
Procedure SDL_CDClose_( cdrom)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_CreateThread"), fn, datat)
EndProcedure

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

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

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

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

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

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

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

; SDL_mutexV 
; Unlock a mutex
Procedure SDL_mutexV_( mutex)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_CreateSemaphore"), initial_value)
EndProcedure

; SDL_DestroySemaphore 
; Destroys a semaphore that was created by SDL_CreateSemaphore.
Procedure SDL_DestroySemaphore_( sem)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_SemWait"), sem)
EndProcedure

; SDL_SemTryWait 
; Attempt To lock a semaphore but don't suspend the thread.
Procedure SDL_SemTryWait_( sem)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_SemWaitTimeout"), sem, timeout)
EndProcedure

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

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

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

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

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

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

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

; SDL_CondWaitTimeout 
; Wait on a condition variable, with timeout
Procedure SDL_CondWaitTimeout_( cond, mut, ms)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_GetTicks"))
EndProcedure

; SDL_Delay 
; Wait a specified number of milliseconds before returning.
Procedure SDL_Delay_( ms)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_AddTimer"), interval, callback, param)
EndProcedure

; SDL_RemoveTimer 
; Remove a timer which was added with SDL_AddTimer.
Procedure SDL_RemoveTimer_( timer)
  ProcedureReturn CallCFunctionFast(IsFunction(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(IsFunction(0, "SDL_SetTimer"), interval, callback)
EndProcedure
BTW I never used the DLL Importer, but I suppose with this tool even the functions above are not necessary...
User avatar
einander
Enthusiast
Enthusiast
Posts: 744
Joined: Thu Jun 26, 2003 2:09 am
Location: Spain (Galicia)

Post by einander »

I've sent my mail too.
Thanx Fred and all the PB team!

Best regards, and Happy 2004 for all PB coders.
Einander
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Finally you got PB 3.81 for Linux to be born in 2003 :wink:
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

Psychophanta wrote:Finally you got PB 3.81 for Linux to be born in 2003 :wink:
Yeah, I had to kick Fred a lot with my steel enforced boots to get him to work faster, he just made it on time :twisted:
DeeCee
User
User
Posts: 34
Joined: Wed Dec 31, 2003 11:14 pm

Post by DeeCee »

E-mail sent and I'm eager to get the new version. :)

...now maybe I can *finally* become a productive PB coder in the days ahead!

-DeeCee-

PS - Happy New Year to all!
idem::alias
New User
New User
Posts: 1
Joined: Wed Dec 03, 2003 1:24 pm
Location: Italy

pb Linux 3.81

Post by idem::alias »

I'm eager to get the new Linux version.

Thanx Fred :D
Post Reply