diff options
author | Araq <rumpf_a@web.de> | 2014-09-18 23:08:55 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-09-18 23:08:55 +0200 |
commit | e7140f290b0f427ec6bd81cb75b555cdd672f9f0 (patch) | |
tree | 5dac8e727dfdc77864e5d168ea7ce49a5bf4f590 | |
parent | 03744be67ec6e48527ccfa9f5b631ee7ed8b32c3 (diff) | |
download | Nim-e7140f290b0f427ec6bd81cb75b555cdd672f9f0.tar.gz |
updated SDL wrapper
-rw-r--r-- | lib/wrappers/sdl/sdl.nim | 627 | ||||
-rw-r--r-- | lib/wrappers/sdl/sdl_gfx.nim | 156 | ||||
-rw-r--r-- | lib/wrappers/sdl/sdl_image.nim | 74 | ||||
-rw-r--r-- | lib/wrappers/sdl/sdl_mixer.nim | 168 | ||||
-rw-r--r-- | lib/wrappers/sdl/sdl_mixer_nosmpeg.nim | 166 | ||||
-rw-r--r-- | lib/wrappers/sdl/sdl_net.nim | 115 | ||||
-rw-r--r-- | lib/wrappers/sdl/sdl_ttf.nim | 94 | ||||
-rw-r--r-- | lib/wrappers/sdl/smpeg.nim | 79 |
8 files changed, 732 insertions, 747 deletions
diff --git a/lib/wrappers/sdl/sdl.nim b/lib/wrappers/sdl/sdl.nim index 753796274..e09dfd59a 100644 --- a/lib/wrappers/sdl/sdl.nim +++ b/lib/wrappers/sdl/sdl.nim @@ -752,13 +752,13 @@ const # Enumeration of valid key mods (possibly OR'd tog type THandle* = int #SDL_types.h types # Basic data types - TBool* = enum + TBool* = enum sdlFALSE, sdlTRUE PUInt8Array* = ptr TUInt8Array TUInt8Array* = array[0..high(int) shr 1, byte] - PUInt16* = ptr uInt16 - PUInt32* = ptr uInt32 - PUInt64* = ptr uInt64 + PUInt16* = ptr uint16 + PUInt32* = ptr uint32 + PUInt64* = ptr UInt64 UInt64*{.final.} = object hi*: int32 lo*: int32 @@ -771,12 +771,12 @@ type TGrabMode* = int32 # SDL_error.h types Terrorcode* = enum ENOMEM, EFREAD, EFWRITE, EFSEEK, LASTERROR - errorcode* = Terrorcode + Errorcode* = Terrorcode TArg*{.final.} = object buf*: array[0..ERR_MAX_STRLEN - 1, int8] Perror* = ptr Terror - Terror*{.final.} = object # This is a numeric value corresponding to the current error + TError*{.final.} = object # This is a numeric value corresponding to the current error # SDL_rwops.h types # This is the read/write operation structure -- very basic # some helper types to handle the unions @@ -824,7 +824,7 @@ type interval*: int32 callback*: TNewTimerCallback param*: pointer - last_alarm*: int32 + lastAlarm*: int32 next*: PTimerID TAudioSpecCallback* = proc (userdata: pointer, stream: ptr byte, length: int){. @@ -833,11 +833,11 @@ type PAudioSpec* = ptr TAudioSpec TAudioSpec*{.final.} = object # A structure to hold a set of audio conversion filters and buffers freq*: int # DSP frequency -- samples per second - format*: uInt16 # Audio data format + format*: uint16 # Audio data format channels*: byte # Number of channels: 1 mono, 2 stereo silence*: byte # Audio buffer silence value (calculated) - samples*: uInt16 # Audio buffer size in samples - padding*: uInt16 # Necessary for some compile environments + samples*: uint16 # Audio buffer size in samples + padding*: uint16 # Necessary for some compile environments size*: int32 # Audio buffer size in bytes (calculated) # This function is called when the audio device needs more data. # 'stream' is a pointer to the audio data buffer @@ -857,16 +857,16 @@ type TAudioCVTFilterArray* = array[0..9, PAudioCVTFilter] TAudioCVT*{.final.} = object needed*: int # Set to 1 if conversion possible - src_format*: uint16 # Source audio format - dst_format*: uint16 # Target audio format - rate_incr*: float64 # Rate conversion increment + srcFormat*: uint16 # Source audio format + dstFormat*: uint16 # Target audio format + rateIncr*: float64 # Rate conversion increment buf*: ptr byte # Buffer to hold entire audio data length*: int # Length of original audio buffer - len_cvt*: int # Length of converted audio buffer - len_mult*: int # buffer must be len*len_mult big - len_ratio*: float64 # Given len, final size is len*len_ratio + lenCvt*: int # Length of converted audio buffer + lenMult*: int # buffer must be len*len_mult big + lenRatio*: float64 # Given len, final size is len*len_ratio filters*: TAudioCVTFilterArray - filter_index*: int # Current audio conversion function + filterIndex*: int # Current audio conversion function TAudiostatus* = enum # SDL_cdrom.h types AUDIO_STOPPED, AUDIO_PLAYING, AUDIO_PAUSED @@ -886,8 +886,8 @@ type status*: TCDStatus # Current drive status # The rest of this structure is only valid if there's a CD in drive numtracks*: int # Number of tracks on disk - cur_track*: int # Current track position - cur_frame*: int # Current frame offset within current track + curTrack*: int # Current track position + curFrame*: int # Current frame offset within current track track*: array[0..MAX_TRACKS, TCDTrack] PTransAxis* = ptr TTransAxis @@ -895,7 +895,7 @@ type offset*: int scale*: float32 - PJoystick_hwdata* = ptr TJoystick_hwdata + PJoystickHwdata* = ptr TJoystickHwdata TJoystick_hwdata*{.final.} = object # joystick ID id*: int # values used to translate device-specific coordinates into SDL-standard ranges transaxis*: array[0..5, TTransAxis] @@ -918,8 +918,8 @@ type balls*: PBallDelta # Current ball motion deltas nbuttons*: int # Number of buttons on the joystick buttons*: ptr byte # Current button states - hwdata*: PJoystick_hwdata # Driver dependent information - ref_count*: int # Reference count for multiple opens + hwdata*: PJoystickHwdata # Driver dependent information + refCount*: int # Reference count for multiple opens Pversion* = ptr Tversion Tversion*{.final.} = object # SDL_keyboard.h types @@ -1051,7 +1051,7 @@ when defined(WINDOWS): version*: Tversion hwnd*: THandle # The window for the message msg*: int # The type of message - w_Param*: int32 # WORD message parameter + wParam*: int32 # WORD message parameter lParam*: int32 # LONG message parameter elif defined(Unix): @@ -1155,34 +1155,34 @@ type PPixelFormat* = ptr TPixelFormat TPixelFormat*{.final.} = object # The structure passed to the low level blit functions palette*: PPalette - BitsPerPixel*: byte - BytesPerPixel*: byte - Rloss*: byte - Gloss*: byte - Bloss*: byte - Aloss*: byte - Rshift*: byte - Gshift*: byte - Bshift*: byte - Ashift*: byte - RMask*: int32 - GMask*: int32 - BMask*: int32 - AMask*: int32 + bitsPerPixel*: byte + bytesPerPixel*: byte + rloss*: byte + gloss*: byte + bloss*: byte + aloss*: byte + rshift*: byte + gshift*: byte + bshift*: byte + ashift*: byte + rMask*: int32 + gMask*: int32 + bMask*: int32 + aMask*: int32 colorkey*: int32 # RGB color key information alpha*: byte # Alpha value information (per-surface alpha) PBlitInfo* = ptr TBlitInfo TBlitInfo*{.final.} = object # typedef for private surface blitting functions - s_pixels*: ptr byte - s_width*: int - s_height*: int - s_skip*: int - d_pixels*: ptr byte - d_width*: int - d_height*: int - d_skip*: int - aux_data*: pointer + sPixels*: ptr byte + sWidth*: int + sHeight*: int + sSkip*: int + dPixels*: ptr byte + dWidth*: int + dHeight*: int + dSkip*: int + auxData*: pointer src*: PPixelFormat table*: ptr byte dst*: PPixelFormat @@ -1199,25 +1199,25 @@ type offset*: cint # Private hwdata*: pointer #TPrivate_hwdata; Hardware-specific surface info # clipping information: - clip_rect*: TRect # Read-only + clipRect*: TRect # Read-only unused1*: int32 # for binary compatibility # Allow recursive locks locked*: int32 # Private # info for fast blit mapping to other surfaces - Blitmap*: pointer # PSDL_BlitMap; // Private + blitmap*: pointer # PSDL_BlitMap; // Private # format version, bumped at every change to invalidate blit maps - format_version*: cint # Private + formatVersion*: cint # Private refcount*: cint PVideoInfo* = ptr TVideoInfo TVideoInfo*{.final.} = object # The YUV hardware video overlay - hw_available*: byte - blit_hw*: byte - UnusedBits3*: byte # Unused at this point - video_mem*: int32 # The total amount of video memory (in K) + hwAvailable*: byte + blitHw*: byte + unusedBits3*: byte # Unused at this point + videoMem*: int32 # The total amount of video memory (in K) vfmt*: PPixelFormat # Value: The format of the video surface - current_w*: int32 # Value: The current video mode width - current_h*: int32 # Value: The current video mode height + currentW*: int32 # Value: The current video mode width + currentH*: int32 # Value: The current video mode height POverlay* = ptr TOverlay TOverlay*{.final.} = object # Public enumeration for setting the OpenGL window attributes. @@ -1226,7 +1226,7 @@ type planes*: int # Number of planes in the overlay. Usually either 1 or 3 pitches*: PUInt16 # An array of pitches, one for each plane. Pitch is the length of a row in bytes. pixels*: ptr ptr byte # An array of pointers to the data of each plane. The overlay should be locked before these pointers are used. - hw_overlay*: int32 # This will be set to 1 if the overlay is hardware accelerated. + hwOverlay*: int32 # This will be set to 1 if the overlay is hardware accelerated. TGLAttr* = enum GL_RED_SIZE, GL_GREEN_SIZE, GL_BLUE_SIZE, GL_ALPHA_SIZE, GL_BUFFER_SIZE, @@ -1237,11 +1237,11 @@ type PCursor* = ptr TCursor TCursor*{.final.} = object # SDL_mutex.h types area*: TRect # The area of the mouse cursor - hot_x*, hot_y*: int16 # The "tip" of the cursor + hotX*, hot_y*: int16 # The "tip" of the cursor data*: ptr byte # B/W cursor data mask*: ptr byte # B/W cursor mask save*: array[1..2, ptr byte] # Place to save cursor area - wm_cursor*: pointer # Window-manager cursor + wmCursor*: pointer # Window-manager cursor type @@ -1250,7 +1250,7 @@ type Psemaphore* = ptr Tsemaphore Tsemaphore*{.final.} = object PSem* = ptr TSem - TSem* = TSemaphore + TSem* = Tsemaphore PCond* = ptr TCond TCond*{.final.} = object # SDL_thread.h types @@ -1267,7 +1267,7 @@ type # This is the system-independent thread info struc threadid*: int32 handle*: TSYS_ThreadHandle status*: int - errbuf*: TError + errbuf*: Terror data*: pointer PKeyStateArr* = ptr TKeyStateArr @@ -1282,7 +1282,7 @@ type # This is the system-independent thread info struc TWordArray* = array[0..16383, int16] # Generic procedure pointer type TEventSeq = set[TEventKind] -template evconv(procName: expr, ptrName: typeDesc, assertions: TEventSeq): stmt {.immediate.} = +template evconv(procName: expr, ptrName: typedesc, assertions: TEventSeq): stmt {.immediate.} = proc `procName`*(event: PEvent): ptrName = assert(contains(assertions, event.kind)) result = cast[ptrName](event) @@ -1309,73 +1309,72 @@ evconv(EvSysWM, PSysWMEvent, {SYSWMEVENT}) # Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup # signal handlers for some commonly ignored fatal signals (like SIGSEGV) -proc Init*(flags: int32): int{.cdecl, importc: "SDL_Init", dynlib: LibName.} +proc init*(flags: int32): int{.cdecl, importc: "SDL_Init", dynlib: LibName.} # This function initializes specific SDL subsystems -proc InitSubSystem*(flags: int32): int{.cdecl, importc: "SDL_InitSubSystem", +proc initSubSystem*(flags: int32): int{.cdecl, importc: "SDL_InitSubSystem", dynlib: LibName.} # This function cleans up specific SDL subsystems -proc QuitSubSystem*(flags: int32){.cdecl, importc: "SDL_QuitSubSystem", +proc quitSubSystem*(flags: int32){.cdecl, importc: "SDL_QuitSubSystem", dynlib: LibName.} # This function returns mask of the specified subsystems which have # been initialized. # If 'flags' is 0, it returns a mask of all initialized subsystems. -proc WasInit*(flags: int32): int32{.cdecl, importc: "SDL_WasInit", +proc wasInit*(flags: int32): int32{.cdecl, importc: "SDL_WasInit", dynlib: LibName.} # This function cleans up all initialized subsystems and unloads the # dynamically linked library. You should call it upon all exit conditions. -proc Quit*(){.cdecl, importc: "SDL_Quit", dynlib: LibName.} +proc quit*(){.cdecl, importc: "SDL_Quit", dynlib: LibName.} when defined(WINDOWS): # This should be called from your WinMain() function, if any - proc RegisterApp*(name: cstring, style: int32, h_Inst: pointer): int{.cdecl, + proc registerApp*(name: cstring, style: int32, hInst: pointer): int{.cdecl, importc: "SDL_RegisterApp", dynlib: LibName.} -proc TableSize*(table: cstring): int +proc tableSize*(table: cstring): int #------------------------------------------------------------------------------ # error-handling #------------------------------------------------------------------------------ # Public functions -proc GetError*(): cstring{.cdecl, importc: "SDL_GetError", dynlib: LibName.} -proc SetError*(fmt: cstring){.cdecl, importc: "SDL_SetError", dynlib: LibName.} -proc ClearError*(){.cdecl, importc: "SDL_ClearError", dynlib: LibName.} -when not (defined(WINDOWS)): - proc Error*(Code: Terrorcode){.cdecl, importc: "SDL_Error", dynlib: LibName.} -proc OutOfMemory*() +proc getError*(): cstring{.cdecl, importc: "SDL_GetError", dynlib: LibName.} +proc setError*(fmt: cstring){.cdecl, importc: "SDL_SetError", dynlib: LibName.} +proc clearError*(){.cdecl, importc: "SDL_ClearError", dynlib: LibName.} +when not (defined(WINDOWS)): + proc error*(Code: Terrorcode){.cdecl, importc: "SDL_Error", dynlib: LibName.} #------------------------------------------------------------------------------ # io handling #------------------------------------------------------------------------------ # Functions to create SDL_RWops structures from various data sources -proc RWFromFile*(filename, mode: cstring): PRWops{.cdecl, +proc rwFromFile*(filename, mode: cstring): PRWops{.cdecl, importc: "SDL_RWFromFile", dynlib: LibName.} -proc FreeRW*(area: PRWops){.cdecl, importc: "SDL_FreeRW", dynlib: LibName.} +proc freeRW*(area: PRWops){.cdecl, importc: "SDL_FreeRW", dynlib: LibName.} #fp is FILE *fp ??? -proc RWFromFP*(fp: pointer, autoclose: int): PRWops{.cdecl, +proc rwFromFP*(fp: pointer, autoclose: int): PRWops{.cdecl, importc: "SDL_RWFromFP", dynlib: LibName.} -proc RWFromMem*(mem: pointer, size: int): PRWops{.cdecl, +proc rwFromMem*(mem: pointer, size: int): PRWops{.cdecl, importc: "SDL_RWFromMem", dynlib: LibName.} -proc RWFromConstMem*(mem: pointer, size: int): PRWops{.cdecl, +proc rwFromConstMem*(mem: pointer, size: int): PRWops{.cdecl, importc: "SDL_RWFromConstMem", dynlib: LibName.} -proc AllocRW*(): PRWops{.cdecl, importc: "SDL_AllocRW", dynlib: LibName.} -proc RWSeek*(context: PRWops, offset: int, whence: int): int -proc RWTell*(context: PRWops): int -proc RWRead*(context: PRWops, theptr: pointer, size: int, n: int): int -proc RWWrite*(context: PRWops, theptr: pointer, size: int, n: int): int -proc RWClose*(context: PRWops): int +proc allocRW*(): PRWops{.cdecl, importc: "SDL_AllocRW", dynlib: LibName.} +proc rwSeek*(context: PRWops, offset: int, whence: int): int +proc rwTell*(context: PRWops): int +proc rwRead*(context: PRWops, theptr: pointer, size: int, n: int): int +proc rwWrite*(context: PRWops, theptr: pointer, size: int, n: int): int +proc rwClose*(context: PRWops): int #------------------------------------------------------------------------------ # time-handling #------------------------------------------------------------------------------ # Get the number of milliseconds since the SDL library initialization. # Note that this value wraps if the program runs for more than ~49 days. -proc GetTicks*(): int32{.cdecl, importc: "SDL_GetTicks", dynlib: LibName.} +proc getTicks*(): int32{.cdecl, importc: "SDL_GetTicks", dynlib: LibName.} # Wait a specified number of milliseconds before returning -proc Delay*(msec: int32){.cdecl, importc: "SDL_Delay", dynlib: LibName.} +proc delay*(msec: int32){.cdecl, importc: "SDL_Delay", dynlib: LibName.} # Add a new timer to the pool of timers already running. # Returns a timer ID, or NULL when an error occurs. -proc AddTimer*(interval: int32, callback: TNewTimerCallback, param: pointer): PTimerID{. +proc addTimer*(interval: int32, callback: TNewTimerCallback, param: pointer): PTimerID{. cdecl, importc: "SDL_AddTimer", dynlib: LibName.} # Remove one of the multiple timers knowing its ID. # Returns a boolean value indicating success. -proc RemoveTimer*(t: PTimerID): TBool{.cdecl, importc: "SDL_RemoveTimer", +proc removeTimer*(t: PTimerID): TBool{.cdecl, importc: "SDL_RemoveTimer", dynlib: LibName.} -proc SetTimer*(interval: int32, callback: TTimerCallback): int{.cdecl, +proc setTimer*(interval: int32, callback: TTimerCallback): int{.cdecl, importc: "SDL_SetTimer", dynlib: LibName.} #------------------------------------------------------------------------------ # audio-routines @@ -1383,13 +1382,13 @@ proc SetTimer*(interval: int32, callback: TTimerCallback): int{.cdecl, # These functions are used internally, and should not be used unless you # have a specific need to specify the audio driver you want to use. # You should normally use SDL_Init() or SDL_InitSubSystem(). -proc AudioInit*(driver_name: cstring): int{.cdecl, importc: "SDL_AudioInit", +proc audioInit*(driverName: cstring): int{.cdecl, importc: "SDL_AudioInit", dynlib: LibName.} -proc AudioQuit*(){.cdecl, importc: "SDL_AudioQuit", dynlib: LibName.} +proc audioQuit*(){.cdecl, importc: "SDL_AudioQuit", dynlib: LibName.} # This function fills the given character buffer with the name of the # current audio driver, and returns a pointer to it if the audio driver has # been initialized. It returns NULL if no driver has been initialized. -proc AudioDriverName*(namebuf: cstring, maxlen: int): cstring{.cdecl, +proc audioDriverName*(namebuf: cstring, maxlen: int): cstring{.cdecl, importc: "SDL_AudioDriverName", dynlib: LibName.} # This function opens the audio device with the desired parameters, and # returns 0 if successful, placing the actual hardware parameters in the @@ -1430,17 +1429,17 @@ proc AudioDriverName*(namebuf: cstring, maxlen: int): cstring{.cdecl, # for your audio callback function to be called. Since the audio driver # may modify the requested size of the audio buffer, you should allocate # any local mixing buffers after you open the audio device. -proc OpenAudio*(desired, obtained: PAudioSpec): int{.cdecl, +proc openAudio*(desired, obtained: PAudioSpec): int{.cdecl, importc: "SDL_OpenAudio", dynlib: LibName.} # Get the current audio state: -proc GetAudioStatus*(): TAudiostatus{.cdecl, importc: "SDL_GetAudioStatus", +proc getAudioStatus*(): TAudiostatus{.cdecl, importc: "SDL_GetAudioStatus", dynlib: LibName.} # This function pauses and unpauses the audio callback processing. # It should be called with a parameter of 0 after opening the audio # device to start playing sound. This is so you can safely initialize # data for your callback function after opening the audio device. # Silence will be written to the audio device during the pause. -proc PauseAudio*(pause_on: int){.cdecl, importc: "SDL_PauseAudio", +proc pauseAudio*(pauseOn: int){.cdecl, importc: "SDL_PauseAudio", dynlib: LibName.} # This function loads a WAVE from the data source, automatically freeing # that source if 'freesrc' is non-zero. For example, to load a WAVE file, @@ -1457,22 +1456,22 @@ proc PauseAudio*(pause_on: int){.cdecl, importc: "SDL_PauseAudio", # This function returns NULL and sets the SDL error message if the # wave file cannot be opened, uses an unknown data format, or is # corrupt. Currently raw and MS-ADPCM WAVE files are supported. -proc LoadWAV_RW*(src: PRWops, freesrc: int, spec: PAudioSpec, audio_buf: ptr byte, +proc loadWAV_RW*(src: PRWops, freesrc: int, spec: PAudioSpec, audioBuf: ptr byte, audiolen: PUInt32): PAudioSpec{.cdecl, importc: "SDL_LoadWAV_RW", dynlib: LibName.} # Compatibility convenience function -- loads a WAV from a file -proc LoadWAV*(filename: cstring, spec: PAudioSpec, audio_buf: ptr byte, +proc loadWAV*(filename: cstring, spec: PAudioSpec, audioBuf: ptr byte, audiolen: PUInt32): PAudioSpec # This function frees data previously allocated with SDL_LoadWAV_RW() -proc FreeWAV*(audio_buf: ptr byte){.cdecl, importc: "SDL_FreeWAV", dynlib: LibName.} +proc freeWAV*(audioBuf: ptr byte){.cdecl, importc: "SDL_FreeWAV", dynlib: LibName.} # This function takes a source format and rate and a destination format # and rate, and initializes the 'cvt' structure with information needed # by SDL_ConvertAudio() to convert a buffer of audio data from one format # to the other. # This function returns 0, or -1 if there was an error. -proc BuildAudioCVT*(cvt: PAudioCVT, src_format: uint16, src_channels: byte, - src_rate: int, dst_format: uint16, dst_channels: byte, - dst_rate: int): int{.cdecl, importc: "SDL_BuildAudioCVT", +proc buildAudioCVT*(cvt: PAudioCVT, srcFormat: uint16, srcChannels: byte, + srcRate: int, dstFormat: uint16, dstChannels: byte, + dstRate: int): int{.cdecl, importc: "SDL_BuildAudioCVT", dynlib: LibName.} # Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(), # created an audio buffer cvt->buf, and filled it with cvt->len bytes of @@ -1481,45 +1480,45 @@ proc BuildAudioCVT*(cvt: PAudioCVT, src_format: uint16, src_channels: byte, # The data conversion may expand the size of the audio data, so the buffer # cvt->buf should be allocated after the cvt structure is initialized by # SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long. -proc ConvertAudio*(cvt: PAudioCVT): int{.cdecl, importc: "SDL_ConvertAudio", +proc convertAudio*(cvt: PAudioCVT): int{.cdecl, importc: "SDL_ConvertAudio", dynlib: LibName.} # This takes two audio buffers of the playing audio format and mixes # them, performing addition, volume adjustment, and overflow clipping. # The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME # for full audio volume. Note this does not change hardware volume. # This is provided for convenience -- you can mix your own audio data. -proc MixAudio*(dst, src: ptr byte, length: int32, volume: int){.cdecl, +proc mixAudio*(dst, src: ptr byte, length: int32, volume: int){.cdecl, importc: "SDL_MixAudio", dynlib: LibName.} # The lock manipulated by these functions protects the callback function. # During a LockAudio/UnlockAudio pair, you can be guaranteed that the # callback function is not running. Do not call these from the callback # function or you will cause deadlock. -proc LockAudio*(){.cdecl, importc: "SDL_LockAudio", dynlib: LibName.} -proc UnlockAudio*(){.cdecl, importc: "SDL_UnlockAudio", dynlib: LibName.} +proc lockAudio*(){.cdecl, importc: "SDL_LockAudio", dynlib: LibName.} +proc unlockAudio*(){.cdecl, importc: "SDL_UnlockAudio", dynlib: LibName.} # This function shuts down audio processing and closes the audio device. -proc CloseAudio*(){.cdecl, importc: "SDL_CloseAudio", dynlib: LibName.} +proc closeAudio*(){.cdecl, importc: "SDL_CloseAudio", dynlib: LibName.} #------------------------------------------------------------------------------ # CD-routines #------------------------------------------------------------------------------ # Returns the number of CD-ROM drives on the system, or -1 if # SDL_Init() has not been called with the SDL_INIT_CDROM flag. -proc CDNumDrives*(): int{.cdecl, importc: "SDL_CDNumDrives", dynlib: LibName.} +proc cdNumDrives*(): int{.cdecl, importc: "SDL_CDNumDrives", dynlib: LibName.} # Returns a human-readable, system-dependent identifier for the CD-ROM. # Example: # "/dev/cdrom" # "E:" # "/dev/disk/ide/1/master" -proc CDName*(drive: int): cstring{.cdecl, importc: "SDL_CDName", dynlib: LibName.} +proc cdName*(drive: int): cstring{.cdecl, importc: "SDL_CDName", dynlib: LibName.} # Opens a CD-ROM drive for access. It returns a drive handle on success, # or NULL if the drive was invalid or busy. This newly opened CD-ROM # becomes the default CD used when other CD functions are passed a NULL # CD-ROM handle. # Drives are numbered starting with 0. Drive 0 is the system default CD-ROM. -proc CDOpen*(drive: int): PCD{.cdecl, importc: "SDL_CDOpen", dynlib: LibName.} +proc cdOpen*(drive: int): PCD{.cdecl, importc: "SDL_CDOpen", dynlib: LibName.} # This function returns the current status of the given drive. # If the drive has a CD in it, the table of contents of the CD and current # play position of the CD will be stored in the SDL_CD structure. -proc CDStatus*(cdrom: PCD): TCDStatus{.cdecl, importc: "SDL_CDStatus", +proc cdStatus*(cdrom: PCD): TCDStatus{.cdecl, importc: "SDL_CDStatus", dynlib: LibName.} # Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' # tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play @@ -1542,95 +1541,89 @@ proc CDStatus*(cdrom: PCD): TCDStatus{.cdecl, importc: "SDL_CDStatus", # SDL_CDPlayTracks(cdrom, 0, 0, 2, 10); # # This function returns 0, or -1 if there was an error. -proc CDPlayTracks*(cdrom: PCD, start_track: int, start_frame: int, ntracks: int, +proc cdPlayTracks*(cdrom: PCD, startTrack: int, startFrame: int, ntracks: int, nframes: int): int{.cdecl, importc: "SDL_CDPlayTracks", dynlib: LibName.} # Play the given CD starting at 'start' frame for 'length' frames. # It returns 0, or -1 if there was an error. -proc CDPlay*(cdrom: PCD, start: int, len: int): int{.cdecl, +proc cdPlay*(cdrom: PCD, start: int, len: int): int{.cdecl, importc: "SDL_CDPlay", dynlib: LibName.} # Pause play -- returns 0, or -1 on error -proc CDPause*(cdrom: PCD): int{.cdecl, importc: "SDL_CDPause", dynlib: LibName.} +proc cdPause*(cdrom: PCD): int{.cdecl, importc: "SDL_CDPause", dynlib: LibName.} # Resume play -- returns 0, or -1 on error -proc CDResume*(cdrom: PCD): int{.cdecl, importc: "SDL_CDResume", dynlib: LibName.} +proc cdResume*(cdrom: PCD): int{.cdecl, importc: "SDL_CDResume", dynlib: LibName.} # Stop play -- returns 0, or -1 on error -proc CDStop*(cdrom: PCD): int{.cdecl, importc: "SDL_CDStop", dynlib: LibName.} +proc cdStop*(cdrom: PCD): int{.cdecl, importc: "SDL_CDStop", dynlib: LibName.} # Eject CD-ROM -- returns 0, or -1 on error -proc CDEject*(cdrom: PCD): int{.cdecl, importc: "SDL_CDEject", dynlib: LibName.} +proc cdEject*(cdrom: PCD): int{.cdecl, importc: "SDL_CDEject", dynlib: LibName.} # Closes the handle for the CD-ROM drive -proc CDClose*(cdrom: PCD){.cdecl, importc: "SDL_CDClose", dynlib: LibName.} +proc cdClose*(cdrom: PCD){.cdecl, importc: "SDL_CDClose", dynlib: LibName.} # Given a status, returns true if there's a disk in the drive -proc CDInDrive*(status: TCDStatus): bool - # Conversion functions from frames to Minute/Second/Frames and vice versa -proc FRAMES_TO_MSF*(frames: int, M: var int, S: var int, F: var int) -proc MSF_TO_FRAMES*(M: int, S: int, F: int): int - #------------------------------------------------------------------------------ - # JoyStick-routines - #------------------------------------------------------------------------------ - # Count the number of joysticks attached to the system -proc NumJoysticks*(): int{.cdecl, importc: "SDL_NumJoysticks", dynlib: LibName.} +proc cdInDrive*(status: TCDStatus): bool + +proc numJoysticks*(): int{.cdecl, importc: "SDL_NumJoysticks", dynlib: LibName.} # Get the implementation dependent name of a joystick. # This can be called before any joysticks are opened. # If no name can be found, this function returns NULL. -proc JoystickName*(index: int): cstring{.cdecl, importc: "SDL_JoystickName", +proc joystickName*(index: int): cstring{.cdecl, importc: "SDL_JoystickName", dynlib: LibName.} # Open a joystick for use - the index passed as an argument refers to # the N'th joystick on the system. This index is the value which will # identify this joystick in future joystick events. # # This function returns a joystick identifier, or NULL if an error occurred. -proc JoystickOpen*(index: int): PJoystick{.cdecl, importc: "SDL_JoystickOpen", +proc joystickOpen*(index: int): PJoystick{.cdecl, importc: "SDL_JoystickOpen", dynlib: LibName.} # Returns 1 if the joystick has been opened, or 0 if it has not. -proc JoystickOpened*(index: int): int{.cdecl, importc: "SDL_JoystickOpened", +proc joystickOpened*(index: int): int{.cdecl, importc: "SDL_JoystickOpened", dynlib: LibName.} # Get the device index of an opened joystick. -proc JoystickIndex*(joystick: PJoystick): int{.cdecl, +proc joystickIndex*(joystick: PJoystick): int{.cdecl, importc: "SDL_JoystickIndex", dynlib: LibName.} # Get the number of general axis controls on a joystick -proc JoystickNumAxes*(joystick: PJoystick): int{.cdecl, +proc joystickNumAxes*(joystick: PJoystick): int{.cdecl, importc: "SDL_JoystickNumAxes", dynlib: LibName.} # Get the number of trackballs on a joystick # Joystick trackballs have only relative motion events associated # with them and their state cannot be polled. -proc JoystickNumBalls*(joystick: PJoystick): int{.cdecl, +proc joystickNumBalls*(joystick: PJoystick): int{.cdecl, importc: "SDL_JoystickNumBalls", dynlib: LibName.} # Get the number of POV hats on a joystick -proc JoystickNumHats*(joystick: PJoystick): int{.cdecl, +proc joystickNumHats*(joystick: PJoystick): int{.cdecl, importc: "SDL_JoystickNumHats", dynlib: LibName.} # Get the number of buttons on a joystick -proc JoystickNumButtons*(joystick: PJoystick): int{.cdecl, +proc joystickNumButtons*(joystick: PJoystick): int{.cdecl, importc: "SDL_JoystickNumButtons", dynlib: LibName.} # Update the current state of the open joysticks. # This is called automatically by the event loop if any joystick # events are enabled. -proc JoystickUpdate*(){.cdecl, importc: "SDL_JoystickUpdate", dynlib: LibName.} +proc joystickUpdate*(){.cdecl, importc: "SDL_JoystickUpdate", dynlib: LibName.} # Enable/disable joystick event polling. # If joystick events are disabled, you must call SDL_JoystickUpdate() # yourself and check the state of the joystick when you want joystick # information. # The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. -proc JoystickEventState*(state: int): int{.cdecl, +proc joystickEventState*(state: int): int{.cdecl, importc: "SDL_JoystickEventState", dynlib: LibName.} # Get the current state of an axis control on a joystick # The state is a value ranging from -32768 to 32767. # The axis indices start at index 0. -proc JoystickGetAxis*(joystick: PJoystick, axis: int): int16{.cdecl, +proc joystickGetAxis*(joystick: PJoystick, axis: int): int16{.cdecl, importc: "SDL_JoystickGetAxis", dynlib: LibName.} # The hat indices start at index 0. -proc JoystickGetHat*(joystick: PJoystick, hat: int): byte{.cdecl, +proc joystickGetHat*(joystick: PJoystick, hat: int): byte{.cdecl, importc: "SDL_JoystickGetHat", dynlib: LibName.} # Get the ball axis change since the last poll # This returns 0, or -1 if you passed it invalid parameters. # The ball indices start at index 0. -proc JoystickGetBall*(joystick: PJoystick, ball: int, dx: var int, dy: var int): int{. +proc joystickGetBall*(joystick: PJoystick, ball: int, dx: var int, dy: var int): int{. cdecl, importc: "SDL_JoystickGetBall", dynlib: LibName.} # Get the current state of a button on a joystick # The button indices start at index 0. -proc JoystickGetButton*(joystick: PJoystick, Button: int): byte{.cdecl, +proc joystickGetButton*(joystick: PJoystick, button: int): byte{.cdecl, importc: "SDL_JoystickGetButton", dynlib: LibName.} # Close a joystick previously opened with SDL_JoystickOpen() -proc JoystickClose*(joystick: PJoystick){.cdecl, importc: "SDL_JoystickClose", +proc joystickClose*(joystick: PJoystick){.cdecl, importc: "SDL_JoystickClose", dynlib: LibName.} #------------------------------------------------------------------------------ # event-handling @@ -1638,7 +1631,7 @@ proc JoystickClose*(joystick: PJoystick){.cdecl, importc: "SDL_JoystickClose", # Pumps the event loop, gathering events from the input devices. # This function updates the event queue and internal input device state. # This should only be run in the thread that sets the video mode. -proc PumpEvents*(){.cdecl, importc: "SDL_PumpEvents", dynlib: LibName.} +proc pumpEvents*(){.cdecl, importc: "SDL_PumpEvents", dynlib: LibName.} # Checks the event queue for messages and optionally returns them. # If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to # the back of the event queue. @@ -1650,20 +1643,20 @@ proc PumpEvents*(){.cdecl, importc: "SDL_PumpEvents", dynlib: LibName.} # removed from the queue. # This function returns the number of events actually stored, or -1 # if there was an error. This function is thread-safe. -proc PeepEvents*(events: PEvent, numevents: int, action: Teventaction, +proc peepEvents*(events: PEvent, numevents: int, action: TEventAction, mask: int32): int{.cdecl, importc: "SDL_PeepEvents", dynlib: LibName.} # Polls for currently pending events, and returns 1 if there are any pending # events, or 0 if there are none available. If 'event' is not NULL, the next # event is removed from the queue and stored in that area. -proc PollEvent*(event: PEvent): int{.cdecl, importc: "SDL_PollEvent", +proc pollEvent*(event: PEvent): int{.cdecl, importc: "SDL_PollEvent", dynlib: LibName.} # Waits indefinitely for the next available event, returning 1, or 0 if there # was an error while waiting for events. If 'event' is not NULL, the next # event is removed from the queue and stored in that area. -proc WaitEvent*(event: PEvent): int{.cdecl, importc: "SDL_WaitEvent", +proc waitEvent*(event: PEvent): int{.cdecl, importc: "SDL_WaitEvent", dynlib: LibName.} -proc PushEvent*(event: PEvent): int{.cdecl, importc: "SDL_PushEvent", +proc pushEvent*(event: PEvent): int{.cdecl, importc: "SDL_PushEvent", dynlib: LibName.} # If the filter returns 1, then the event will be added to the internal queue. # If it returns 0, then the event will be dropped from the queue, but the @@ -1679,11 +1672,11 @@ proc PushEvent*(event: PEvent): int{.cdecl, importc: "SDL_PushEvent", # be closed, otherwise the window will remain open if possible. # If the quit event is generated by an interrupt signal, it will bypass the # internal queue and be delivered to the application at the next event poll. -proc SetEventFilter*(filter: TEventFilter){.cdecl, +proc setEventFilter*(filter: TEventFilter){.cdecl, importc: "SDL_SetEventFilter", dynlib: LibName.} # Return the current event filter - can be used to "chain" filters. # If there is no event filter set, this function returns NULL. -proc GetEventFilter*(): TEventFilter{.cdecl, importc: "SDL_GetEventFilter", +proc getEventFilter*(): TEventFilter{.cdecl, importc: "SDL_GetEventFilter", dynlib: LibName.} # This function allows you to set the state of processing certain events. # If 'state' is set to SDL_IGNORE, that event will be automatically dropped @@ -1691,26 +1684,26 @@ proc GetEventFilter*(): TEventFilter{.cdecl, importc: "SDL_GetEventFilter", # If 'state' is set to SDL_ENABLE, that event will be processed normally. # If 'state' is set to SDL_QUERY, SDL_EventState() will return the # current processing state of the specified event. -proc EventState*(theType: byte, state: int): byte{.cdecl, +proc eventState*(theType: byte, state: int): byte{.cdecl, importc: "SDL_EventState", dynlib: LibName.} #------------------------------------------------------------------------------ # Version Routines #------------------------------------------------------------------------------ # This macro can be used to fill a version structure with the compile-time # version of the SDL library. -proc VERSION*(X: var TVersion) +proc version*(x: var Tversion) # This macro turns the version numbers into a numeric value: # (1,2,3) -> (1203) # This assumes that there will never be more than 100 patchlevels -proc VERSIONNUM*(X, Y, Z: int): int +proc versionnum*(x, y, z: int): int # This is the version number macro for the current SDL version -proc COMPILEDVERSION*(): int +proc compiledversion*(): int # This macro will evaluate to true if compiled with SDL at least X.Y.Z -proc VERSION_ATLEAST*(X: int, Y: int, Z: int): bool +proc versionAtleast*(x, y, z: int): bool # This function gets the version of the dynamically linked SDL library. # it should NOT be used to fill a version structure, instead you should # use the SDL_Version() macro. -proc Linked_Version*(): Pversion{.cdecl, importc: "SDL_Linked_Version", +proc linkedVersion*(): PVersion{.cdecl, importc: "SDL_Linked_Version", dynlib: LibName.} #------------------------------------------------------------------------------ # video @@ -1727,25 +1720,25 @@ proc Linked_Version*(): Pversion{.cdecl, importc: "SDL_Linked_Version", # If you use both sound and video in your application, you need to call # SDL_Init() before opening the sound device, otherwise under Win32 DirectX, # you won't be able to set full-screen display modes. -proc VideoInit*(driver_name: cstring, flags: int32): int{.cdecl, +proc videoInit*(driverName: cstring, flags: int32): int{.cdecl, importc: "SDL_VideoInit", dynlib: LibName.} -proc VideoQuit*(){.cdecl, importc: "SDL_VideoQuit", dynlib: LibName.} +proc videoQuit*(){.cdecl, importc: "SDL_VideoQuit", dynlib: LibName.} # This function fills the given character buffer with the name of the # video driver, and returns a pointer to it if the video driver has # been initialized. It returns NULL if no driver has been initialized. -proc VideoDriverName*(namebuf: cstring, maxlen: int): cstring{.cdecl, +proc videoDriverName*(namebuf: cstring, maxlen: int): cstring{.cdecl, importc: "SDL_VideoDriverName", dynlib: LibName.} # This function returns a pointer to the current display surface. # If SDL is doing format conversion on the display surface, this # function returns the publicly visible surface, not the real video # surface. -proc GetVideoSurface*(): PSurface{.cdecl, importc: "SDL_GetVideoSurface", +proc getVideoSurface*(): PSurface{.cdecl, importc: "SDL_GetVideoSurface", dynlib: LibName.} # This function returns a read-only pointer to information about the # video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' # member of the returned structure will contain the pixel format of the # "best" video mode. -proc GetVideoInfo*(): PVideoInfo{.cdecl, importc: "SDL_GetVideoInfo", +proc getVideoInfo*(): PVideoInfo{.cdecl, importc: "SDL_GetVideoInfo", dynlib: LibName.} # Check to see if a particular video mode is supported. # It returns 0 if the requested mode is not supported under any bit depth, @@ -1756,7 +1749,7 @@ proc GetVideoInfo*(): PVideoInfo{.cdecl, importc: "SDL_GetVideoInfo", # # The arguments to SDL_VideoModeOK() are the same ones you would pass to # SDL_SetVideoMode() -proc VideoModeOK*(width, height, bpp: int, flags: int32): int{.cdecl, +proc videoModeOK*(width, height, bpp: int, flags: int32): int{.cdecl, importc: "SDL_VideoModeOK", importc: "SDL_VideoModeOK", dynlib: LibName.} # Return a pointer to an array of available screen dimensions for the # given format and video flags, sorted largest to smallest. Returns @@ -1765,7 +1758,7 @@ proc VideoModeOK*(width, height, bpp: int, flags: int32): int{.cdecl, # # if 'format' is NULL, the mode list will be for the format given # by SDL_GetVideoInfo( ) - > vfmt -proc ListModes*(format: PPixelFormat, flags: int32): PPSDL_Rect{.cdecl, +proc listModes*(format: PPixelFormat, flags: int32): PPSDL_Rect{.cdecl, importc: "SDL_ListModes", dynlib: LibName.} # Set up a video mode with the specified width, height and bits-per-pixel. # @@ -1808,15 +1801,15 @@ proc ListModes*(format: PPixelFormat, flags: int32): PPSDL_Rect{.cdecl, # applications that redraw the entire screen on every update. # # This function returns the video framebuffer surface, or NULL if it fails. -proc SetVideoMode*(width, height, bpp: int, flags: uint32): PSurface{.cdecl, +proc setVideoMode*(width, height, bpp: int, flags: uint32): PSurface{.cdecl, importc: "SDL_SetVideoMode", dynlib: LibName.} # Makes sure the given list of rectangles is updated on the given screen. # If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire # screen. # These functions should not be called while 'screen' is locked. -proc UpdateRects*(screen: PSurface, numrects: int, rects: PRect){.cdecl, +proc updateRects*(screen: PSurface, numrects: int, rects: PRect){.cdecl, importc: "SDL_UpdateRects", dynlib: LibName.} -proc UpdateRect*(screen: PSurface, x, y: int32, w, h: int32){.cdecl, +proc updateRect*(screen: PSurface, x, y: int32, w, h: int32){.cdecl, importc: "SDL_UpdateRect", dynlib: LibName.} # On hardware that supports double-buffering, this function sets up a flip # and returns. The hardware will wait for vertical retrace, and then swap @@ -1826,14 +1819,14 @@ proc UpdateRect*(screen: PSurface, x, y: int32, w, h: int32){.cdecl, # The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when # setting the video mode for this function to perform hardware flipping. # This function returns 0 if successful, or -1 if there was an error. -proc Flip*(screen: PSurface): int{.cdecl, importc: "SDL_Flip", dynlib: LibName.} +proc flip*(screen: PSurface): int{.cdecl, importc: "SDL_Flip", dynlib: LibName.} # Set the gamma correction for each of the color channels. # The gamma values range (approximately) between 0.1 and 10.0 # # If this function isn't supported directly by the hardware, it will # be emulated using gamma ramps, if available. If successful, this # function returns 0, otherwise it returns -1. -proc SetGamma*(redgamma: float32, greengamma: float32, bluegamma: float32): int{. +proc setGamma*(redgamma: float32, greengamma: float32, bluegamma: float32): int{. cdecl, importc: "SDL_SetGamma", dynlib: LibName.} # Set the gamma translation table for the red, green, and blue channels # of the video hardware. Each table is an array of 256 16-bit quantities, @@ -1845,7 +1838,7 @@ proc SetGamma*(redgamma: float32, greengamma: float32, bluegamma: float32): int{ # If the call succeeds, it will return 0. If the display driver or # hardware does not support gamma translation, or otherwise fails, # this function will return -1. -proc SetGammaRamp*(redtable: PUInt16, greentable: PUInt16, bluetable: PUInt16): int{. +proc setGammaRamp*(redtable: PUInt16, greentable: PUInt16, bluetable: PUInt16): int{. cdecl, importc: "SDL_SetGammaRamp", dynlib: LibName.} # Retrieve the current values of the gamma translation tables. # @@ -1854,7 +1847,7 @@ proc SetGammaRamp*(redtable: PUInt16, greentable: PUInt16, bluetable: PUInt16): # If the call succeeds, it will return 0. If the display driver or # hardware does not support gamma translation, or otherwise fails, # this function will return -1. -proc GetGammaRamp*(redtable: PUInt16, greentable: PUInt16, bluetable: PUInt16): int{. +proc getGammaRamp*(redtable: PUInt16, greentable: PUInt16, bluetable: PUInt16): int{. cdecl, importc: "SDL_GetGammaRamp", dynlib: LibName.} # Sets a portion of the colormap for the given 8-bit surface. If 'surface' # is not a palettized surface, this function does nothing, returning 0. @@ -1869,7 +1862,7 @@ proc GetGammaRamp*(redtable: PUInt16, greentable: PUInt16, bluetable: PUInt16): # will always return 1, and the palette is guaranteed to be set the way # you desire, even if the window colormap has to be warped or run under # emulation. -proc SetColors*(surface: PSurface, colors: PColor, firstcolor: int, ncolors: int): int{. +proc setColors*(surface: PSurface, colors: PColor, firstcolor: int, ncolors: int): int{. cdecl, importc: "SDL_SetColors", dynlib: LibName.} # Sets a portion of the colormap for a given 8-bit surface. # 'flags' is one or both of: @@ -1885,20 +1878,20 @@ proc SetColors*(surface: PSurface, colors: PColor, firstcolor: int, ncolors: int # # SDL_SetColors() is equivalent to calling this function with # flags = (SDL_LOGPAL or SDL_PHYSPAL). -proc SetPalette*(surface: PSurface, flags: int, colors: PColor, firstcolor: int, +proc setPalette*(surface: PSurface, flags: int, colors: PColor, firstcolor: int, ncolors: int): int{.cdecl, importc: "SDL_SetPalette", dynlib: LibName.} # Maps an RGB triple to an opaque pixel value for a given pixel format -proc MapRGB*(format: PPixelFormat, r: byte, g: byte, b: byte): int32{.cdecl, +proc mapRGB*(format: PPixelFormat, r: byte, g: byte, b: byte): int32{.cdecl, importc: "SDL_MapRGB", dynlib: LibName.} # Maps an RGBA quadruple to a pixel value for a given pixel format -proc MapRGBA*(format: PPixelFormat, r: byte, g: byte, b: byte, a: byte): int32{. +proc mapRGBA*(format: PPixelFormat, r: byte, g: byte, b: byte, a: byte): int32{. cdecl, importc: "SDL_MapRGBA", dynlib: LibName.} # Maps a pixel value into the RGB components for a given pixel format -proc GetRGB*(pixel: int32, fmt: PPixelFormat, r: ptr byte, g: ptr byte, b: ptr byte){. +proc getRGB*(pixel: int32, fmt: PPixelFormat, r: ptr byte, g: ptr byte, b: ptr byte){. cdecl, importc: "SDL_GetRGB", dynlib: LibName.} # Maps a pixel value into the RGBA components for a given pixel format -proc GetRGBA*(pixel: int32, fmt: PPixelFormat, r: ptr byte, g: ptr byte, b: ptr byte, +proc getRGBA*(pixel: int32, fmt: PPixelFormat, r: ptr byte, g: ptr byte, b: ptr byte, a: ptr byte){.cdecl, importc: "SDL_GetRGBA", dynlib: LibName.} # Allocate and free an RGB surface (must be called after SDL_SetVideoMode) # If the depth is 4 or 8 bits, an empty palette is allocated for the surface. @@ -1932,17 +1925,17 @@ proc GetRGBA*(pixel: int32, fmt: PPixelFormat, r: ptr byte, g: ptr byte, b: ptr # will be set in the flags member of the returned surface. If for some # reason the surface could not be placed in video memory, it will not have # the SDL_HWSURFACE flag set, and will be created in system memory instead. -proc AllocSurface*(flags: int32, width, height, depth: int, - RMask, GMask, BMask, AMask: int32): PSurface -proc CreateRGBSurface*(flags: int32, width, height, depth: int, - RMask, GMask, BMask, AMask: int32): PSurface{.cdecl, +proc allocSurface*(flags: int32, width, height, depth: int, + rMask, gMask, bMask, aMask: int32): PSurface +proc createRGBSurface*(flags: int32, width, height, depth: int, + rMask, gMask, bMask, aMask: int32): PSurface{.cdecl, importc: "SDL_CreateRGBSurface", dynlib: LibName.} -proc CreateRGBSurfaceFrom*(pixels: pointer, width, height, depth, pitch: int, - RMask, GMask, BMask, AMask: int32): PSurface{.cdecl, +proc createRGBSurfaceFrom*(pixels: pointer, width, height, depth, pitch: int, + rMask, gMask, bMask, aMask: int32): PSurface{.cdecl, importc: "SDL_CreateRGBSurfaceFrom", dynlib: LibName.} -proc FreeSurface*(surface: PSurface){.cdecl, importc: "SDL_FreeSurface", +proc freeSurface*(surface: PSurface){.cdecl, importc: "SDL_FreeSurface", dynlib: LibName.} -proc MustLock*(surface: PSurface): bool +proc mustLock*(surface: PSurface): bool # SDL_LockSurface() sets up a surface for directly accessing the pixels. # Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write # to and read from 'surface->pixels', using the pixel format stored in @@ -1959,25 +1952,25 @@ proc MustLock*(surface: PSurface): bool # pairs, as critical system locks may be held during this time. # # SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. -proc LockSurface*(surface: PSurface): int{.cdecl, importc: "SDL_LockSurface", +proc lockSurface*(surface: PSurface): int{.cdecl, importc: "SDL_LockSurface", dynlib: LibName.} -proc UnlockSurface*(surface: PSurface){.cdecl, importc: "SDL_UnlockSurface", +proc unlockSurface*(surface: PSurface){.cdecl, importc: "SDL_UnlockSurface", dynlib: LibName.} # Load a surface from a seekable SDL data source (memory or file.) # If 'freesrc' is non-zero, the source will be closed after being read. # Returns the new surface, or NULL if there was an error. # The new surface should be freed with SDL_FreeSurface(). -proc LoadBMP_RW*(src: PRWops, freesrc: int): PSurface{.cdecl, +proc loadBMP_RW*(src: PRWops, freesrc: int): PSurface{.cdecl, importc: "SDL_LoadBMP_RW", dynlib: LibName.} # Convenience macro -- load a surface from a file -proc LoadBMP*(filename: cstring): PSurface +proc loadBMP*(filename: cstring): PSurface # Save a surface to a seekable SDL data source (memory or file.) # If 'freedst' is non-zero, the source will be closed after being written. # Returns 0 if successful or -1 if there was an error. -proc SaveBMP_RW*(surface: PSurface, dst: PRWops, freedst: int): int{.cdecl, +proc saveBMP_RW*(surface: PSurface, dst: PRWops, freedst: int): int{.cdecl, importc: "SDL_SaveBMP_RW", dynlib: LibName.} # Convenience macro -- save a surface to a file -proc SaveBMP*(surface: PSurface, filename: cstring): int +proc saveBMP*(surface: PSurface, filename: cstring): int # Sets the color key (transparent pixel) in a blittable surface. # If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), # 'key' will be the transparent pixel in the source image of a blit. @@ -1985,7 +1978,7 @@ proc SaveBMP*(surface: PSurface, filename: cstring): int # and removes RLE acceleration if absent. # If 'flag' is 0, this function clears any current color key. # This function returns 0, or -1 if there was an error. -proc SetColorKey*(surface: PSurface, flag, key: int32): int{.cdecl, +proc setColorKey*(surface: PSurface, flag, key: int32): int{.cdecl, importc: "SDL_SetColorKey", dynlib: LibName.} # This function sets the alpha value for the entire surface, as opposed to # using the alpha component of each pixel. This value measures the range @@ -1998,7 +1991,7 @@ proc SetColorKey*(surface: PSurface, flag, key: int32): int{.cdecl, # If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface. # OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the # surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. -proc SetAlpha*(surface: PSurface, flag: int32, alpha: byte): int{.cdecl, +proc setAlpha*(surface: PSurface, flag: int32, alpha: byte): int{.cdecl, importc: "SDL_SetAlpha", dynlib: LibName.} # Sets the clipping rectangle for the destination surface in a blit. # @@ -2010,12 +2003,12 @@ proc SetAlpha*(surface: PSurface, flag: int32, alpha: byte): int{.cdecl, # # Note that blits are automatically clipped to the edges of the source # and destination surfaces. -proc SetClipRect*(surface: PSurface, rect: PRect){.cdecl, +proc setClipRect*(surface: PSurface, rect: PRect){.cdecl, importc: "SDL_SetClipRect", dynlib: LibName.} # Gets the clipping rectangle for the destination surface in a blit. # 'rect' must be a pointer to a valid rectangle which will be filled # with the correct values. -proc GetClipRect*(surface: PSurface, rect: PRect){.cdecl, +proc getClipRect*(surface: PSurface, rect: PRect){.cdecl, importc: "SDL_GetClipRect", dynlib: LibName.} # Creates a new surface of the specified format, and then copies and maps # the given surface to it so the blit of the converted surface will be as @@ -2027,7 +2020,7 @@ proc GetClipRect*(surface: PSurface, rect: PRect){.cdecl, # surface. # # This function is used internally by SDL_DisplayFormat(). -proc ConvertSurface*(src: PSurface, fmt: PPixelFormat, flags: int32): PSurface{. +proc convertSurface*(src: PSurface, fmt: PPixelFormat, flags: int32): PSurface{. cdecl, importc: "SDL_ConvertSurface", dynlib: LibName.} # # This performs a fast blit from the source surface to the destination @@ -2098,14 +2091,14 @@ proc ConvertSurface*(src: PSurface, fmt: PPixelFormat, flags: int32): PSurface{. # to the video memory again. # You should call SDL_BlitSurface() unless you know exactly how SDL # blitting works internally and how to use the other blit functions. -proc BlitSurface*(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): int +proc blitSurface*(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): int # This is the public blit function, SDL_BlitSurface(), and it performs # rectangle validation and clipping before passing it to SDL_LowerBlit() -proc UpperBlit*(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): int{. +proc upperBlit*(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): int{. cdecl, importc: "SDL_UpperBlit", dynlib: LibName.} # This is a semi-private blit function and it performs low-level surface # blitting only. -proc LowerBlit*(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): int{. +proc lowerBlit*(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): int{. cdecl, importc: "SDL_LowerBlit", dynlib: LibName.} # This function performs a fast fill of the given rectangle with 'color' # The given rectangle is clipped to the destination surface clip area @@ -2114,7 +2107,7 @@ proc LowerBlit*(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): i # The color should be a pixel of the format used by the surface, and # can be generated by the SDL_MapRGB() function. # This function returns 0 on success, or -1 on error. -proc FillRect*(dst: PSurface, dstrect: PRect, color: int32): int{.cdecl, +proc fillRect*(dst: PSurface, dstrect: PRect, color: int32): int{.cdecl, importc: "SDL_FillRect", dynlib: LibName.} # This function takes a surface and copies it to a new surface of the # pixel format and colors of the video framebuffer, suitable for fast @@ -2125,7 +2118,7 @@ proc FillRect*(dst: PSurface, dstrect: PRect, color: int32): int{.cdecl, # calling this function. # # If the conversion fails or runs out of memory, it returns NULL -proc DisplayFormat*(surface: PSurface): PSurface{.cdecl, +proc displayFormat*(surface: PSurface): PSurface{.cdecl, importc: "SDL_DisplayFormat", dynlib: LibName.} # This function takes a surface and copies it to a new surface of the # pixel format and colors of the video framebuffer (if possible), @@ -2137,7 +2130,7 @@ proc DisplayFormat*(surface: PSurface): PSurface{.cdecl, # calling this function. # # If the conversion fails or runs out of memory, it returns NULL -proc DisplayFormatAlpha*(surface: PSurface): PSurface{.cdecl, +proc displayFormatAlpha*(surface: PSurface): PSurface{.cdecl, importc: "SDL_DisplayFormatAlpha", dynlib: LibName.} #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #* YUV video surface overlay functions */ @@ -2146,23 +2139,23 @@ proc DisplayFormatAlpha*(surface: PSurface): PSurface{.cdecl, # Calling the returned surface an overlay is something of a misnomer because # the contents of the display surface underneath the area where the overlay # is shown is undefined - it may be overwritten with the converted YUV data. -proc CreateYUVOverlay*(width: int, height: int, format: int32, +proc createYUVOverlay*(width: int, height: int, format: int32, display: PSurface): POverlay{.cdecl, importc: "SDL_CreateYUVOverlay", dynlib: LibName.} # Lock an overlay for direct access, and unlock it when you are done -proc LockYUVOverlay*(Overlay: POverlay): int{.cdecl, +proc lockYUVOverlay*(overlay: POverlay): int{.cdecl, importc: "SDL_LockYUVOverlay", dynlib: LibName.} -proc UnlockYUVOverlay*(Overlay: POverlay){.cdecl, +proc unlockYUVOverlay*(overlay: POverlay){.cdecl, importc: "SDL_UnlockYUVOverlay", dynlib: LibName.} # Blit a video overlay to the display surface. # The contents of the video surface underneath the blit destination are # not defined. # The width and height of the destination rectangle may be different from # that of the overlay, but currently only 2x scaling is supported. -proc DisplayYUVOverlay*(Overlay: POverlay, dstrect: PRect): int{.cdecl, +proc displayYUVOverlay*(overlay: POverlay, dstrect: PRect): int{.cdecl, importc: "SDL_DisplayYUVOverlay", dynlib: LibName.} # Free a video overlay -proc FreeYUVOverlay*(Overlay: POverlay){.cdecl, importc: "SDL_FreeYUVOverlay", +proc freeYUVOverlay*(overlay: POverlay){.cdecl, importc: "SDL_FreeYUVOverlay", dynlib: LibName.} #------------------------------------------------------------------------------ # OpenGL Routines @@ -2175,13 +2168,13 @@ proc FreeYUVOverlay*(Overlay: POverlay){.cdecl, importc: "SDL_FreeYUVOverlay", # your program from the dynamic library using SDL_GL_GetProcAddress(). # # This is disabled in default builds of SDL. -proc GL_LoadLibrary*(filename: cstring): int{.cdecl, +proc glLoadLibrary*(filename: cstring): int{.cdecl, importc: "SDL_GL_LoadLibrary", dynlib: LibName.} # Get the address of a GL function (for extension functions) -proc GL_GetProcAddress*(procname: cstring): pointer{.cdecl, +proc glGetProcAddress*(procname: cstring): pointer{.cdecl, importc: "SDL_GL_GetProcAddress", dynlib: LibName.} # Set an attribute of the OpenGL subsystem before intialization. -proc GL_SetAttribute*(attr: TGLAttr, value: int): int{.cdecl, +proc glSetAttribute*(attr: TGLAttr, value: int): int{.cdecl, importc: "SDL_GL_SetAttribute", dynlib: LibName.} # Get an attribute of the OpenGL subsystem from the windowing # interface, such as glX. This is of course different from getting @@ -2190,34 +2183,34 @@ proc GL_SetAttribute*(attr: TGLAttr, value: int): int{.cdecl, # # Developers should track the values they pass into SDL_GL_SetAttribute # themselves if they want to retrieve these values. -proc GL_GetAttribute*(attr: TGLAttr, value: var int): int{.cdecl, +proc glGetAttribute*(attr: TGLAttr, value: var int): int{.cdecl, importc: "SDL_GL_GetAttribute", dynlib: LibName.} # Swap the OpenGL buffers, if double-buffering is supported. -proc GL_SwapBuffers*(){.cdecl, importc: "SDL_GL_SwapBuffers", dynlib: LibName.} +proc glSwapBuffers*(){.cdecl, importc: "SDL_GL_SwapBuffers", dynlib: LibName.} # Internal functions that should not be called unless you have read # and understood the source code for these functions. -proc GL_UpdateRects*(numrects: int, rects: PRect){.cdecl, +proc glUpdateRects*(numrects: int, rects: PRect){.cdecl, importc: "SDL_GL_UpdateRects", dynlib: LibName.} -proc GL_Lock*(){.cdecl, importc: "SDL_GL_Lock", dynlib: LibName.} -proc GL_Unlock*(){.cdecl, importc: "SDL_GL_Unlock", dynlib: LibName.} +proc glLock*(){.cdecl, importc: "SDL_GL_Lock", dynlib: LibName.} +proc glUnlock*(){.cdecl, importc: "SDL_GL_Unlock", dynlib: LibName.} #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #* These functions allow interaction with the window manager, if any. * #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # Sets/Gets the title and icon text of the display window -proc WM_GetCaption*(title: var cstring, icon: var cstring){.cdecl, +proc wmGetCaption*(title: var cstring, icon: var cstring){.cdecl, importc: "SDL_WM_GetCaption", dynlib: LibName.} -proc WM_SetCaption*(title: cstring, icon: cstring){.cdecl, +proc wmSetCaption*(title: cstring, icon: cstring){.cdecl, importc: "SDL_WM_SetCaption", dynlib: LibName.} # Sets the icon for the display window. # This function must be called before the first call to SDL_SetVideoMode(). # It takes an icon surface, and a mask in MSB format. # If 'mask' is NULL, the entire icon surface will be used as the icon. -proc WM_SetIcon*(icon: PSurface, mask: byte){.cdecl, importc: "SDL_WM_SetIcon", +proc wmSetIcon*(icon: PSurface, mask: byte){.cdecl, importc: "SDL_WM_SetIcon", dynlib: LibName.} # This function iconifies the window, and returns 1 if it succeeded. # If the function succeeds, it generates an SDL_APPACTIVE loss event. # This function is a noop and returns 0 in non-windowed environments. -proc WM_IconifyWindow*(): int{.cdecl, importc: "SDL_WM_IconifyWindow", +proc wmIconifyWindow*(): int{.cdecl, importc: "SDL_WM_IconifyWindow", dynlib: LibName.} # Toggle fullscreen mode without changing the contents of the screen. # If the display surface does not require locking before accessing @@ -2232,12 +2225,12 @@ proc WM_IconifyWindow*(): int{.cdecl, importc: "SDL_WM_IconifyWindow", # set, then the display will be windowed by default where supported. # # This is currently only implemented in the X11 video driver. -proc WM_ToggleFullScreen*(surface: PSurface): int{.cdecl, +proc wmToggleFullScreen*(surface: PSurface): int{.cdecl, importc: "SDL_WM_ToggleFullScreen", dynlib: LibName.} # Grabbing means that the mouse is confined to the application window, # and nearly all keyboard input is passed directly to the application, # and not interpreted by a window manager, if any. -proc WM_GrabInput*(mode: TGrabMode): TGrabMode{.cdecl, +proc wmGrabInput*(mode: TGrabMode): TGrabMode{.cdecl, importc: "SDL_WM_GrabInput", dynlib: LibName.} #------------------------------------------------------------------------------ # mouse-routines @@ -2246,16 +2239,16 @@ proc WM_GrabInput*(mode: TGrabMode): TGrabMode{.cdecl, # The current button state is returned as a button bitmask, which can # be tested using the SDL_BUTTON(X) macros, and x and y are set to the # current mouse cursor position. You can pass NULL for either x or y. -proc GetMouseState*(x: var int, y: var int): byte{.cdecl, +proc getMouseState*(x: var int, y: var int): byte{.cdecl, importc: "SDL_GetMouseState", dynlib: LibName.} # Retrieve the current state of the mouse. # The current button state is returned as a button bitmask, which can # be tested using the SDL_BUTTON(X) macros, and x and y are set to the # mouse deltas since the last call to SDL_GetRelativeMouseState(). -proc GetRelativeMouseState*(x: var int, y: var int): byte{.cdecl, +proc getRelativeMouseState*(x: var int, y: var int): byte{.cdecl, importc: "SDL_GetRelativeMouseState", dynlib: LibName.} # Set the position of the mouse cursor (generates a mouse motion event) -proc WarpMouse*(x, y: uint16){.cdecl, importc: "SDL_WarpMouse", dynlib: LibName.} +proc warpMouse*(x, y: uint16){.cdecl, importc: "SDL_WarpMouse", dynlib: LibName.} # Create a cursor using the specified data and mask (in MSB format). # The cursor width must be a multiple of 8 bits. # @@ -2267,26 +2260,26 @@ proc WarpMouse*(x, y: uint16){.cdecl, importc: "SDL_WarpMouse", dynlib: LibName. # 1 0 Inverted color if possible, black if not. # # Cursors created with this function must be freed with SDL_FreeCursor(). -proc CreateCursor*(data, mask: ptr byte, w, h, hot_x, hot_y: int): PCursor{.cdecl, +proc createCursor*(data, mask: ptr byte, w, h, hotX, hotY: int): PCursor{.cdecl, importc: "SDL_CreateCursor", dynlib: LibName.} # Set the currently active cursor to the specified one. # If the cursor is currently visible, the change will be immediately # represented on the display. -proc SetCursor*(cursor: PCursor){.cdecl, importc: "SDL_SetCursor", +proc setCursor*(cursor: PCursor){.cdecl, importc: "SDL_SetCursor", dynlib: LibName.} # Returns the currently active cursor. -proc GetCursor*(): PCursor{.cdecl, importc: "SDL_GetCursor", dynlib: LibName.} +proc getCursor*(): PCursor{.cdecl, importc: "SDL_GetCursor", dynlib: LibName.} # Deallocates a cursor created with SDL_CreateCursor(). -proc FreeCursor*(cursor: PCursor){.cdecl, importc: "SDL_FreeCursor", +proc freeCursor*(cursor: PCursor){.cdecl, importc: "SDL_FreeCursor", dynlib: LibName.} # Toggle whether or not the cursor is shown on the screen. # The cursor start off displayed, but can be turned off. # SDL_ShowCursor() returns 1 if the cursor was being displayed # before the call, or 0 if it was not. You can query the current # state by passing a 'toggle' value of -1. -proc ShowCursor*(toggle: int): int{.cdecl, importc: "SDL_ShowCursor", +proc showCursor*(toggle: int): int{.cdecl, importc: "SDL_ShowCursor", dynlib: LibName.} -proc BUTTON*(Button: int): int +proc button*(b: int): int #------------------------------------------------------------------------------ # Keyboard-routines #------------------------------------------------------------------------------ @@ -2296,12 +2289,12 @@ proc BUTTON*(Button: int): int # If 'enable' is 0, translation is disabled. # If 'enable' is -1, the translation state is not changed. # It returns the previous state of keyboard translation. -proc EnableUNICODE*(enable: int): int{.cdecl, importc: "SDL_EnableUNICODE", +proc enableUNICODE*(enable: int): int{.cdecl, importc: "SDL_EnableUNICODE", dynlib: LibName.} # If 'delay' is set to 0, keyboard repeat is disabled. -proc EnableKeyRepeat*(delay: int, interval: int): int{.cdecl, +proc enableKeyRepeat*(delay: int, interval: int): int{.cdecl, importc: "SDL_EnableKeyRepeat", dynlib: LibName.} -proc GetKeyRepeat*(delay: PInteger, interval: PInteger){.cdecl, +proc getKeyRepeat*(delay: PInteger, interval: PInteger){.cdecl, importc: "SDL_GetKeyRepeat", dynlib: LibName.} # Get a snapshot of the current state of the keyboard. # Returns an array of keystates, indexed by the SDLK_* syms. @@ -2309,16 +2302,16 @@ proc GetKeyRepeat*(delay: PInteger, interval: PInteger){.cdecl, # # byte *keystate = SDL_GetKeyState(NULL); # if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed -proc GetKeyState*(numkeys: pointer): ptr byte{.cdecl, importc: "SDL_GetKeyState", +proc getKeyState*(numkeys: pointer): ptr byte{.cdecl, importc: "SDL_GetKeyState", dynlib: LibName.} # Get the current key modifier state -proc GetModState*(): TMod{.cdecl, importc: "SDL_GetModState", dynlib: LibName.} +proc getModState*(): TMod{.cdecl, importc: "SDL_GetModState", dynlib: LibName.} # Set the current key modifier state # This does not change the keyboard state, only the key modifier flags. -proc SetModState*(modstate: TMod){.cdecl, importc: "SDL_SetModState", +proc setModState*(modstate: TMod){.cdecl, importc: "SDL_SetModState", dynlib: LibName.} # Get the name of an SDL virtual keysym -proc GetKeyName*(key: TKey): cstring{.cdecl, importc: "SDL_GetKeyName", +proc getKeyName*(key: TKey): cstring{.cdecl, importc: "SDL_GetKeyName", dynlib: LibName.} #------------------------------------------------------------------------------ # Active Routines @@ -2327,96 +2320,96 @@ proc GetKeyName*(key: TKey): cstring{.cdecl, importc: "SDL_GetKeyName", # bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and # SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to # see your application, otherwise it has been iconified or disabled. -proc GetAppState*(): byte{.cdecl, importc: "SDL_GetAppState", dynlib: LibName.} +proc getAppState*(): byte{.cdecl, importc: "SDL_GetAppState", dynlib: LibName.} # Mutex functions # Create a mutex, initialized unlocked -proc CreateMutex*(): PMutex{.cdecl, importc: "SDL_CreateMutex", dynlib: LibName.} +proc createMutex*(): PMutex{.cdecl, importc: "SDL_CreateMutex", dynlib: LibName.} # Lock the mutex (Returns 0, or -1 on error) -proc mutexP*(mutex: Pmutex): int{.cdecl, importc: "SDL_mutexP", dynlib: LibName.} -proc LockMutex*(mutex: Pmutex): int +proc mutexP*(mutex: PMutex): int{.cdecl, importc: "SDL_mutexP", dynlib: LibName.} +proc lockMutex*(mutex: PMutex): int # Unlock the mutex (Returns 0, or -1 on error) -proc mutexV*(mutex: Pmutex): int{.cdecl, importc: "SDL_mutexV", dynlib: LibName.} -proc UnlockMutex*(mutex: Pmutex): int +proc mutexV*(mutex: PMutex): int{.cdecl, importc: "SDL_mutexV", dynlib: LibName.} +proc unlockMutex*(mutex: PMutex): int # Destroy a mutex -proc DestroyMutex*(mutex: Pmutex){.cdecl, importc: "SDL_DestroyMutex", +proc destroyMutex*(mutex: PMutex){.cdecl, importc: "SDL_DestroyMutex", dynlib: LibName.} # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # Semaphore functions # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # Create a semaphore, initialized with value, returns NULL on failure. -proc CreateSemaphore*(initial_value: int32): PSem{.cdecl, +proc createSemaphore*(initialValue: int32): PSem{.cdecl, importc: "SDL_CreateSemaphore", dynlib: LibName.} # Destroy a semaphore -proc DestroySemaphore*(sem: Psem){.cdecl, importc: "SDL_DestroySemaphore", +proc destroySemaphore*(sem: PSem){.cdecl, importc: "SDL_DestroySemaphore", dynlib: LibName.} # This function suspends the calling thread until the semaphore pointed # to by sem has a positive count. It then atomically decreases the semaphore # count. -proc SemWait*(sem: Psem): int{.cdecl, importc: "SDL_SemWait", dynlib: LibName.} +proc semWait*(sem: PSem): int{.cdecl, importc: "SDL_SemWait", dynlib: LibName.} # Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds, # SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error. -proc SemTryWait*(sem: Psem): int{.cdecl, importc: "SDL_SemTryWait", +proc semTryWait*(sem: PSem): int{.cdecl, importc: "SDL_SemTryWait", dynlib: LibName.} # Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if # the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in # the allotted time, and -1 on error. # On some platforms this function is implemented by looping with a delay # of 1 ms, and so should be avoided if possible. -proc SemWaitTimeout*(sem: Psem, ms: int32): int{.cdecl, +proc semWaitTimeout*(sem: PSem, ms: int32): int{.cdecl, importc: "SDL_SemWaitTimeout", dynlib: LibName.} # Atomically increases the semaphore's count (not blocking), returns 0, # or -1 on error. -proc SemPost*(sem: Psem): int{.cdecl, importc: "SDL_SemPost", dynlib: LibName.} +proc semPost*(sem: PSem): int{.cdecl, importc: "SDL_SemPost", dynlib: LibName.} # Returns the current count of the semaphore -proc SemValue*(sem: Psem): int32{.cdecl, importc: "SDL_SemValue", +proc semValue*(sem: PSem): int32{.cdecl, importc: "SDL_SemValue", dynlib: LibName.} # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # Condition variable functions # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # Create a condition variable -proc CreateCond*(): PCond{.cdecl, importc: "SDL_CreateCond", dynlib: LibName.} +proc createCond*(): PCond{.cdecl, importc: "SDL_CreateCond", dynlib: LibName.} # Destroy a condition variable -proc DestroyCond*(cond: PCond){.cdecl, importc: "SDL_DestroyCond", +proc destroyCond*(cond: PCond){.cdecl, importc: "SDL_DestroyCond", dynlib: LibName.} # Restart one of the threads that are waiting on the condition variable, # returns 0 or -1 on error. -proc CondSignal*(cond: Pcond): int{.cdecl, importc: "SDL_CondSignal", +proc condSignal*(cond: PCond): int{.cdecl, importc: "SDL_CondSignal", dynlib: LibName.} # Restart all threads that are waiting on the condition variable, # returns 0 or -1 on error. -proc CondBroadcast*(cond: Pcond): int{.cdecl, importc: "SDL_CondBroadcast", +proc condBroadcast*(cond: PCond): int{.cdecl, importc: "SDL_CondBroadcast", dynlib: LibName.} # Wait on the condition variable, unlocking the provided mutex. # The mutex must be locked before entering this function! # Returns 0 when it is signaled, or -1 on error. -proc CondWait*(cond: Pcond, mut: Pmutex): int{.cdecl, importc: "SDL_CondWait", +proc condWait*(cond: PCond, mut: PMutex): int{.cdecl, importc: "SDL_CondWait", dynlib: LibName.} # Waits for at most 'ms' milliseconds, and returns 0 if the condition # variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not # signaled in the allotted time, and -1 on error. # On some platforms this function is implemented by looping with a delay # of 1 ms, and so should be avoided if possible. -proc CondWaitTimeout*(cond: Pcond, mut: Pmutex, ms: int32): int{.cdecl, +proc condWaitTimeout*(cond: PCond, mut: PMutex, ms: int32): int{.cdecl, importc: "SDL_CondWaitTimeout", dynlib: LibName.} # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # Condition variable functions # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # Create a thread -proc CreateThread*(fn, data: pointer): PThread{.cdecl, +proc createThread*(fn, data: pointer): PThread{.cdecl, importc: "SDL_CreateThread", dynlib: LibName.} # Get the 32-bit thread identifier for the current thread -proc ThreadID*(): int32{.cdecl, importc: "SDL_ThreadID", dynlib: LibName.} +proc threadID*(): int32{.cdecl, importc: "SDL_ThreadID", dynlib: LibName.} # Get the 32-bit thread identifier for the specified thread, # equivalent to SDL_ThreadID() if the specified thread is NULL. -proc GetThreadID*(thread: PThread): int32{.cdecl, importc: "SDL_GetThreadID", +proc getThreadID*(thread: PThread): int32{.cdecl, importc: "SDL_GetThreadID", dynlib: LibName.} # Wait for a thread to finish. # The return code for the thread function is placed in the area # pointed to by 'status', if 'status' is not NULL. -proc WaitThread*(thread: PThread, status: var int){.cdecl, +proc waitThread*(thread: PThread, status: var int){.cdecl, importc: "SDL_WaitThread", dynlib: LibName.} # Forcefully kill a thread without worrying about its state -proc KillThread*(thread: PThread){.cdecl, importc: "SDL_KillThread", +proc killThread*(thread: PThread){.cdecl, importc: "SDL_KillThread", dynlib: LibName.} #------------------------------------------------------------------------------ # Get Environment Routines @@ -2427,7 +2420,7 @@ proc KillThread*(thread: PThread){.cdecl, importc: "SDL_KillThread", # * returns 1 if the function is implemented. If it's not implemented, or # * the version member of the 'info' structure is invalid, it returns 0. # * -proc GetWMInfo*(info: PSysWMinfo): int{.cdecl, importc: "SDL_GetWMInfo", +proc getWMInfo*(info: PSysWMinfo): int{.cdecl, importc: "SDL_GetWMInfo", dynlib: LibName.} #------------------------------------------------------------------------------ #SDL_loadso.h @@ -2435,115 +2428,111 @@ proc GetWMInfo*(info: PSysWMinfo): int{.cdecl, importc: "SDL_GetWMInfo", # * to the object handle (or NULL if there was an error). # * The 'sofile' parameter is a system dependent name of the object file. # * -proc LoadObject*(sofile: cstring): pointer{.cdecl, importc: "SDL_LoadObject", +proc loadObject*(sofile: cstring): pointer{.cdecl, importc: "SDL_LoadObject", dynlib: LibName.} #* Given an object handle, this function looks up the address of the # * named function in the shared object and returns it. This address # * is no longer valid after calling SDL_UnloadObject(). # * -proc LoadFunction*(handle: pointer, name: cstring): pointer{.cdecl, +proc loadFunction*(handle: pointer, name: cstring): pointer{.cdecl, importc: "SDL_LoadFunction", dynlib: LibName.} #* Unload a shared object from memory * -proc UnloadObject*(handle: pointer){.cdecl, importc: "SDL_UnloadObject", +proc unloadObject*(handle: pointer){.cdecl, importc: "SDL_UnloadObject", dynlib: LibName.} #------------------------------------------------------------------------------ -proc Swap32*(D: int32): int32 +proc swap32*(d: int32): int32 # Bitwise Checking functions -proc IsBitOn*(value: int, bit: int8): bool -proc TurnBitOn*(value: int, bit: int8): int -proc TurnBitOff*(value: int, bit: int8): int +proc isBitOn*(value: int, bit: int8): bool +proc turnBitOn*(value: int, bit: int8): int +proc turnBitOff*(value: int, bit: int8): int # implementation -proc TABLESIZE(table: cstring): int = +proc tablesize(table: cstring): int = result = sizeOf(table) div sizeOf(table[0]) -proc OutOfMemory() = - when not (defined(WINDOWS)): Error(ENOMEM) - -proc RWSeek(context: PRWops, offset: int, whence: int): int = +proc rwSeek(context: PRWops, offset: int, whence: int): int = result = context.seek(context, offset, whence) -proc RWTell(context: PRWops): int = +proc rwTell(context: PRWops): int = result = context.seek(context, 0, 1) -proc RWRead(context: PRWops, theptr: pointer, size: int, n: int): int = +proc rwRead(context: PRWops, theptr: pointer, size: int, n: int): int = result = context.read(context, theptr, size, n) -proc RWWrite(context: PRWops, theptr: pointer, size: int, n: int): int = +proc rwWrite(context: PRWops, theptr: pointer, size: int, n: int): int = result = context.write(context, theptr, size, n) -proc RWClose(context: PRWops): int = +proc rwClose(context: PRWops): int = result = context.closeFile(context) -proc LoadWAV(filename: cstring, spec: PAudioSpec, audio_buf: ptr byte, +proc loadWAV(filename: cstring, spec: PAudioSpec, audioBuf: ptr byte, audiolen: PUInt32): PAudioSpec = - result = LoadWAV_RW(RWFromFile(filename, "rb"), 1, spec, audio_buf, audiolen) + result = loadWAV_RW(rWFromFile(filename, "rb"), 1, spec, audioBuf, audiolen) -proc CDInDrive(status: TCDStatus): bool = +proc cdInDrive(status: TCDStatus): bool = result = ord(status) > ord(CD_ERROR) -proc FRAMES_TO_MSF(frames: int, M: var int, S: var int, F: var int) = - var value: int - value = frames - F = value mod CD_FPS +proc framesToMsf*(frames: int; m, s, f: var int) = + var value = frames + f = value mod CD_FPS value = value div CD_FPS - S = value mod 60 + s = value mod 60 value = value div 60 - M = value + m = value -proc MSF_TO_FRAMES(M: int, S: int, F: int): int = - result = M * 60 * CD_FPS + S * CD_FPS + F +proc msfToFrames*(m, s, f: int): int = + result = m * 60 * CD_FPS + s * CD_FPS + f -proc VERSION(X: var TVersion) = - X.major = MAJOR_VERSION - X.minor = MINOR_VERSION - X.patch = PATCHLEVEL +proc version(x: var Tversion) = + x.major = MAJOR_VERSION + x.minor = MINOR_VERSION + x.patch = PATCHLEVEL -proc VERSIONNUM(X, Y, Z: int): int = - result = X * 1000 + Y * 100 + Z +proc versionnum(x, y, z: int): int = + result = x * 1000 + y * 100 + z -proc COMPILEDVERSION(): int = - result = VERSIONNUM(MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL) +proc compiledversion(): int = + result = versionnum(MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL) -proc VERSION_ATLEAST(X, Y, Z: int): bool = - result = (COMPILEDVERSION() >= VERSIONNUM(X, Y, Z)) +proc versionAtleast(x, y, z: int): bool = + result = (compiledversion() >= versionnum(x, y, z)) -proc LoadBMP(filename: cstring): PSurface = - result = LoadBMP_RW(RWFromFile(filename, "rb"), 1) +proc loadBMP(filename: cstring): PSurface = + result = loadBMP_RW(rWFromFile(filename, "rb"), 1) -proc SaveBMP(surface: PSurface, filename: cstring): int = - result = SaveBMP_RW(surface, RWFromFile(filename, "wb"), 1) +proc saveBMP(surface: PSurface, filename: cstring): int = + result = saveBMP_RW(surface, rWFromFile(filename, "wb"), 1) -proc BlitSurface(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): int = - result = UpperBlit(src, srcrect, dst, dstrect) +proc blitSurface(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): int = + result = upperBlit(src, srcrect, dst, dstrect) -proc AllocSurface(flags: int32, width, height, depth: int, - RMask, GMask, BMask, AMask: int32): PSurface = - result = CreateRGBSurface(flags, width, height, depth, RMask, GMask, BMask, - AMask) +proc allocSurface(flags: int32, width, height, depth: int, + rMask, gMask, bMask, aMask: int32): PSurface = + result = createRGBSurface(flags, width, height, depth, rMask, gMask, bMask, + aMask) -proc MustLock(surface: PSurface): bool = +proc mustLock(surface: PSurface): bool = result = ((surface.offset != 0) or ((surface.flags and (HWSURFACE or ASYNCBLIT or RLEACCEL)) != 0)) -proc LockMutex(mutex: Pmutex): int = +proc lockMutex(mutex: PMutex): int = result = mutexP(mutex) -proc UnlockMutex(mutex: Pmutex): int = +proc unlockMutex(mutex: PMutex): int = result = mutexV(mutex) -proc BUTTON(Button: int): int = - result = PRESSED shl (Button - 1) +proc button(b: int): int = + result = PRESSED shl (b - 1) -proc Swap32(D: int32): int32 = - result = ((D shl 24) or ((D shl 8) and 0x00FF0000) or - ((D shr 8) and 0x0000FF00) or (D shr 24)) +proc swap32(d: int32): int32 = + result = ((d shl 24) or ((d shl 8) and 0x00FF0000) or + ((d shr 8) and 0x0000FF00) or (d shr 24)) -proc IsBitOn(value: int, bit: int8): bool = +proc isBitOn(value: int, bit: int8): bool = result = ((value and (1 shl ze(bit))) != 0) -proc TurnBitOn(value: int, bit: int8): int = +proc turnBitOn(value: int, bit: int8): int = result = (value or (1 shl ze(bit))) -proc TurnBitOff(value: int, bit: int8): int = +proc turnBitOff(value: int, bit: int8): int = result = (value and not (1 shl ze(bit))) diff --git a/lib/wrappers/sdl/sdl_gfx.nim b/lib/wrappers/sdl/sdl_gfx.nim index cf36c4989..5523ad0a2 100644 --- a/lib/wrappers/sdl/sdl_gfx.nim +++ b/lib/wrappers/sdl/sdl_gfx.nim @@ -39,10 +39,10 @@ const # Some rates in Hz type PFPSmanager* = ptr TFPSmanager TFPSmanager*{.final.} = object # ---- Structures - framecount*: Uint32 + framecount*: uint32 rateticks*: float32 - lastticks*: Uint32 - rate*: Uint32 + lastticks*: uint32 + rate*: uint32 PColorRGBA* = ptr TColorRGBA TColorRGBA*{.final.} = object @@ -79,102 +79,102 @@ proc framerateDelay*(manager: PFPSmanager){.cdecl, # # Note: all ___Color routines expect the color to be in format 0xRRGGBBAA # Pixel -proc pixelColor*(dst: PSurface, x: int16, y: int16, color: Uint32): cint{. +proc pixelColor*(dst: PSurface, x: int16, y: int16, color: uint32): cint{. cdecl, importc: "pixelColor", dynlib: gfxLibName.} proc pixelRGBA*(dst: PSurface, x: int16, y: int16, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "pixelRGBA", dynlib: gfxLibName.} # Horizontal line -proc hlineColor*(dst: PSurface, x1: int16, x2: int16, y: int16, color: Uint32): cint{. +proc hlineColor*(dst: PSurface, x1: int16, x2: int16, y: int16, color: uint32): cint{. cdecl, importc: "hlineColor", dynlib: gfxLibName.} proc hlineRGBA*(dst: PSurface, x1: int16, x2: int16, y: int16, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "hlineRGBA", dynlib: gfxLibName.} # Vertical line -proc vlineColor*(dst: PSurface, x: int16, y1: int16, y2: int16, color: Uint32): cint{. +proc vlineColor*(dst: PSurface, x: int16, y1: int16, y2: int16, color: uint32): cint{. cdecl, importc: "vlineColor", dynlib: gfxLibName.} proc vlineRGBA*(dst: PSurface, x: int16, y1: int16, y2: int16, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "vlineRGBA", dynlib: gfxLibName.} # Rectangle proc rectangleColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, - y2: int16, color: Uint32): cint{.cdecl, + y2: int16, color: uint32): cint{.cdecl, importc: "rectangleColor", dynlib: gfxLibName.} proc rectangleRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, r: byte, g: byte, b: byte, a: byte): cint{. cdecl, importc: "rectangleRGBA", dynlib: gfxLibName.} # Filled rectangle (Box) proc boxColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, - color: Uint32): cint{.cdecl, importc: "boxColor", + color: uint32): cint{.cdecl, importc: "boxColor", dynlib: gfxLibName.} proc boxRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "boxRGBA", dynlib: gfxLibName.} # Line proc lineColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, - color: Uint32): cint{.cdecl, importc: "lineColor", + color: uint32): cint{.cdecl, importc: "lineColor", dynlib: gfxLibName.} proc lineRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "lineRGBA", dynlib: gfxLibName.} # AA Line proc aalineColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, - color: Uint32): cint{.cdecl, importc: "aalineColor", + color: uint32): cint{.cdecl, importc: "aalineColor", dynlib: gfxLibName.} proc aalineRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "aalineRGBA", dynlib: gfxLibName.} # Circle -proc circleColor*(dst: PSurface, x: int16, y: int16, r: int16, color: Uint32): cint{. +proc circleColor*(dst: PSurface, x: int16, y: int16, r: int16, color: uint32): cint{. cdecl, importc: "circleColor", dynlib: gfxLibName.} proc circleRGBA*(dst: PSurface, x: int16, y: int16, rad: int16, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "circleRGBA", dynlib: gfxLibName.} # AA Circle proc aacircleColor*(dst: PSurface, x: int16, y: int16, r: int16, - color: Uint32): cint{.cdecl, importc: "aacircleColor", + color: uint32): cint{.cdecl, importc: "aacircleColor", dynlib: gfxLibName.} proc aacircleRGBA*(dst: PSurface, x: int16, y: int16, rad: int16, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "aacircleRGBA", dynlib: gfxLibName.} # Filled Circle proc filledCircleColor*(dst: PSurface, x: int16, y: int16, r: int16, - color: Uint32): cint{.cdecl, + color: uint32): cint{.cdecl, importc: "filledCircleColor", dynlib: gfxLibName.} proc filledCircleRGBA*(dst: PSurface, x: int16, y: int16, rad: int16, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "filledCircleRGBA", dynlib: gfxLibName.} # Ellipse proc ellipseColor*(dst: PSurface, x: int16, y: int16, rx: int16, ry: int16, - color: Uint32): cint{.cdecl, importc: "ellipseColor", + color: uint32): cint{.cdecl, importc: "ellipseColor", dynlib: gfxLibName.} proc ellipseRGBA*(dst: PSurface, x: int16, y: int16, rx: int16, ry: int16, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "ellipseRGBA", dynlib: gfxLibName.} # AA Ellipse proc aaellipseColor*(dst: PSurface, xc: int16, yc: int16, rx: int16, - ry: int16, color: Uint32): cint{.cdecl, + ry: int16, color: uint32): cint{.cdecl, importc: "aaellipseColor", dynlib: gfxLibName.} proc aaellipseRGBA*(dst: PSurface, x: int16, y: int16, rx: int16, ry: int16, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "aaellipseRGBA", dynlib: gfxLibName.} # Filled Ellipse proc filledEllipseColor*(dst: PSurface, x: int16, y: int16, rx: int16, - ry: int16, color: Uint32): cint{.cdecl, + ry: int16, color: uint32): cint{.cdecl, importc: "filledEllipseColor", dynlib: gfxLibName.} proc filledEllipseRGBA*(dst: PSurface, x: int16, y: int16, rx: int16, ry: int16, r: byte, g: byte, b: byte, a: byte): cint{. cdecl, importc: "filledEllipseRGBA", dynlib: gfxLibName.} # Pie proc pieColor*(dst: PSurface, x: int16, y: int16, rad: int16, start: int16, - finish: int16, color: Uint32): cint{.cdecl, importc: "pieColor", + finish: int16, color: uint32): cint{.cdecl, importc: "pieColor", dynlib: gfxLibName.} proc pieRGBA*(dst: PSurface, x: int16, y: int16, rad: int16, start: int16, finish: int16, r: byte, g: byte, b: byte, a: byte): cint{. cdecl, importc: "pieRGBA", dynlib: gfxLibName.} # Filled Pie proc filledPieColor*(dst: PSurface, x: int16, y: int16, rad: int16, - start: int16, finish: int16, color: Uint32): cint{.cdecl, + start: int16, finish: int16, color: uint32): cint{.cdecl, importc: "filledPieColor", dynlib: gfxLibName.} proc filledPieRGBA*(dst: PSurface, x: int16, y: int16, rad: int16, start: int16, finish: int16, r: byte, g: byte, b: byte, @@ -182,14 +182,14 @@ proc filledPieRGBA*(dst: PSurface, x: int16, y: int16, rad: int16, dynlib: gfxLibName.} # Trigon proc trigonColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, - x3: int16, y3: int16, color: Uint32): cint{.cdecl, + x3: int16, y3: int16, color: uint32): cint{.cdecl, importc: "trigonColor", dynlib: gfxLibName.} proc trigonRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, x3: int16, y3: int16, r: byte, g: byte, b: byte, a: byte): cint{. cdecl, importc: "trigonRGBA", dynlib: gfxLibName.} # AA-Trigon proc aatrigonColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, - y2: int16, x3: int16, y3: int16, color: Uint32): cint{. + y2: int16, x3: int16, y3: int16, color: uint32): cint{. cdecl, importc: "aatrigonColor", dynlib: gfxLibName.} proc aatrigonRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, x3: int16, y3: int16, r: byte, g: byte, @@ -197,7 +197,7 @@ proc aatrigonRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, dynlib: gfxLibName.} # Filled Trigon proc filledTrigonColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, - y2: int16, x3: int16, y3: int16, color: Uint32): cint{. + y2: int16, x3: int16, y3: int16, color: uint32): cint{. cdecl, importc: "filledTrigonColor", dynlib: gfxLibName.} proc filledTrigonRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, x3: int16, y3: int16, r: byte, g: byte, @@ -205,21 +205,21 @@ proc filledTrigonRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, importc: "filledTrigonRGBA", dynlib: gfxLibName.} # Polygon proc polygonColor*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, - color: Uint32): cint{.cdecl, importc: "polygonColor", + color: uint32): cint{.cdecl, importc: "polygonColor", dynlib: gfxLibName.} proc polygonRGBA*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "polygonRGBA", dynlib: gfxLibName.} # AA-Polygon proc aapolygonColor*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, - color: Uint32): cint{.cdecl, importc: "aapolygonColor", + color: uint32): cint{.cdecl, importc: "aapolygonColor", dynlib: gfxLibName.} proc aapolygonRGBA*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "aapolygonRGBA", dynlib: gfxLibName.} # Filled Polygon proc filledPolygonColor*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, - color: Uint32): cint{.cdecl, + color: uint32): cint{.cdecl, importc: "filledPolygonColor", dynlib: gfxLibName.} proc filledPolygonRGBA*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, @@ -227,23 +227,23 @@ proc filledPolygonRGBA*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, # Bezier # s = number of steps proc bezierColor*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, s: cint, - color: Uint32): cint{.cdecl, importc: "bezierColor", + color: uint32): cint{.cdecl, importc: "bezierColor", dynlib: gfxLibName.} proc bezierRGBA*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, s: cint, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "bezierRGBA", dynlib: gfxLibName.} # Characters/Strings -proc characterColor*(dst: PSurface, x: int16, y: int16, c: char, color: Uint32): cint{. +proc characterColor*(dst: PSurface, x: int16, y: int16, c: char, color: uint32): cint{. cdecl, importc: "characterColor", dynlib: gfxLibName.} proc characterRGBA*(dst: PSurface, x: int16, y: int16, c: char, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "characterRGBA", dynlib: gfxLibName.} -proc stringColor*(dst: PSurface, x: int16, y: int16, c: cstring, color: Uint32): cint{. +proc stringColor*(dst: PSurface, x: int16, y: int16, c: cstring, color: uint32): cint{. cdecl, importc: "stringColor", dynlib: gfxLibName.} proc stringRGBA*(dst: PSurface, x: int16, y: int16, c: cstring, r: byte, g: byte, b: byte, a: byte): cint{.cdecl, importc: "stringRGBA", dynlib: gfxLibName.} -proc gfxPrimitivesSetFont*(fontdata: Pointer, cw: cint, ch: cint){.cdecl, +proc gfxPrimitivesSetFont*(fontdata: pointer, cw: cint, ch: cint){.cdecl, importc: "gfxPrimitivesSetFont", dynlib: gfxLibName.} # # @@ -271,132 +271,132 @@ proc imageFilterMMXon*(){.cdecl, importc: "SDL_imageFilterMMXon", # -1 Error (internal error, parameter error) # # SDL_imageFilterAdd: D = saturation255(S1 + S2) -proc imageFilterAdd*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{. +proc imageFilterAdd*(src1: cstring, src2: cstring, dest: cstring, len: cint): cint{. cdecl, importc: "SDL_imageFilterAdd", dynlib: gfxLibName.} # SDL_imageFilterMean: D = S1/2 + S2/2 -proc imageFilterMean*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{. +proc imageFilterMean*(src1: cstring, src2: cstring, dest: cstring, len: cint): cint{. cdecl, importc: "SDL_imageFilterMean", dynlib: gfxLibName.} # SDL_imageFilterSub: D = saturation0(S1 - S2) -proc imageFilterSub*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{. +proc imageFilterSub*(src1: cstring, src2: cstring, dest: cstring, len: cint): cint{. cdecl, importc: "SDL_imageFilterSub", dynlib: gfxLibName.} # SDL_imageFilterAbsDiff: D = | S1 - S2 | -proc imageFilterAbsDiff*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{. +proc imageFilterAbsDiff*(src1: cstring, src2: cstring, dest: cstring, len: cint): cint{. cdecl, importc: "SDL_imageFilterAbsDiff", dynlib: gfxLibName.} # SDL_imageFilterMult: D = saturation(S1 * S2) -proc imageFilterMult*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{. +proc imageFilterMult*(src1: cstring, src2: cstring, dest: cstring, len: cint): cint{. cdecl, importc: "SDL_imageFilterMult", dynlib: gfxLibName.} # SDL_imageFilterMultNor: D = S1 * S2 (non-MMX) -proc imageFilterMultNor*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{. +proc imageFilterMultNor*(src1: cstring, src2: cstring, dest: cstring, len: cint): cint{. cdecl, importc: "SDL_imageFilterMultNor", dynlib: gfxLibName.} # SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2) -proc imageFilterMultDivby2*(Src1: cstring, Src2: cstring, Dest: cstring, +proc imageFilterMultDivby2*(src1: cstring, src2: cstring, dest: cstring, len: cint): cint{.cdecl, importc: "SDL_imageFilterMultDivby2", dynlib: gfxLibName.} # SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2) -proc imageFilterMultDivby4*(Src1: cstring, Src2: cstring, Dest: cstring, +proc imageFilterMultDivby4*(src1: cstring, src2: cstring, dest: cstring, len: cint): cint{.cdecl, importc: "SDL_imageFilterMultDivby4", dynlib: gfxLibName.} # SDL_imageFilterBitAnd: D = S1 & S2 -proc imageFilterBitAnd*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{. +proc imageFilterBitAnd*(src1: cstring, src2: cstring, dest: cstring, len: cint): cint{. cdecl, importc: "SDL_imageFilterBitAnd", dynlib: gfxLibName.} # SDL_imageFilterBitOr: D = S1 | S2 -proc imageFilterBitOr*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{. +proc imageFilterBitOr*(src1: cstring, src2: cstring, dest: cstring, len: cint): cint{. cdecl, importc: "SDL_imageFilterBitOr", dynlib: gfxLibName.} # SDL_imageFilterDiv: D = S1 / S2 (non-MMX) -proc imageFilterDiv*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{. +proc imageFilterDiv*(src1: cstring, src2: cstring, dest: cstring, len: cint): cint{. cdecl, importc: "SDL_imageFilterDiv", dynlib: gfxLibName.} # SDL_imageFilterBitNegation: D = !S -proc imageFilterBitNegation*(Src1: cstring, Dest: cstring, len: cint): cint{. +proc imageFilterBitNegation*(src1: cstring, dest: cstring, len: cint): cint{. cdecl, importc: "SDL_imageFilterBitNegation", dynlib: gfxLibName.} # SDL_imageFilterAddByte: D = saturation255(S + C) -proc imageFilterAddByte*(Src1: cstring, Dest: cstring, len: cint, C: char): cint{. +proc imageFilterAddByte*(src1: cstring, dest: cstring, len: cint, c: char): cint{. cdecl, importc: "SDL_imageFilterAddByte", dynlib: gfxLibName.} # SDL_imageFilterAddUint: D = saturation255(S + (uint)C) -proc imageFilterAddUint*(Src1: cstring, Dest: cstring, len: cint, C: cint): cint{. +proc imageFilterAddUint*(src1: cstring, dest: cstring, len: cint, c: cint): cint{. cdecl, importc: "SDL_imageFilterAddUint", dynlib: gfxLibName.} # SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C) -proc imageFilterAddByteToHalf*(Src1: cstring, Dest: cstring, len: cint, C: char): cint{. +proc imageFilterAddByteToHalf*(src1: cstring, dest: cstring, len: cint, c: char): cint{. cdecl, importc: "SDL_imageFilterAddByteToHalf", dynlib: gfxLibName.} # SDL_imageFilterSubByte: D = saturation0(S - C) -proc imageFilterSubByte*(Src1: cstring, Dest: cstring, len: cint, C: char): cint{. +proc imageFilterSubByte*(src1: cstring, dest: cstring, len: cint, c: char): cint{. cdecl, importc: "SDL_imageFilterSubByte", dynlib: gfxLibName.} # SDL_imageFilterSubUint: D = saturation0(S - (uint)C) -proc imageFilterSubUint*(Src1: cstring, Dest: cstring, len: cint, C: cint): cint{. +proc imageFilterSubUint*(src1: cstring, dest: cstring, len: cint, c: cint): cint{. cdecl, importc: "SDL_imageFilterSubUint", dynlib: gfxLibName.} # SDL_imageFilterShiftRight: D = saturation0(S >> N) -proc imageFilterShiftRight*(Src1: cstring, Dest: cstring, len: cint, N: char): cint{. +proc imageFilterShiftRight*(src1: cstring, dest: cstring, len: cint, n: char): cint{. cdecl, importc: "SDL_imageFilterShiftRight", dynlib: gfxLibName.} # SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N) -proc imageFilterShiftRightUint*(Src1: cstring, Dest: cstring, len: cint, N: char): cint{. +proc imageFilterShiftRightUint*(src1: cstring, dest: cstring, len: cint, n: char): cint{. cdecl, importc: "SDL_imageFilterShiftRightUint", dynlib: gfxLibName.} # SDL_imageFilterMultByByte: D = saturation255(S * C) -proc imageFilterMultByByte*(Src1: cstring, Dest: cstring, len: cint, C: char): cint{. +proc imageFilterMultByByte*(src1: cstring, dest: cstring, len: cint, c: char): cint{. cdecl, importc: "SDL_imageFilterMultByByte", dynlib: gfxLibName.} # SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C) -proc imageFilterShiftRightAndMultByByte*(Src1: cstring, Dest: cstring, len: cint, - N: char, C: char): cint{.cdecl, +proc imageFilterShiftRightAndMultByByte*(src1: cstring, dest: cstring, len: cint, + n: char, c: char): cint{.cdecl, importc: "SDL_imageFilterShiftRightAndMultByByte", dynlib: gfxLibName.} # SDL_imageFilterShiftLeftByte: D = (S << N) -proc imageFilterShiftLeftByte*(Src1: cstring, Dest: cstring, len: cint, N: char): cint{. +proc imageFilterShiftLeftByte*(src1: cstring, dest: cstring, len: cint, n: char): cint{. cdecl, importc: "SDL_imageFilterShiftLeftByte", dynlib: gfxLibName.} # SDL_imageFilterShiftLeftUint: D = ((uint)S << N) -proc imageFilterShiftLeftUint*(Src1: cstring, Dest: cstring, len: cint, N: char): cint{. +proc imageFilterShiftLeftUint*(src1: cstring, dest: cstring, len: cint, n: char): cint{. cdecl, importc: "SDL_imageFilterShiftLeftUint", dynlib: gfxLibName.} # SDL_imageFilterShiftLeft: D = saturation255(S << N) -proc imageFilterShiftLeft*(Src1: cstring, Dest: cstring, len: cint, N: char): cint{. +proc imageFilterShiftLeft*(src1: cstring, dest: cstring, len: cint, n: char): cint{. cdecl, importc: "SDL_imageFilterShiftLeft", dynlib: gfxLibName.} # SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0 -proc imageFilterBinarizeUsingThreshold*(Src1: cstring, Dest: cstring, len: cint, - T: char): cint{.cdecl, +proc imageFilterBinarizeUsingThreshold*(src1: cstring, dest: cstring, len: cint, + t: char): cint{.cdecl, importc: "SDL_imageFilterBinarizeUsingThreshold", dynlib: gfxLibName.} # SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0 -proc imageFilterClipToRange*(Src1: cstring, Dest: cstring, len: cint, Tmin: int8, - Tmax: int8): cint{.cdecl, +proc imageFilterClipToRange*(src1: cstring, dest: cstring, len: cint, tmin: int8, + tmax: int8): cint{.cdecl, importc: "SDL_imageFilterClipToRange", dynlib: gfxLibName.} # SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) -proc imageFilterNormalizeLinear*(Src1: cstring, Dest: cstring, len: cint, - Cmin: cint, Cmax: cint, Nmin: cint, Nmax: cint): cint{. +proc imageFilterNormalizeLinear*(src1: cstring, dest: cstring, len: cint, + cmin: cint, cmax: cint, nmin: cint, nmax: cint): cint{. cdecl, importc: "SDL_imageFilterNormalizeLinear", dynlib: gfxLibName.} # !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!! # SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... ) -proc imageFilterConvolveKernel3x3Divide*(Src: cstring, Dest: cstring, rows: cint, - columns: cint, Kernel: pointer, Divisor: int8): cint{.cdecl, +proc imageFilterConvolveKernel3x3Divide*(src: cstring, dest: cstring, rows: cint, + columns: cint, kernel: pointer, divisor: int8): cint{.cdecl, importc: "SDL_imageFilterConvolveKernel3x3Divide", dynlib: gfxLibName.} # SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... ) -proc imageFilterConvolveKernel5x5Divide*(Src: cstring, Dest: cstring, rows: cint, - columns: cint, Kernel: pointer, Divisor: int8): cint{.cdecl, +proc imageFilterConvolveKernel5x5Divide*(src: cstring, dest: cstring, rows: cint, + columns: cint, kernel: pointer, divisor: int8): cint{.cdecl, importc: "SDL_imageFilterConvolveKernel5x5Divide", dynlib: gfxLibName.} # SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... ) -proc imageFilterConvolveKernel7x7Divide*(Src: cstring, Dest: cstring, rows: cint, - columns: cint, Kernel: pointer, Divisor: int8): cint{.cdecl, +proc imageFilterConvolveKernel7x7Divide*(src: cstring, dest: cstring, rows: cint, + columns: cint, kernel: pointer, divisor: int8): cint{.cdecl, importc: "SDL_imageFilterConvolveKernel7x7Divide", dynlib: gfxLibName.} # SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... ) -proc imageFilterConvolveKernel9x9Divide*(Src: cstring, Dest: cstring, rows: cint, - columns: cint, Kernel: pointer, Divisor: int8): cint{.cdecl, +proc imageFilterConvolveKernel9x9Divide*(src: cstring, dest: cstring, rows: cint, + columns: cint, kernel: pointer, divisor: int8): cint{.cdecl, importc: "SDL_imageFilterConvolveKernel9x9Divide", dynlib: gfxLibName.} # SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... ) -proc imageFilterConvolveKernel3x3ShiftRight*(Src: cstring, Dest: cstring, - rows: cint, columns: cint, Kernel: pointer, NRightShift: char): cint{.cdecl, +proc imageFilterConvolveKernel3x3ShiftRight*(src: cstring, dest: cstring, + rows: cint, columns: cint, kernel: pointer, nRightShift: char): cint{.cdecl, importc: "SDL_imageFilterConvolveKernel3x3ShiftRight", dynlib: gfxLibName.} # SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... ) -proc imageFilterConvolveKernel5x5ShiftRight*(Src: cstring, Dest: cstring, - rows: cint, columns: cint, Kernel: pointer, NRightShift: char): cint{.cdecl, +proc imageFilterConvolveKernel5x5ShiftRight*(src: cstring, dest: cstring, + rows: cint, columns: cint, kernel: pointer, nRightShift: char): cint{.cdecl, importc: "SDL_imageFilterConvolveKernel5x5ShiftRight", dynlib: gfxLibName.} # SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... ) -proc imageFilterConvolveKernel7x7ShiftRight*(Src: cstring, Dest: cstring, - rows: cint, columns: cint, Kernel: pointer, NRightShift: char): cint{.cdecl, +proc imageFilterConvolveKernel7x7ShiftRight*(src: cstring, dest: cstring, + rows: cint, columns: cint, kernel: pointer, nRightShift: char): cint{.cdecl, importc: "SDL_imageFilterConvolveKernel7x7ShiftRight", dynlib: gfxLibName.} # SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... ) -proc imageFilterConvolveKernel9x9ShiftRight*(Src: cstring, Dest: cstring, - rows: cint, columns: cint, Kernel: pointer, NRightShift: char): cint{.cdecl, +proc imageFilterConvolveKernel9x9ShiftRight*(src: cstring, dest: cstring, + rows: cint, columns: cint, kernel: pointer, nRightShift: char): cint{.cdecl, importc: "SDL_imageFilterConvolveKernel9x9ShiftRight", dynlib: gfxLibName.} # SDL_imageFilterSobelX: Dij = saturation255( ... ) -proc imageFilterSobelX*(Src: cstring, Dest: cstring, rows: cint, columns: cint): cint{. +proc imageFilterSobelX*(src: cstring, dest: cstring, rows: cint, columns: cint): cint{. cdecl, importc: "SDL_imageFilterSobelX", dynlib: gfxLibName.} # SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... ) -proc imageFilterSobelXShiftRight*(Src: cstring, Dest: cstring, rows: cint, - columns: cint, NRightShift: char): cint{.cdecl, +proc imageFilterSobelXShiftRight*(src: cstring, dest: cstring, rows: cint, + columns: cint, nRightShift: char): cint{.cdecl, importc: "SDL_imageFilterSobelXShiftRight", dynlib: gfxLibName.} # Align/restore stack to 32 byte boundary -- Functionality untested! -- proc imageFilterAlignStack*(){.cdecl, importc: "SDL_imageFilterAlignStack", diff --git a/lib/wrappers/sdl/sdl_image.nim b/lib/wrappers/sdl/sdl_image.nim index 2bd731506..9c56e6a46 100644 --- a/lib/wrappers/sdl/sdl_image.nim +++ b/lib/wrappers/sdl/sdl_image.nim @@ -148,13 +148,13 @@ const # This macro can be used to fill a version structure with the compile-time # version of the SDL_image library. -proc IMAGE_VERSION*(X: var TVersion) +proc imageVersion*(x: var Tversion) # This function gets the version of the dynamically linked SDL_image library. # it should NOT be used to fill a version structure, instead you should # use the SDL_IMAGE_VERSION() macro. # -proc IMG_Linked_Version*(): Pversion{.importc: "IMG_Linked_Version", - dynlib: ImageLibName.} +proc imgLinkedVersion*(): Pversion{.importc: "IMG_Linked_Version", + dynlib: ImageLibName.} # Load an image from an SDL data source. # The 'type' may be one of: "BMP", "GIF", "PNG", etc. # @@ -170,74 +170,74 @@ const IMG_INIT_TIF* = 0x00000004 IMG_INIT_WEBP* = 0x00000008 -proc IMG_Init*(flags: cint): int {.cdecl, importc: "IMG_Init", +proc imgInit*(flags: cint): int {.cdecl, importc: "IMG_Init", dynlib: ImageLibName.} -proc IMG_Quit*() {.cdecl, importc: "IMG_Quit", +proc imgQuit*() {.cdecl, importc: "IMG_Quit", dynlib: ImageLibName.} -proc IMG_LoadTyped_RW*(src: PRWops, freesrc: cint, theType: cstring): PSurface{. +proc imgLoadTypedRW*(src: PRWops, freesrc: cint, theType: cstring): PSurface{. cdecl, importc: "IMG_LoadTyped_RW", dynlib: ImageLibName.} # Convenience functions -proc IMG_Load*(theFile: cstring): PSurface{.cdecl, importc: "IMG_Load", +proc imgLoad*(theFile: cstring): PSurface{.cdecl, importc: "IMG_Load", dynlib: ImageLibName.} -proc IMG_Load_RW*(src: PRWops, freesrc: cint): PSurface{.cdecl, +proc imgLoadRW*(src: PRWops, freesrc: cint): PSurface{.cdecl, importc: "IMG_Load_RW", dynlib: ImageLibName.} # Invert the alpha of a surface for use with OpenGL # This function is now a no-op, and only provided for backwards compatibility. -proc IMG_InvertAlpha*(theOn: cint): cint{.cdecl, importc: "IMG_InvertAlpha", +proc imgInvertAlpha*(theOn: cint): cint{.cdecl, importc: "IMG_InvertAlpha", dynlib: ImageLibName.} # Functions to detect a file type, given a seekable source -proc IMG_isBMP*(src: PRWops): cint{.cdecl, importc: "IMG_isBMP", +proc imgIsBMP*(src: PRWops): cint{.cdecl, importc: "IMG_isBMP", dynlib: ImageLibName.} -proc IMG_isGIF*(src: PRWops): cint{.cdecl, importc: "IMG_isGIF", +proc imgIsGIF*(src: PRWops): cint{.cdecl, importc: "IMG_isGIF", dynlib: ImageLibName.} -proc IMG_isJPG*(src: PRWops): cint{.cdecl, importc: "IMG_isJPG", +proc imgIsJPG*(src: PRWops): cint{.cdecl, importc: "IMG_isJPG", dynlib: ImageLibName.} -proc IMG_isLBM*(src: PRWops): cint{.cdecl, importc: "IMG_isLBM", +proc imgIsLBM*(src: PRWops): cint{.cdecl, importc: "IMG_isLBM", dynlib: ImageLibName.} -proc IMG_isPCX*(src: PRWops): cint{.cdecl, importc: "IMG_isPCX", +proc imgIsPCX*(src: PRWops): cint{.cdecl, importc: "IMG_isPCX", dynlib: ImageLibName.} -proc IMG_isPNG*(src: PRWops): cint{.cdecl, importc: "IMG_isPNG", +proc imgIsPNG*(src: PRWops): cint{.cdecl, importc: "IMG_isPNG", dynlib: ImageLibName.} -proc IMG_isPNM*(src: PRWops): cint{.cdecl, importc: "IMG_isPNM", +proc imgIsPNM*(src: PRWops): cint{.cdecl, importc: "IMG_isPNM", dynlib: ImageLibName.} -proc IMG_isTIF*(src: PRWops): cint{.cdecl, importc: "IMG_isTIF", +proc imgIsTIF*(src: PRWops): cint{.cdecl, importc: "IMG_isTIF", dynlib: ImageLibName.} -proc IMG_isXCF*(src: PRWops): cint{.cdecl, importc: "IMG_isXCF", +proc imgIsXCF*(src: PRWops): cint{.cdecl, importc: "IMG_isXCF", dynlib: ImageLibName.} -proc IMG_isXPM*(src: PRWops): cint{.cdecl, importc: "IMG_isXPM", +proc imgIsXPM*(src: PRWops): cint{.cdecl, importc: "IMG_isXPM", dynlib: ImageLibName.} -proc IMG_isXV*(src: PRWops): cint{.cdecl, importc: "IMG_isXV", +proc imgIsXV*(src: PRWops): cint{.cdecl, importc: "IMG_isXV", dynlib: ImageLibName.} # Individual loading functions -proc IMG_LoadBMP_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadBMP_RW", +proc imgLoadBMP_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadBMP_RW", dynlib: ImageLibName.} -proc IMG_LoadGIF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadGIF_RW", +proc imgLoadGIF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadGIF_RW", dynlib: ImageLibName.} -proc IMG_LoadJPG_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadJPG_RW", +proc imgLoadJPG_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadJPG_RW", dynlib: ImageLibName.} -proc IMG_LoadLBM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadLBM_RW", +proc imgLoadLBM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadLBM_RW", dynlib: ImageLibName.} -proc IMG_LoadPCX_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPCX_RW", +proc imgLoadPCX_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPCX_RW", dynlib: ImageLibName.} -proc IMG_LoadPNM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPNM_RW", +proc imgLoadPNM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPNM_RW", dynlib: ImageLibName.} -proc IMG_LoadPNG_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPNG_RW", +proc imgLoadPNG_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPNG_RW", dynlib: ImageLibName.} -proc IMG_LoadTGA_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadTGA_RW", +proc imgLoadTGA_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadTGA_RW", dynlib: ImageLibName.} -proc IMG_LoadTIF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadTIF_RW", +proc imgLoadTIF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadTIF_RW", dynlib: ImageLibName.} -proc IMG_LoadXCF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXCF_RW", +proc imgLoadXCF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXCF_RW", dynlib: ImageLibName.} -proc IMG_LoadXPM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXPM_RW", +proc imgLoadXPM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXPM_RW", dynlib: ImageLibName.} -proc IMG_LoadXV_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXV_RW", +proc imgLoadXV_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXV_RW", dynlib: ImageLibName.} -proc IMG_ReadXPMFromArray*(xpm: cstringArray): PSurface{.cdecl, +proc imgReadXPMFromArray*(xpm: cstringArray): PSurface{.cdecl, importc: "IMG_ReadXPMFromArray", dynlib: ImageLibName.} -proc IMAGE_VERSION(X: var TVersion) = - X.major = IMAGE_MAJOR_VERSION - X.minor = IMAGE_MINOR_VERSION - X.patch = IMAGE_PATCHLEVEL +proc imageVersion(x: var Tversion) = + x.major = IMAGE_MAJOR_VERSION + x.minor = IMAGE_MINOR_VERSION + x.patch = IMAGE_PATCHLEVEL diff --git a/lib/wrappers/sdl/sdl_mixer.nim b/lib/wrappers/sdl/sdl_mixer.nim index 9199a9271..33a71508a 100644 --- a/lib/wrappers/sdl/sdl_mixer.nim +++ b/lib/wrappers/sdl/sdl_mixer.nim @@ -196,7 +196,7 @@ type #music_cmd.h types PWAVStream* = ptr TWAVStream TWAVStream*{.final.} = object #playmidi.h types - wavefp*: Pointer + wavefp*: pointer start*: int32 stop*: int32 cvt*: TAudioCVT @@ -223,8 +223,8 @@ type #music_cmd.h types volume*: int32 #vf: OggVorbis_File; section*: int32 cvt*: TAudioCVT - len_available*: int32 - snd_available*: pointer + lenAvailable*: int32 + sndAvailable*: pointer TErrorEnum* = enum MMERR_OPENING_FILE, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING, @@ -255,7 +255,7 @@ type #music_cmd.h types TChunk*{.final.} = object allocated*: cint abuf*: pointer - alen*: Uint32 + alen*: uint32 volume*: byte # Per-sample volume, 0-128 TFading* = enum @@ -272,18 +272,18 @@ type #music_cmd.h types # fade_steps : integer; # error : integer; - TMixFunction* = proc (udata, stream: pointer, length: cint): Pointer{. + TMixFunction* = proc (udata, stream: pointer, length: cint): pointer{. cdecl.} # This macro can be used to fill a version structure with the compile-time # version of the SDL_mixer library. -proc VERSION*(X: var sdl.TVersion) +proc version*(x: var sdl.Tversion) # This function gets the version of the dynamically linked SDL_mixer library. # It should NOT be used to fill a version structure, instead you should use the # SDL_MIXER_VERSION() macro. -proc Linked_Version*(): sdl.Pversion{.cdecl, importc: "Mix_Linked_Version", +proc linkedVersion*(): sdl.Pversion{.cdecl, importc: "Mix_Linked_Version", dynlib: MixerLibName.} # Open the mixer with a certain audio format -proc OpenAudio*(frequency: cint, format: Uint16, channels: cint, +proc openAudio*(frequency: cint, format: uint16, channels: cint, chunksize: cint): cint{.cdecl, importc: "Mix_OpenAudio", dynlib: MixerLibName.} # Dynamically change the number of channels managed by the mixer. @@ -291,194 +291,194 @@ proc OpenAudio*(frequency: cint, format: Uint16, channels: cint, # stopped. # This function returns the new number of allocated channels. # -proc AllocateChannels*(numchannels: cint): cint{.cdecl, +proc allocateChannels*(numchannels: cint): cint{.cdecl, importc: "Mix_AllocateChannels", dynlib: MixerLibName.} # Find out what the actual audio device parameters are. # This function returns 1 if the audio has been opened, 0 otherwise. # -proc QuerySpec*(frequency: var cint, format: var Uint16, channels: var cint): cint{. +proc querySpec*(frequency: var cint, format: var uint16, channels: var cint): cint{. cdecl, importc: "Mix_QuerySpec", dynlib: MixerLibName.} # Load a wave file or a music (.mod .s3m .it .xm) file -proc LoadWAV_RW*(src: PRWops, freesrc: cint): PChunk{.cdecl, +proc loadWAV_RW*(src: PRWops, freesrc: cint): PChunk{.cdecl, importc: "Mix_LoadWAV_RW", dynlib: MixerLibName.} -proc LoadWAV*(filename: cstring): PChunk -proc LoadMUS*(filename: cstring): PMusic{.cdecl, importc: "Mix_LoadMUS", +proc loadWAV*(filename: cstring): PChunk +proc loadMUS*(filename: cstring): PMusic{.cdecl, importc: "Mix_LoadMUS", dynlib: MixerLibName.} # Load a wave file of the mixer format from a memory buffer -proc QuickLoad_WAV*(mem: pointer): PChunk{.cdecl, +proc quickLoadWAV*(mem: pointer): PChunk{.cdecl, importc: "Mix_QuickLoad_WAV", dynlib: MixerLibName.} # Free an audio chunk previously loaded -proc FreeChunk*(chunk: PChunk){.cdecl, importc: "Mix_FreeChunk", +proc freeChunk*(chunk: PChunk){.cdecl, importc: "Mix_FreeChunk", dynlib: MixerLibName.} -proc FreeMusic*(music: PMusic){.cdecl, importc: "Mix_FreeMusic", +proc freeMusic*(music: PMusic){.cdecl, importc: "Mix_FreeMusic", dynlib: MixerLibName.} # Find out the music format of a mixer music, or the currently playing # music, if 'music' is NULL. -proc GetMusicType*(music: PMusic): TMusicType{.cdecl, +proc getMusicType*(music: PMusic): TMusicType{.cdecl, importc: "Mix_GetMusicType", dynlib: MixerLibName.} # Set a function that is called after all mixing is performed. # This can be used to provide real-time visual display of the audio stream # or add a custom mixer filter for the stream data. # -proc SetPostMix*(mix_func: TMixFunction, arg: Pointer){.cdecl, +proc setPostMix*(mixFunc: TMixFunction, arg: pointer){.cdecl, importc: "Mix_SetPostMix", dynlib: MixerLibName.} # Add your own music player or additional mixer function. # If 'mix_func' is NULL, the default music player is re-enabled. # -proc HookMusic*(mix_func: TMixFunction, arg: Pointer){.cdecl, +proc hookMusic*(mixFunc: TMixFunction, arg: pointer){.cdecl, importc: "Mix_HookMusic", dynlib: MixerLibName.} # Add your own callback when the music has finished playing. # -proc HookMusicFinished*(music_finished: Pointer){.cdecl, +proc hookMusicFinished*(musicFinished: pointer){.cdecl, importc: "Mix_HookMusicFinished", dynlib: MixerLibName.} # Get a pointer to the user data for the current music hook -proc GetMusicHookData*(): Pointer{.cdecl, importc: "Mix_GetMusicHookData", +proc getMusicHookData*(): pointer{.cdecl, importc: "Mix_GetMusicHookData", dynlib: MixerLibName.} #* Add your own callback when a channel has finished playing. NULL # * to disable callback.* type - TChannel_finished* = proc (channel: cint){.cdecl.} + TChannelFinished* = proc (channel: cint){.cdecl.} -proc ChannelFinished*(channel_finished: TChannel_finished){.cdecl, +proc channelFinished*(channelFinished: TChannelFinished){.cdecl, importc: "Mix_ChannelFinished", dynlib: MixerLibName.} const CHANNEL_POST* = - 2 type - TEffectFunc* = proc (chan: cint, stream: Pointer, length: cint, - udata: Pointer): Pointer{.cdecl.} - TEffectDone* = proc (chan: cint, udata: Pointer): Pointer{.cdecl.} -proc RegisterEffect*(chan: cint, f: TEffectFunc, d: TEffectDone, - arg: Pointer): cint{.cdecl, + TEffectFunc* = proc (chan: cint, stream: pointer, length: cint, + udata: pointer): pointer{.cdecl.} + TEffectDone* = proc (chan: cint, udata: pointer): pointer{.cdecl.} +proc registerEffect*(chan: cint, f: TEffectFunc, d: TEffectDone, + arg: pointer): cint{.cdecl, importc: "Mix_RegisterEffect", dynlib: MixerLibName.} -proc UnregisterEffect*(channel: cint, f: TEffectFunc): cint{.cdecl, +proc unregisterEffect*(channel: cint, f: TEffectFunc): cint{.cdecl, importc: "Mix_UnregisterEffect", dynlib: MixerLibName.} -proc UnregisterAllEffects*(channel: cint): cint{.cdecl, +proc unregisterAllEffects*(channel: cint): cint{.cdecl, importc: "Mix_UnregisterAllEffects", dynlib: MixerLibName.} const EFFECTSMAXSPEED* = "MIX_EFFECTSMAXSPEED" -proc SetPanning*(channel: cint, left: byte, right: byte): cint{.cdecl, +proc setPanning*(channel: cint, left: byte, right: byte): cint{.cdecl, importc: "Mix_SetPanning", dynlib: MixerLibName.} -proc SetPosition*(channel: cint, angle: int16, distance: byte): cint{.cdecl, +proc setPosition*(channel: cint, angle: int16, distance: byte): cint{.cdecl, importc: "Mix_SetPosition", dynlib: MixerLibName.} -proc SetDistance*(channel: cint, distance: byte): cint{.cdecl, +proc setDistance*(channel: cint, distance: byte): cint{.cdecl, importc: "Mix_SetDistance", dynlib: MixerLibName.} -proc SetReverseStereo*(channel: cint, flip: cint): cint{.cdecl, +proc setReverseStereo*(channel: cint, flip: cint): cint{.cdecl, importc: "Mix_SetReverseStereo", dynlib: MixerLibName.} -proc ReserveChannels*(num: cint): cint{.cdecl, importc: "Mix_ReserveChannels", +proc reserveChannels*(num: cint): cint{.cdecl, importc: "Mix_ReserveChannels", dynlib: MixerLibName.} -proc GroupChannel*(which: cint, tag: cint): cint{.cdecl, +proc groupChannel*(which: cint, tag: cint): cint{.cdecl, importc: "Mix_GroupChannel", dynlib: MixerLibName.} -proc GroupChannels*(`from`: cint, `to`: cint, tag: cint): cint{.cdecl, +proc groupChannels*(`from`: cint, `to`: cint, tag: cint): cint{.cdecl, importc: "Mix_GroupChannels", dynlib: MixerLibName.} -proc GroupAvailable*(tag: cint): cint{.cdecl, importc: "Mix_GroupAvailable", +proc groupAvailable*(tag: cint): cint{.cdecl, importc: "Mix_GroupAvailable", dynlib: MixerLibName.} -proc GroupCount*(tag: cint): cint{.cdecl, importc: "Mix_GroupCount", +proc groupCount*(tag: cint): cint{.cdecl, importc: "Mix_GroupCount", dynlib: MixerLibName.} -proc GroupOldest*(tag: cint): cint{.cdecl, importc: "Mix_GroupOldest", +proc groupOldest*(tag: cint): cint{.cdecl, importc: "Mix_GroupOldest", dynlib: MixerLibName.} -proc GroupNewer*(tag: cint): cint{.cdecl, importc: "Mix_GroupNewer", +proc groupNewer*(tag: cint): cint{.cdecl, importc: "Mix_GroupNewer", dynlib: MixerLibName.} -proc PlayChannelTimed*(channel: cint, chunk: PChunk, loops: cint, +proc playChannelTimed*(channel: cint, chunk: PChunk, loops: cint, ticks: cint): cint{.cdecl, importc: "Mix_PlayChannelTimed", dynlib: MixerLibName.} -proc PlayChannel*(channel: cint, chunk: PChunk, loops: cint): cint -proc PlayMusic*(music: PMusic, loops: cint): cint{.cdecl, +proc playChannel*(channel: cint, chunk: PChunk, loops: cint): cint +proc playMusic*(music: PMusic, loops: cint): cint{.cdecl, importc: "Mix_PlayMusic", dynlib: MixerLibName.} -proc FadeInMusic*(music: PMusic, loops: cint, ms: cint): cint{.cdecl, +proc fadeInMusic*(music: PMusic, loops: cint, ms: cint): cint{.cdecl, importc: "Mix_FadeInMusic", dynlib: MixerLibName.} -proc FadeInChannelTimed*(channel: cint, chunk: PChunk, loops: cint, +proc fadeInChannelTimed*(channel: cint, chunk: PChunk, loops: cint, ms: cint, ticks: cint): cint{.cdecl, importc: "Mix_FadeInChannelTimed", dynlib: MixerLibName.} -proc FadeInChannel*(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint +proc fadeInChannel*(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint -proc Volume*(channel: cint, volume: cint): cint{.cdecl, importc: "Mix_Volume", +proc volume*(channel: cint, volume: cint): cint{.cdecl, importc: "Mix_Volume", dynlib: MixerLibName.} -proc VolumeChunk*(chunk: PChunk, volume: cint): cint{.cdecl, +proc volumeChunk*(chunk: PChunk, volume: cint): cint{.cdecl, importc: "Mix_VolumeChunk", dynlib: MixerLibName.} -proc VolumeMusic*(volume: cint): cint{.cdecl, importc: "Mix_VolumeMusic", +proc volumeMusic*(volume: cint): cint{.cdecl, importc: "Mix_VolumeMusic", dynlib: MixerLibName.} -proc HaltChannel*(channel: cint): cint{.cdecl, importc: "Mix_HaltChannel", +proc haltChannel*(channel: cint): cint{.cdecl, importc: "Mix_HaltChannel", dynlib: MixerLibName.} -proc HaltGroup*(tag: cint): cint{.cdecl, importc: "Mix_HaltGroup", +proc haltGroup*(tag: cint): cint{.cdecl, importc: "Mix_HaltGroup", dynlib: MixerLibName.} -proc HaltMusic*(): cint{.cdecl, importc: "Mix_HaltMusic", +proc haltMusic*(): cint{.cdecl, importc: "Mix_HaltMusic", dynlib: MixerLibName.} # Change the expiration delay for a particular channel. # The sample will stop playing after the 'ticks' milliseconds have elapsed, # or remove the expiration if 'ticks' is -1 # -proc ExpireChannel*(channel: cint, ticks: cint): cint{.cdecl, +proc expireChannel*(channel: cint, ticks: cint): cint{.cdecl, importc: "Mix_ExpireChannel", dynlib: MixerLibName.} # Halt a channel, fading it out progressively till it's silent # The ms parameter indicates the number of milliseconds the fading # will take. # -proc FadeOutChannel*(which: cint, ms: cint): cint{.cdecl, +proc fadeOutChannel*(which: cint, ms: cint): cint{.cdecl, importc: "Mix_FadeOutChannel", dynlib: MixerLibName.} -proc FadeOutGroup*(tag: cint, ms: cint): cint{.cdecl, +proc fadeOutGroup*(tag: cint, ms: cint): cint{.cdecl, importc: "Mix_FadeOutGroup", dynlib: MixerLibName.} -proc FadeOutMusic*(ms: cint): cint{.cdecl, importc: "Mix_FadeOutMusic", +proc fadeOutMusic*(ms: cint): cint{.cdecl, importc: "Mix_FadeOutMusic", dynlib: MixerLibName.} # Query the fading status of a channel -proc FadingMusic*(): TFading{.cdecl, importc: "Mix_FadingMusic", +proc fadingMusic*(): TFading{.cdecl, importc: "Mix_FadingMusic", dynlib: MixerLibName.} -proc FadingChannel*(which: cint): TFading{.cdecl, +proc fadingChannel*(which: cint): TFading{.cdecl, importc: "Mix_FadingChannel", dynlib: MixerLibName.} -proc Pause*(channel: cint){.cdecl, importc: "Mix_Pause", dynlib: MixerLibName.} -proc Resume*(channel: cint){.cdecl, importc: "Mix_Resume", +proc pause*(channel: cint){.cdecl, importc: "Mix_Pause", dynlib: MixerLibName.} +proc resume*(channel: cint){.cdecl, importc: "Mix_Resume", dynlib: MixerLibName.} -proc Paused*(channel: cint): cint{.cdecl, importc: "Mix_Paused", +proc paused*(channel: cint): cint{.cdecl, importc: "Mix_Paused", dynlib: MixerLibName.} -proc PauseMusic*(){.cdecl, importc: "Mix_PauseMusic", dynlib: MixerLibName.} -proc ResumeMusic*(){.cdecl, importc: "Mix_ResumeMusic", dynlib: MixerLibName.} -proc RewindMusic*(){.cdecl, importc: "Mix_RewindMusic", dynlib: MixerLibName.} -proc PausedMusic*(): cint{.cdecl, importc: "Mix_PausedMusic", +proc pauseMusic*(){.cdecl, importc: "Mix_PauseMusic", dynlib: MixerLibName.} +proc resumeMusic*(){.cdecl, importc: "Mix_ResumeMusic", dynlib: MixerLibName.} +proc rewindMusic*(){.cdecl, importc: "Mix_RewindMusic", dynlib: MixerLibName.} +proc pausedMusic*(): cint{.cdecl, importc: "Mix_PausedMusic", dynlib: MixerLibName.} -proc SetMusicPosition*(position: float64): cint{.cdecl, +proc setMusicPosition*(position: float64): cint{.cdecl, importc: "Mix_SetMusicPosition", dynlib: MixerLibName.} -proc Playing*(channel: cint): cint{.cdecl, importc: "Mix_Playing", +proc playing*(channel: cint): cint{.cdecl, importc: "Mix_Playing", dynlib: MixerLibName.} -proc PlayingMusic*(): cint{.cdecl, importc: "Mix_PlayingMusic", +proc playingMusic*(): cint{.cdecl, importc: "Mix_PlayingMusic", dynlib: MixerLibName.} -proc SetMusicCMD*(command: cstring): cint{.cdecl, importc: "Mix_SetMusicCMD", +proc setMusicCMD*(command: cstring): cint{.cdecl, importc: "Mix_SetMusicCMD", dynlib: MixerLibName.} -proc SetSynchroValue*(value: cint): cint{.cdecl, +proc setSynchroValue*(value: cint): cint{.cdecl, importc: "Mix_SetSynchroValue", dynlib: MixerLibName.} -proc GetSynchroValue*(): cint{.cdecl, importc: "Mix_GetSynchroValue", +proc getSynchroValue*(): cint{.cdecl, importc: "Mix_GetSynchroValue", dynlib: MixerLibName.} -proc GetChunk*(channel: cint): PChunk{.cdecl, importc: "Mix_GetChunk", +proc getChunk*(channel: cint): PChunk{.cdecl, importc: "Mix_GetChunk", dynlib: MixerLibName.} -proc CloseAudio*(){.cdecl, importc: "Mix_CloseAudio", dynlib: MixerLibName.} +proc closeAudio*(){.cdecl, importc: "Mix_CloseAudio", dynlib: MixerLibName.} -proc VERSION(X: var sdl.Tversion) = - X.major = MAJOR_VERSION - X.minor = MINOR_VERSION - X.patch = PATCHLEVEL +proc version(x: var sdl.Tversion) = + x.major = MAJOR_VERSION + x.minor = MINOR_VERSION + x.patch = PATCHLEVEL -proc LoadWAV(filename: cstring): PChunk = - result = LoadWAV_RW(RWFromFile(filename, "rb"), 1) +proc loadWAV(filename: cstring): PChunk = + result = loadWAV_RW(rWFromFile(filename, "rb"), 1) -proc PlayChannel(channel: cint, chunk: PChunk, loops: cint): cint = - result = PlayChannelTimed(channel, chunk, loops, - 1) +proc playChannel(channel: cint, chunk: PChunk, loops: cint): cint = + result = playChannelTimed(channel, chunk, loops, - 1) -proc FadeInChannel(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint = - result = FadeInChannelTimed(channel, chunk, loops, ms, - 1) +proc fadeInChannel(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint = + result = fadeInChannelTimed(channel, chunk, loops, ms, - 1) diff --git a/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim b/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim index 11f00e0a7..7a8c41af1 100644 --- a/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim +++ b/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim @@ -48,7 +48,7 @@ type #music_cmd.h types PWAVStream* = ptr TWAVStream TWAVStream*{.final.} = object #playmidi.h types - wavefp*: Pointer + wavefp*: pointer start*: int32 stop*: int32 cvt*: TAudioCVT @@ -75,8 +75,8 @@ type #music_cmd.h types volume*: cint #vf: OggVorbis_File; section*: cint cvt*: TAudioCVT - len_available*: cint - snd_available*: pointer + lenAvailable*: cint + sndAvailable*: pointer TErrorEnum* = enum MMERR_OPENING_FILE, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING, @@ -107,7 +107,7 @@ type #music_cmd.h types TChunk*{.final.} = object allocated*: cint abuf*: pointer - alen*: Uint32 + alen*: uint32 volume*: byte # Per-sample volume, 0-128 TFading* = enum @@ -118,18 +118,18 @@ type #music_cmd.h types TMusic*{.final.} = object typ*: TMusicType - TMixFunction* = proc (udata, stream: pointer, length: cint): Pointer{. + TMixFunction* = proc (udata, stream: pointer, length: cint): pointer{. cdecl.} # This macro can be used to fill a version structure with the compile-time # version of the SDL_mixer library. -proc VERSION*(X: var sdl.TVersion) +proc version*(x: var sdl.Tversion) # This function gets the version of the dynamically linked SDL_mixer library. # It should NOT be used to fill a version structure, instead you should use the # SDL_MIXER_VERSION() macro. -proc Linked_Version*(): sdl.Pversion{.cdecl, importc: "Mix_Linked_Version", +proc linkedVersion*(): sdl.Pversion{.cdecl, importc: "Mix_Linked_Version", dynlib: MixerLibName.} # Open the mixer with a certain audio format -proc OpenAudio*(frequency: cint, format: Uint16, channels: cint, +proc openAudio*(frequency: cint, format: uint16, channels: cint, chunksize: cint): cint{.cdecl, importc: "Mix_OpenAudio", dynlib: MixerLibName.} # Dynamically change the number of channels managed by the mixer. @@ -137,170 +137,170 @@ proc OpenAudio*(frequency: cint, format: Uint16, channels: cint, # stopped. # This function returns the new number of allocated channels. # -proc AllocateChannels*(numchannels: cint): cint{.cdecl, +proc allocateChannels*(numchannels: cint): cint{.cdecl, importc: "Mix_AllocateChannels", dynlib: MixerLibName.} # Find out what the actual audio device parameters are. # This function returns 1 if the audio has been opened, 0 otherwise. # -proc QuerySpec*(frequency: var cint, format: var Uint16, channels: var cint): cint{. +proc querySpec*(frequency: var cint, format: var uint16, channels: var cint): cint{. cdecl, importc: "Mix_QuerySpec", dynlib: MixerLibName.} # Load a wave file or a music (.mod .s3m .it .xm) file proc LoadWAV_RW*(src: PRWops, freesrc: cint): PChunk{.cdecl, importc: "Mix_LoadWAV_RW", dynlib: MixerLibName.} -proc LoadWAV*(filename: cstring): PChunk -proc LoadMUS*(filename: cstring): PMusic{.cdecl, importc: "Mix_LoadMUS", +proc loadWAV*(filename: cstring): PChunk +proc loadMUS*(filename: cstring): PMusic{.cdecl, importc: "Mix_LoadMUS", dynlib: MixerLibName.} # Load a wave file of the mixer format from a memory buffer -proc QuickLoad_WAV*(mem: pointer): PChunk{.cdecl, +proc quickLoadWAV*(mem: pointer): PChunk{.cdecl, importc: "Mix_QuickLoad_WAV", dynlib: MixerLibName.} # Free an audio chunk previously loaded -proc FreeChunk*(chunk: PChunk){.cdecl, importc: "Mix_FreeChunk", +proc freeChunk*(chunk: PChunk){.cdecl, importc: "Mix_FreeChunk", dynlib: MixerLibName.} -proc FreeMusic*(music: PMusic){.cdecl, importc: "Mix_FreeMusic", +proc freeMusic*(music: PMusic){.cdecl, importc: "Mix_FreeMusic", dynlib: MixerLibName.} # Find out the music format of a mixer music, or the currently playing # music, if 'music' is NULL. -proc GetMusicType*(music: PMusic): TMusicType{.cdecl, +proc getMusicType*(music: PMusic): TMusicType{.cdecl, importc: "Mix_GetMusicType", dynlib: MixerLibName.} # Set a function that is called after all mixing is performed. # This can be used to provide real-time visual display of the audio stream # or add a custom mixer filter for the stream data. # -proc SetPostMix*(mixfunc: TMixFunction, arg: Pointer){.cdecl, +proc setPostMix*(mixfunc: TMixFunction, arg: pointer){.cdecl, importc: "Mix_SetPostMix", dynlib: MixerLibName.} # Add your own music player or additional mixer function. # If 'mix_func' is NULL, the default music player is re-enabled. # -proc HookMusic*(mix_func: TMixFunction, arg: Pointer){.cdecl, +proc hookMusic*(mixFunc: TMixFunction, arg: pointer){.cdecl, importc: "Mix_HookMusic", dynlib: MixerLibName.} # Add your own callback when the music has finished playing. # -proc HookMusicFinished*(music_finished: Pointer){.cdecl, +proc hookMusicFinished*(musicFinished: pointer){.cdecl, importc: "Mix_HookMusicFinished", dynlib: MixerLibName.} # Get a pointer to the user data for the current music hook -proc GetMusicHookData*(): Pointer{.cdecl, importc: "Mix_GetMusicHookData", +proc getMusicHookData*(): pointer{.cdecl, importc: "Mix_GetMusicHookData", dynlib: MixerLibName.} #* Add your own callback when a channel has finished playing. NULL # * to disable callback.* type - TChannel_finished* = proc (channel: cint){.cdecl.} + TChannelFinished* = proc (channel: cint){.cdecl.} -proc ChannelFinished*(channel_finished: TChannel_finished){.cdecl, +proc channelFinished*(channelFinished: TChannelFinished){.cdecl, importc: "Mix_ChannelFinished", dynlib: MixerLibName.} const CHANNEL_POST* = - 2 type - TEffectFunc* = proc (chan: cint, stream: Pointer, length: cint, - udata: Pointer): Pointer{.cdecl.} - TEffectDone* = proc (chan: cint, udata: Pointer): Pointer{.cdecl.} + TEffectFunc* = proc (chan: cint, stream: pointer, length: cint, + udata: pointer): pointer{.cdecl.} + TEffectDone* = proc (chan: cint, udata: pointer): pointer{.cdecl.} -proc RegisterEffect*(chan: cint, f: TEffectFunc, d: TEffectDone, - arg: Pointer): cint{.cdecl, +proc registerEffect*(chan: cint, f: TEffectFunc, d: TEffectDone, + arg: pointer): cint{.cdecl, importc: "Mix_RegisterEffect", dynlib: MixerLibName.} -proc UnregisterEffect*(channel: cint, f: TEffectFunc): cint{.cdecl, +proc unregisterEffect*(channel: cint, f: TEffectFunc): cint{.cdecl, importc: "Mix_UnregisterEffect", dynlib: MixerLibName.} -proc UnregisterAllEffects*(channel: cint): cint{.cdecl, +proc unregisterAllEffects*(channel: cint): cint{.cdecl, importc: "Mix_UnregisterAllEffects", dynlib: MixerLibName.} const EFFECTSMAXSPEED* = "MIX_EFFECTSMAXSPEED" -proc SetPanning*(channel: cint, left: byte, right: byte): cint{.cdecl, +proc setPanning*(channel: cint, left: byte, right: byte): cint{.cdecl, importc: "Mix_SetPanning", dynlib: MixerLibName.} -proc SetPosition*(channel: cint, angle: int16, distance: byte): cint{.cdecl, +proc setPosition*(channel: cint, angle: int16, distance: byte): cint{.cdecl, importc: "Mix_SetPosition", dynlib: MixerLibName.} -proc SetDistance*(channel: cint, distance: byte): cint{.cdecl, +proc setDistance*(channel: cint, distance: byte): cint{.cdecl, importc: "Mix_SetDistance", dynlib: MixerLibName.} -proc SetReverseStereo*(channel: cint, flip: cint): cint{.cdecl, +proc setReverseStereo*(channel: cint, flip: cint): cint{.cdecl, importc: "Mix_SetReverseStereo", dynlib: MixerLibName.} -proc ReserveChannels*(num: cint): cint{.cdecl, importc: "Mix_ReserveChannels", +proc reserveChannels*(num: cint): cint{.cdecl, importc: "Mix_ReserveChannels", dynlib: MixerLibName.} -proc GroupChannel*(which: cint, tag: cint): cint{.cdecl, +proc groupChannel*(which: cint, tag: cint): cint{.cdecl, importc: "Mix_GroupChannel", dynlib: MixerLibName.} # Assign several consecutive channels to a group -proc GroupChannels*(`from`: cint, `to`: cint, tag: cint): cint{.cdecl, +proc groupChannels*(`from`: cint, `to`: cint, tag: cint): cint{.cdecl, importc: "Mix_GroupChannels", dynlib: MixerLibName.} # Finds the first available channel in a group of channels -proc GroupAvailable*(tag: cint): cint{.cdecl, importc: "Mix_GroupAvailable", +proc groupAvailable*(tag: cint): cint{.cdecl, importc: "Mix_GroupAvailable", dynlib: MixerLibName.} # Returns the number of channels in a group. This is also a subtle # way to get the total number of channels when 'tag' is -1 # -proc GroupCount*(tag: cint): cint{.cdecl, importc: "Mix_GroupCount", +proc groupCount*(tag: cint): cint{.cdecl, importc: "Mix_GroupCount", dynlib: MixerLibName.} # Finds the "oldest" sample playing in a group of channels -proc GroupOldest*(tag: cint): cint{.cdecl, importc: "Mix_GroupOldest", +proc groupOldest*(tag: cint): cint{.cdecl, importc: "Mix_GroupOldest", dynlib: MixerLibName.} # Finds the "most recent" (i.e. last) sample playing in a group of channels -proc GroupNewer*(tag: cint): cint{.cdecl, importc: "Mix_GroupNewer", +proc groupNewer*(tag: cint): cint{.cdecl, importc: "Mix_GroupNewer", dynlib: MixerLibName.} # The same as above, but the sound is played at most 'ticks' milliseconds -proc PlayChannelTimed*(channel: cint, chunk: PChunk, loops: cint, +proc playChannelTimed*(channel: cint, chunk: PChunk, loops: cint, ticks: cint): cint{.cdecl, importc: "Mix_PlayChannelTimed", dynlib: MixerLibName.} -proc PlayChannel*(channel: cint, chunk: PChunk, loops: cint): cint -proc PlayMusic*(music: PMusic, loops: cint): cint{.cdecl, +proc playChannel*(channel: cint, chunk: PChunk, loops: cint): cint +proc playMusic*(music: PMusic, loops: cint): cint{.cdecl, importc: "Mix_PlayMusic", dynlib: MixerLibName.} # Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions -proc FadeInMusic*(music: PMusic, loops: cint, ms: cint): cint{.cdecl, +proc fadeInMusic*(music: PMusic, loops: cint, ms: cint): cint{.cdecl, importc: "Mix_FadeInMusic", dynlib: MixerLibName.} -proc FadeInChannelTimed*(channel: cint, chunk: PChunk, loops: cint, +proc fadeInChannelTimed*(channel: cint, chunk: PChunk, loops: cint, ms: cint, ticks: cint): cint{.cdecl, importc: "Mix_FadeInChannelTimed", dynlib: MixerLibName.} -proc FadeInChannel*(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint +proc fadeInChannel*(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint # Set the volume in the range of 0-128 of a specific channel or chunk. # If the specified channel is -1, set volume for all channels. # Returns the original volume. # If the specified volume is -1, just return the current volume. # -proc Volume*(channel: cint, volume: cint): cint{.cdecl, importc: "Mix_Volume", +proc volume*(channel: cint, volume: cint): cint{.cdecl, importc: "Mix_Volume", dynlib: MixerLibName.} -proc VolumeChunk*(chunk: PChunk, volume: cint): cint{.cdecl, +proc volumeChunk*(chunk: PChunk, volume: cint): cint{.cdecl, importc: "Mix_VolumeChunk", dynlib: MixerLibName.} -proc VolumeMusic*(volume: cint): cint{.cdecl, importc: "Mix_VolumeMusic", +proc volumeMusic*(volume: cint): cint{.cdecl, importc: "Mix_VolumeMusic", dynlib: MixerLibName.} # Halt playing of a particular channel -proc HaltChannel*(channel: cint): cint{.cdecl, importc: "Mix_HaltChannel", +proc haltChannel*(channel: cint): cint{.cdecl, importc: "Mix_HaltChannel", dynlib: MixerLibName.} -proc HaltGroup*(tag: cint): cint{.cdecl, importc: "Mix_HaltGroup", +proc haltGroup*(tag: cint): cint{.cdecl, importc: "Mix_HaltGroup", dynlib: MixerLibName.} -proc HaltMusic*(): cint{.cdecl, importc: "Mix_HaltMusic", +proc haltMusic*(): cint{.cdecl, importc: "Mix_HaltMusic", dynlib: MixerLibName.} -proc ExpireChannel*(channel: cint, ticks: cint): cint{.cdecl, +proc expireChannel*(channel: cint, ticks: cint): cint{.cdecl, importc: "Mix_ExpireChannel", dynlib: MixerLibName.} -proc FadeOutChannel*(which: cint, ms: cint): cint{.cdecl, +proc fadeOutChannel*(which: cint, ms: cint): cint{.cdecl, importc: "Mix_FadeOutChannel", dynlib: MixerLibName.} -proc FadeOutGroup*(tag: cint, ms: cint): cint{.cdecl, +proc fadeOutGroup*(tag: cint, ms: cint): cint{.cdecl, importc: "Mix_FadeOutGroup", dynlib: MixerLibName.} -proc FadeOutMusic*(ms: cint): cint{.cdecl, importc: "Mix_FadeOutMusic", +proc fadeOutMusic*(ms: cint): cint{.cdecl, importc: "Mix_FadeOutMusic", dynlib: MixerLibName.} # Query the fading status of a channel -proc FadingMusic*(): TFading{.cdecl, importc: "Mix_FadingMusic", +proc fadingMusic*(): TFading{.cdecl, importc: "Mix_FadingMusic", dynlib: MixerLibName.} -proc FadingChannel*(which: cint): TFading{.cdecl, +proc fadingChannel*(which: cint): TFading{.cdecl, importc: "Mix_FadingChannel", dynlib: MixerLibName.} # Pause/Resume a particular channel -proc Pause*(channel: cint){.cdecl, importc: "Mix_Pause", dynlib: MixerLibName.} -proc Resume*(channel: cint){.cdecl, importc: "Mix_Resume", +proc pause*(channel: cint){.cdecl, importc: "Mix_Pause", dynlib: MixerLibName.} +proc resume*(channel: cint){.cdecl, importc: "Mix_Resume", dynlib: MixerLibName.} -proc Paused*(channel: cint): cint{.cdecl, importc: "Mix_Paused", +proc paused*(channel: cint): cint{.cdecl, importc: "Mix_Paused", dynlib: MixerLibName.} # Pause/Resume the music stream -proc PauseMusic*(){.cdecl, importc: "Mix_PauseMusic", dynlib: MixerLibName.} -proc ResumeMusic*(){.cdecl, importc: "Mix_ResumeMusic", dynlib: MixerLibName.} -proc RewindMusic*(){.cdecl, importc: "Mix_RewindMusic", dynlib: MixerLibName.} -proc PausedMusic*(): cint{.cdecl, importc: "Mix_PausedMusic", +proc pauseMusic*(){.cdecl, importc: "Mix_PauseMusic", dynlib: MixerLibName.} +proc resumeMusic*(){.cdecl, importc: "Mix_ResumeMusic", dynlib: MixerLibName.} +proc rewindMusic*(){.cdecl, importc: "Mix_RewindMusic", dynlib: MixerLibName.} +proc pausedMusic*(): cint{.cdecl, importc: "Mix_PausedMusic", dynlib: MixerLibName.} # Set the current position in the music stream. # This returns 0 if successful, or -1 if it failed or isn't implemented. @@ -308,44 +308,44 @@ proc PausedMusic*(): cint{.cdecl, importc: "Mix_PausedMusic", # order number) and for OGG music (set position in seconds), at the # moment. # -proc SetMusicPosition*(position: float64): cint{.cdecl, +proc setMusicPosition*(position: float64): cint{.cdecl, importc: "Mix_SetMusicPosition", dynlib: MixerLibName.} # Check the status of a specific channel. # If the specified channel is -1, check all channels. # -proc Playing*(channel: cint): cint{.cdecl, importc: "Mix_Playing", +proc playing*(channel: cint): cint{.cdecl, importc: "Mix_Playing", dynlib: MixerLibName.} -proc PlayingMusic*(): cint{.cdecl, importc: "Mix_PlayingMusic", +proc playingMusic*(): cint{.cdecl, importc: "Mix_PlayingMusic", dynlib: MixerLibName.} # Stop music and set external music playback command -proc SetMusicCMD*(command: cstring): cint{.cdecl, importc: "Mix_SetMusicCMD", +proc setMusicCMD*(command: cstring): cint{.cdecl, importc: "Mix_SetMusicCMD", dynlib: MixerLibName.} # Synchro value is set by MikMod from modules while playing -proc SetSynchroValue*(value: cint): cint{.cdecl, +proc setSynchroValue*(value: cint): cint{.cdecl, importc: "Mix_SetSynchroValue", dynlib: MixerLibName.} -proc GetSynchroValue*(): cint{.cdecl, importc: "Mix_GetSynchroValue", +proc getSynchroValue*(): cint{.cdecl, importc: "Mix_GetSynchroValue", dynlib: MixerLibName.} # # Get the Mix_Chunk currently associated with a mixer channel # Returns nil if it's an invalid channel, or there's no chunk associated. # -proc GetChunk*(channel: cint): PChunk{.cdecl, importc: "Mix_GetChunk", +proc getChunk*(channel: cint): PChunk{.cdecl, importc: "Mix_GetChunk", dynlib: MixerLibName.} # Close the mixer, halting all playing audio -proc CloseAudio*(){.cdecl, importc: "Mix_CloseAudio", dynlib: MixerLibName.} +proc closeAudio*(){.cdecl, importc: "Mix_CloseAudio", dynlib: MixerLibName.} # We'll use SDL for reporting errors -proc VERSION(X: var Tversion) = - X.major = MAJOR_VERSION - X.minor = MINOR_VERSION - X.patch = PATCHLEVEL +proc version(x: var Tversion) = + x.major = MAJOR_VERSION + x.minor = MINOR_VERSION + x.patch = PATCHLEVEL -proc LoadWAV(filename: cstring): PChunk = - result = LoadWAV_RW(RWFromFile(filename, "rb"), 1) +proc loadWAV(filename: cstring): PChunk = + result = LoadWAV_RW(rWFromFile(filename, "rb"), 1) -proc PlayChannel(channel: cint, chunk: PChunk, loops: cint): cint = - result = PlayChannelTimed(channel, chunk, loops, - 1) +proc playChannel(channel: cint, chunk: PChunk, loops: cint): cint = + result = playChannelTimed(channel, chunk, loops, - 1) -proc FadeInChannel(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint = - result = FadeInChannelTimed(channel, chunk, loops, ms, - 1) +proc fadeInChannel(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint = + result = fadeInChannelTimed(channel, chunk, loops, ms, - 1) diff --git a/lib/wrappers/sdl/sdl_net.nim b/lib/wrappers/sdl/sdl_net.nim index 742a59314..1ffdb5cca 100644 --- a/lib/wrappers/sdl/sdl_net.nim +++ b/lib/wrappers/sdl/sdl_net.nim @@ -145,15 +145,15 @@ type # SDL_net.h types #*********************************************************************** PIPAddress* = ptr TIPAddress TIPAddress*{.final.} = object #* TCP network API - host*: Uint32 # 32-bit IPv4 host address */ - port*: Uint16 # 16-bit protocol port */ + host*: uint32 # 32-bit IPv4 host address */ + port*: uint16 # 16-bit protocol port */ PTCPSocket* = ptr TTCPSocket TTCPSocket*{.final.} = object # UDP network API ready*: int channel*: int - remoteAddress*: TIPaddress - localAddress*: TIPaddress + remoteAddress*: TIPAddress + localAddress*: TIPAddress sflag*: int PUDP_Channel* = ptr TUDP_Channel @@ -196,27 +196,27 @@ type # SDL_net.h types ready*: int -proc VERSION*(X: var Tversion) +proc version*(x: var Tversion) #* Initialize/Cleanup the network API # SDL must be initialized before calls to functions in this library, # because this library uses utility functions from the SDL library. #* -proc Init*(): int{.cdecl, importc: "SDLNet_Init", dynlib: NetLibName.} -proc Quit*(){.cdecl, importc: "SDLNet_Quit", dynlib: NetLibName.} +proc init*(): int{.cdecl, importc: "SDLNet_Init", dynlib: NetLibName.} +proc quit*(){.cdecl, importc: "SDLNet_Quit", dynlib: NetLibName.} #* Resolve a host name and port to an IP address in network form. # If the function succeeds, it will return 0. # If the host couldn't be resolved, the host portion of the returned # address will be INADDR_NONE, and the function will return -1. # If 'host' is NULL, the resolved host will be set to INADDR_ANY. # * -proc ResolveHost*(address: var TIPaddress, host: cstring, port: Uint16): int{. +proc resolveHost*(address: var TIPAddress, host: cstring, port: uint16): int{. cdecl, importc: "SDLNet_ResolveHost", dynlib: NetLibName.} #* Resolve an ip address to a host name in canonical form. # If the ip couldn't be resolved, this function returns NULL, # otherwise a pointer to a static buffer containing the hostname # is returned. Note that this function is not thread-safe. #* -proc ResolveIP*(ip: var TIPaddress): cstring{.cdecl, +proc resolveIP*(ip: var TIPAddress): cstring{.cdecl, importc: "SDLNet_ResolveIP", dynlib: NetLibName.} #*********************************************************************** #* TCP network API * @@ -229,24 +229,24 @@ proc ResolveIP*(ip: var TIPaddress): cstring{.cdecl, # in the correct form). # The newly created socket is returned, or NULL if there was an error. #* -proc TCP_Open*(ip: var TIPaddress): PTCPSocket{.cdecl, +proc tcpOpen*(ip: var TIPAddress): PTCPSocket{.cdecl, importc: "SDLNet_TCP_Open", dynlib: NetLibName.} #* Accept an incoming connection on the given server socket. # The newly created socket is returned, or NULL if there was an error. #* -proc TCP_Accept*(server: PTCPsocket): PTCPSocket{.cdecl, +proc tcpAccept*(server: PTCPSocket): PTCPSocket{.cdecl, importc: "SDLNet_TCP_Accept", dynlib: NetLibName.} #* Get the IP address of the remote system associated with the socket. # If the socket is a server socket, this function returns NULL. #* -proc TCP_GetPeerAddress*(sock: PTCPsocket): PIPAddress{.cdecl, +proc tcpGetPeerAddress*(sock: PTCPSocket): PIPAddress{.cdecl, importc: "SDLNet_TCP_GetPeerAddress", dynlib: NetLibName.} #* Send 'len' bytes of 'data' over the non-server socket 'sock' # This function returns the actual amount of data sent. If the return value # is less than the amount of data sent, then either the remote connection was # closed, or an unknown socket error occurred. #* -proc TCP_Send*(sock: PTCPsocket, data: Pointer, length: int): int{.cdecl, +proc tcpSend*(sock: PTCPSocket, data: pointer, length: int): int{.cdecl, importc: "SDLNet_TCP_Send", dynlib: NetLibName.} #* Receive up to 'maxlen' bytes of data over the non-server socket 'sock', # and store them in the buffer pointed to by 'data'. @@ -254,10 +254,10 @@ proc TCP_Send*(sock: PTCPsocket, data: Pointer, length: int): int{.cdecl, # value is less than or equal to zero, then either the remote connection was # closed, or an unknown socket error occurred. #* -proc TCP_Recv*(sock: PTCPsocket, data: Pointer, maxlen: int): int{.cdecl, +proc tcpRecv*(sock: PTCPSocket, data: pointer, maxlen: int): int{.cdecl, importc: "SDLNet_TCP_Recv", dynlib: NetLibName.} #* Close a TCP network socket * -proc TCP_Close*(sock: PTCPsocket){.cdecl, importc: "SDLNet_TCP_Close", +proc tcpClose*(sock: PTCPSocket){.cdecl, importc: "SDLNet_TCP_Close", dynlib: NetLibName.} #*********************************************************************** #* UDP network API * @@ -265,26 +265,26 @@ proc TCP_Close*(sock: PTCPsocket){.cdecl, importc: "SDLNet_TCP_Close", #* Allocate/resize/free a single UDP packet 'size' bytes long. # The new packet is returned, or NULL if the function ran out of memory. # * -proc AllocPacket*(size: int): PUDPpacket{.cdecl, +proc allocPacket*(size: int): PUDPpacket{.cdecl, importc: "SDLNet_AllocPacket", dynlib: NetLibName.} -proc ResizePacket*(packet: PUDPpacket, newsize: int): int{.cdecl, +proc resizePacket*(packet: PUDPpacket, newsize: int): int{.cdecl, importc: "SDLNet_ResizePacket", dynlib: NetLibName.} -proc FreePacket*(packet: PUDPpacket){.cdecl, importc: "SDLNet_FreePacket", +proc freePacket*(packet: PUDPpacket){.cdecl, importc: "SDLNet_FreePacket", dynlib: NetLibName.} #* Allocate/Free a UDP packet vector (array of packets) of 'howmany' packets, # each 'size' bytes long. # A pointer to the first packet in the array is returned, or NULL if the # function ran out of memory. # * -proc AllocPacketV*(howmany: int, size: int): PUDPpacket{.cdecl, +proc allocPacketV*(howmany: int, size: int): PUDPpacket{.cdecl, importc: "SDLNet_AllocPacketV", dynlib: NetLibName.} -proc FreePacketV*(packetV: PUDPpacket){.cdecl, +proc freePacketV*(packetV: PUDPpacket){.cdecl, importc: "SDLNet_FreePacketV", dynlib: NetLibName.} #* Open a UDP network socket # If 'port' is non-zero, the UDP socket is bound to a local port. # This allows other systems to send to this socket via a known port. #* -proc UDP_Open*(port: Uint16): PUDPsocket{.cdecl, importc: "SDLNet_UDP_Open", +proc udpOpen*(port: uint16): PUDPSocket{.cdecl, importc: "SDLNet_UDP_Open", dynlib: NetLibName.} #* Bind the address 'address' to the requested channel on the UDP socket. # If the channel is -1, then the first unbound channel will be bound with @@ -295,10 +295,10 @@ proc UDP_Open*(port: Uint16): PUDPsocket{.cdecl, importc: "SDLNet_UDP_Open", # address, to which all outbound packets on the channel are sent. # This function returns the channel which was bound, or -1 on error. #* -proc UDP_Bind*(sock: PUDPsocket, channel: int, address: var TIPaddress): int{. +proc udpBind*(sock: PUDPSocket, channel: int, address: var TIPAddress): int{. cdecl, importc: "SDLNet_UDP_Bind", dynlib: NetLibName.} #* Unbind all addresses from the given channel * -proc UDP_Unbind*(sock: PUDPsocket, channel: int){.cdecl, +proc udpUnbind*(sock: PUDPSocket, channel: int){.cdecl, importc: "SDLNet_UDP_Unbind", dynlib: NetLibName.} #* Get the primary IP address of the remote system associated with the # socket and channel. If the channel is -1, then the primary IP port @@ -306,7 +306,7 @@ proc UDP_Unbind*(sock: PUDPsocket, channel: int){.cdecl, # opened with a specific port. # If the channel is not bound and not -1, this function returns NULL. # * -proc UDP_GetPeerAddress*(sock: PUDPsocket, channel: int): PIPAddress{.cdecl, +proc udpGetPeerAddress*(sock: PUDPSocket, channel: int): PIPAddress{.cdecl, importc: "SDLNet_UDP_GetPeerAddress", dynlib: NetLibName.} #* Send a vector of packets to the the channels specified within the packet. # If the channel specified in the packet is -1, the packet will be sent to @@ -315,7 +315,7 @@ proc UDP_GetPeerAddress*(sock: PUDPsocket, channel: int): PIPAddress{.cdecl, # been sent, -1 if the packet send failed. # This function returns the number of packets sent. #* -proc UDP_SendV*(sock: PUDPsocket, packets: PPUDPpacket, npackets: int): int{. +proc udpSendV*(sock: PUDPSocket, packets: PPUDPpacket, npackets: int): int{. cdecl, importc: "SDLNet_UDP_SendV", dynlib: NetLibName.} #* Send a single packet to the specified channel. # If the channel specified in the packet is -1, the packet will be sent to @@ -324,7 +324,7 @@ proc UDP_SendV*(sock: PUDPsocket, packets: PPUDPpacket, npackets: int): int{. # been sent. # This function returns 1 if the packet was sent, or 0 on error. #* -proc UDP_Send*(sock: PUDPsocket, channel: int, packet: PUDPpacket): int{. +proc udpSend*(sock: PUDPSocket, channel: int, packet: PUDPpacket): int{. cdecl, importc: "SDLNet_UDP_Send", dynlib: NetLibName.} #* Receive a vector of pending packets from the UDP socket. # The returned packets contain the source address and the channel they arrived @@ -336,7 +336,7 @@ proc UDP_Send*(sock: PUDPsocket, channel: int, packet: PUDPpacket): int{. # This function returns the number of packets read from the network, or -1 # on error. This function does not block, so can return 0 packets pending. #* -proc UDP_RecvV*(sock: PUDPsocket, packets: PPUDPpacket): int{.cdecl, +proc udpRecvV*(sock: PUDPSocket, packets: PPUDPpacket): int{.cdecl, importc: "SDLNet_UDP_RecvV", dynlib: NetLibName.} #* Receive a single packet from the UDP socket. # The returned packet contains the source address and the channel it arrived @@ -348,10 +348,10 @@ proc UDP_RecvV*(sock: PUDPsocket, packets: PPUDPpacket): int{.cdecl, # This function returns the number of packets read from the network, or -1 # on error. This function does not block, so can return 0 packets pending. #* -proc UDP_Recv*(sock: PUDPsocket, packet: PUDPpacket): int{.cdecl, +proc udpRecv*(sock: PUDPSocket, packet: PUDPpacket): int{.cdecl, importc: "SDLNet_UDP_Recv", dynlib: NetLibName.} #* Close a UDP network socket * -proc UDP_Close*(sock: PUDPsocket){.cdecl, importc: "SDLNet_UDP_Close", +proc udpClose*(sock: PUDPSocket){.cdecl, importc: "SDLNet_UDP_Close", dynlib: NetLibName.} #*********************************************************************** #* Hooks for checking sockets for available data * @@ -360,19 +360,19 @@ proc UDP_Close*(sock: PUDPsocket){.cdecl, importc: "SDLNet_UDP_Close", # This returns a socket set for up to 'maxsockets' sockets, or NULL if # the function ran out of memory. # * -proc AllocSocketSet*(maxsockets: int): PSocketSet{.cdecl, +proc allocSocketSet*(maxsockets: int): PSocketSet{.cdecl, importc: "SDLNet_AllocSocketSet", dynlib: NetLibName.} #* Add a socket to a set of sockets to be checked for available data * -proc AddSocket*(theSet: PSocketSet, sock: PGenericSocket): int{. +proc addSocket*(theSet: PSocketSet, sock: PGenericSocket): int{. cdecl, importc: "SDLNet_AddSocket", dynlib: NetLibName.} -proc TCP_AddSocket*(theSet: PSocketSet, sock: PTCPSocket): int -proc UDP_AddSocket*(theSet: PSocketSet, sock: PUDPSocket): int +proc tcpAddSocket*(theSet: PSocketSet, sock: PTCPSocket): int +proc udpAddSocket*(theSet: PSocketSet, sock: PUDPSocket): int #* Remove a socket from a set of sockets to be checked for available data * -proc DelSocket*(theSet: PSocketSet, sock: PGenericSocket): int{. +proc delSocket*(theSet: PSocketSet, sock: PGenericSocket): int{. cdecl, importc: "SDLNet_DelSocket", dynlib: NetLibName.} -proc TCP_DelSocket*(theSet: PSocketSet, sock: PTCPSocket): int +proc tcpDelSocket*(theSet: PSocketSet, sock: PTCPSocket): int # SDLNet_DelSocket(set, (SDLNet_GenericSocket)sock) -proc UDP_DelSocket*(theSet: PSocketSet, sock: PUDPSocket): int +proc udpDelSocket*(theSet: PSocketSet, sock: PUDPSocket): int #SDLNet_DelSocket(set, (SDLNet_GenericSocket)sock) #* This function checks to see if data is available for reading on the # given set of sockets. If 'timeout' is 0, it performs a quick poll, @@ -381,47 +381,46 @@ proc UDP_DelSocket*(theSet: PSocketSet, sock: PUDPSocket): int # first. This function returns the number of sockets ready for reading, # or -1 if there was an error with the select() system call. #* -proc CheckSockets*(theSet: PSocketSet, timeout: int32): int{.cdecl, +proc checkSockets*(theSet: PSocketSet, timeout: int32): int{.cdecl, importc: "SDLNet_CheckSockets", dynlib: NetLibName.} #* After calling SDLNet_CheckSockets(), you can use this function on a # socket that was in the socket set, to find out if data is available # for reading. #* -proc SocketReady*(sock: PGenericSocket): bool +proc socketReady*(sock: PGenericSocket): bool #* Free a set of sockets allocated by SDL_NetAllocSocketSet() * -proc FreeSocketSet*(theSet: PSocketSet){.cdecl, +proc freeSocketSet*(theSet: PSocketSet){.cdecl, importc: "SDLNet_FreeSocketSet", dynlib: NetLibName.} #*********************************************************************** #* Platform-independent data conversion functions * #*********************************************************************** #* Write a 16/32 bit value to network packet buffer * -proc Write16*(value: Uint16, area: Pointer){.cdecl, +proc write16*(value: uint16, area: pointer){.cdecl, importc: "SDLNet_Write16", dynlib: NetLibName.} -proc Write32*(value: Uint32, area: Pointer){.cdecl, +proc write32*(value: uint32, area: pointer){.cdecl, importc: "SDLNet_Write32", dynlib: NetLibName.} #* Read a 16/32 bit value from network packet buffer * -proc Read16*(area: Pointer): Uint16{.cdecl, importc: "SDLNet_Read16", +proc read16*(area: pointer): uint16{.cdecl, importc: "SDLNet_Read16", dynlib: NetLibName.} -proc Read32*(area: Pointer): Uint32{.cdecl, importc: "SDLNet_Read32", +proc read32*(area: pointer): uint32{.cdecl, importc: "SDLNet_Read32", dynlib: NetLibName.} -proc VERSION(X: var Tversion) = - X.major = MAJOR_VERSION - X.minor = MINOR_VERSION - X.patch = PATCHLEVEL +proc version(x: var Tversion) = + x.major = MAJOR_VERSION + x.minor = MINOR_VERSION + x.patch = PATCHLEVEL -proc TCP_AddSocket(theSet: PSocketSet, sock: PTCPSocket): int = - result = AddSocket(theSet, cast[PGenericSocket](sock)) +proc tcpAddSocket(theSet: PSocketSet, sock: PTCPSocket): int = + result = addSocket(theSet, cast[PGenericSocket](sock)) -proc UDP_AddSocket(theSet: PSocketSet, sock: PUDPSocket): int = - result = AddSocket(theSet, cast[PGenericSocket](sock)) +proc udpAddSocket(theSet: PSocketSet, sock: PUDPSocket): int = + result = addSocket(theSet, cast[PGenericSocket](sock)) -proc TCP_DelSocket(theSet: PSocketSet, sock: PTCPSocket): int = - result = DelSocket(theSet, cast[PGenericSocket](sock)) +proc tcpDelSocket(theSet: PSocketSet, sock: PTCPSocket): int = + result = delSocket(theSet, cast[PGenericSocket](sock)) -proc UDP_DelSocket(theSet: PSocketSet, sock: PUDPSocket): int = - result = DelSocket(theSet, cast[PGenericSocket](sock)) - -proc SocketReady(sock: PGenericSocket): bool = - result = ((sock != nil) and (sock.ready == 1)) +proc udpDelSocket(theSet: PSocketSet, sock: PUDPSocket): int = + result = delSocket(theSet, cast[PGenericSocket](sock)) +proc socketReady(sock: PGenericSocket): bool = + result = sock != nil and sock.ready == 1 diff --git a/lib/wrappers/sdl/sdl_ttf.nim b/lib/wrappers/sdl/sdl_ttf.nim index 45247df4d..e0410c798 100644 --- a/lib/wrappers/sdl/sdl_ttf.nim +++ b/lib/wrappers/sdl/sdl_ttf.nim @@ -177,78 +177,78 @@ const UNICODE_BOM_SWAPPED* = 0x0000FFFE type - PFont* = ptr Tfont - TFont{.final.} = object + PFont* = ptr TFont + TFont = object # This macro can be used to fill a version structure with the compile-time # version of the SDL_ttf library. -proc Linked_Version*(): sdl.Pversion{.cdecl, importc: "TTF_Linked_Version", +proc linkedVersion*(): sdl.Pversion{.cdecl, importc: "TTF_Linked_Version", dynlib: ttfLibName.} # This function tells the library whether UNICODE text is generally # byteswapped. A UNICODE BOM character in a string will override # this setting for the remainder of that string. # -proc ByteSwappedUNICODE*(swapped: cint){.cdecl, +proc byteSwappedUNICODE*(swapped: cint){.cdecl, importc: "TTF_ByteSwappedUNICODE", dynlib: ttfLibName.} #returns 0 on succes, -1 if error occurs -proc Init*(): cint{.cdecl, importc: "TTF_Init", dynlib: ttfLibName.} +proc init*(): cint{.cdecl, importc: "TTF_Init", dynlib: ttfLibName.} # # Open a font file and create a font of the specified point size. # Some .fon fonts will have several sizes embedded in the file, so the # point size becomes the index of choosing which size. If the value # is too high, the last indexed size will be the default. # -proc OpenFont*(filename: cstring, ptsize: cint): PFont{.cdecl, +proc openFont*(filename: cstring, ptsize: cint): PFont{.cdecl, importc: "TTF_OpenFont", dynlib: ttfLibName.} -proc OpenFontIndex*(filename: cstring, ptsize: cint, index: int32): PFont{. +proc openFontIndex*(filename: cstring, ptsize: cint, index: int32): PFont{. cdecl, importc: "TTF_OpenFontIndex", dynlib: ttfLibName.} -proc OpenFontRW*(src: PRWops, freesrc: cint, ptsize: cint): PFont{.cdecl, +proc openFontRW*(src: PRWops, freesrc: cint, ptsize: cint): PFont{.cdecl, importc: "TTF_OpenFontRW", dynlib: ttfLibName.} -proc OpenFontIndexRW*(src: PRWops, freesrc: cint, ptsize: cint, index: int32): PFont{. +proc openFontIndexRW*(src: PRWops, freesrc: cint, ptsize: cint, index: int32): PFont{. cdecl, importc: "TTF_OpenFontIndexRW", dynlib: ttfLibName.} -proc GetFontStyle*(font: PFont): cint{.cdecl, +proc getFontStyle*(font: PFont): cint{.cdecl, importc: "TTF_GetFontStyle", dynlib: ttfLibName.} -proc SetFontStyle*(font: PFont, style: cint){.cdecl, +proc setFontStyle*(font: PFont, style: cint){.cdecl, importc: "TTF_SetFontStyle", dynlib: ttfLibName.} # Get the total height of the font - usually equal to point size -proc FontHeight*(font: PFont): cint{.cdecl, importc: "TTF_FontHeight", +proc fontHeight*(font: PFont): cint{.cdecl, importc: "TTF_FontHeight", dynlib: ttfLibName.} # Get the offset from the baseline to the top of the font # This is a positive value, relative to the baseline. # -proc FontAscent*(font: PFont): cint{.cdecl, importc: "TTF_FontAscent", +proc fontAscent*(font: PFont): cint{.cdecl, importc: "TTF_FontAscent", dynlib: ttfLibName.} # Get the offset from the baseline to the bottom of the font # This is a negative value, relative to the baseline. # -proc FontDescent*(font: PFont): cint{.cdecl, importc: "TTF_FontDescent", +proc fontDescent*(font: PFont): cint{.cdecl, importc: "TTF_FontDescent", dynlib: ttfLibName.} # Get the recommended spacing between lines of text for this font -proc FontLineSkip*(font: PFont): cint{.cdecl, +proc fontLineSkip*(font: PFont): cint{.cdecl, importc: "TTF_FontLineSkip", dynlib: ttfLibName.} # Get the number of faces of the font -proc FontFaces*(font: PFont): int32{.cdecl, importc: "TTF_FontFaces", +proc fontFaces*(font: PFont): int32{.cdecl, importc: "TTF_FontFaces", dynlib: ttfLibName.} # Get the font face attributes, if any -proc FontFaceIsFixedWidth*(font: PFont): cint{.cdecl, +proc fontFaceIsFixedWidth*(font: PFont): cint{.cdecl, importc: "TTF_FontFaceIsFixedWidth", dynlib: ttfLibName.} -proc FontFaceFamilyName*(font: PFont): cstring{.cdecl, +proc fontFaceFamilyName*(font: PFont): cstring{.cdecl, importc: "TTF_FontFaceFamilyName", dynlib: ttfLibName.} -proc FontFaceStyleName*(font: PFont): cstring{.cdecl, +proc fontFaceStyleName*(font: PFont): cstring{.cdecl, importc: "TTF_FontFaceStyleName", dynlib: ttfLibName.} # Get the metrics (dimensions) of a glyph -proc GlyphMetrics*(font: PFont, ch: Uint16, minx: var cint, +proc glyphMetrics*(font: PFont, ch: uint16, minx: var cint, maxx: var cint, miny: var cint, maxy: var cint, advance: var cint): cint{.cdecl, importc: "TTF_GlyphMetrics", dynlib: ttfLibName.} # Get the dimensions of a rendered string of text -proc SizeText*(font: PFont, text: cstring, w: var cint, y: var cint): cint{. +proc sizeText*(font: PFont, text: cstring, w: var cint, y: var cint): cint{. cdecl, importc: "TTF_SizeText", dynlib: ttfLibName.} -proc SizeUTF8*(font: PFont, text: cstring, w: var cint, y: var cint): cint{. +proc sizeUTF8*(font: PFont, text: cstring, w: var cint, y: var cint): cint{. cdecl, importc: "TTF_SizeUTF8", dynlib: ttfLibName.} -proc SizeUNICODE*(font: PFont, text: PUint16, w: var cint, y: var cint): cint{. +proc sizeUNICODE*(font: PFont, text: PUInt16, w: var cint, y: var cint): cint{. cdecl, importc: "TTF_SizeUNICODE", dynlib: ttfLibName.} # Create an 8-bit palettized surface and render the given text at # fast quality with the given font and color. The 0 pixel is the @@ -256,9 +256,9 @@ proc SizeUNICODE*(font: PFont, text: PUint16, w: var cint, y: var cint): cint{. # to the text color. # This function returns the new surface, or NULL if there was an error. # -proc RenderUTF8_Solid*(font: PFont, text: cstring, fg: TColor): PSurface{. +proc renderUTF8Solid*(font: PFont, text: cstring, fg: TColor): PSurface{. cdecl, importc: "TTF_RenderUTF8_Solid", dynlib: ttfLibName.} -proc RenderUNICODE_Solid*(font: PFont, text: PUint16, fg: TColor): PSurface{. +proc renderUNICODE_Solid*(font: PFont, text: PUInt16, fg: TColor): PSurface{. cdecl, importc: "TTF_RenderUNICODE_Solid", dynlib: ttfLibName.} # #Create an 8-bit palettized surface and render the given glyph at @@ -268,20 +268,20 @@ proc RenderUNICODE_Solid*(font: PFont, text: PUint16, fg: TColor): PSurface{. # centering in the X direction, and aligned normally in the Y direction. # This function returns the new surface, or NULL if there was an error. # -proc RenderGlyph_Solid*(font: PFont, ch: Uint16, fg: TColor): PSurface{. +proc renderGlyphSolid*(font: PFont, ch: uint16, fg: TColor): PSurface{. cdecl, importc: "TTF_RenderGlyph_Solid", dynlib: ttfLibName.} # Create an 8-bit palettized surface and render the given text at # high quality with the given font and colors. The 0 pixel is background, # while other pixels have varying degrees of the foreground color. # This function returns the new surface, or NULL if there was an error. # -proc RenderText_Shaded*(font: PFont, text: cstring, fg: TColor, +proc renderTextShaded*(font: PFont, text: cstring, fg: TColor, bg: TColor): PSurface{.cdecl, importc: "TTF_RenderText_Shaded", dynlib: ttfLibName.} -proc RenderUTF8_Shaded*(font: PFont, text: cstring, fg: TColor, +proc renderUTF8Shaded*(font: PFont, text: cstring, fg: TColor, bg: TColor): PSurface{.cdecl, importc: "TTF_RenderUTF8_Shaded", dynlib: ttfLibName.} -proc RenderUNICODE_Shaded*(font: PFont, text: PUint16, fg: TColor, +proc renderUNICODE_Shaded*(font: PFont, text: PUInt16, fg: TColor, bg: TColor): PSurface{.cdecl, importc: "TTF_RenderUNICODE_Shaded", dynlib: ttfLibName.} # Create an 8-bit palettized surface and render the given glyph at @@ -291,17 +291,17 @@ proc RenderUNICODE_Shaded*(font: PFont, text: PUint16, fg: TColor, # direction, and aligned normally in the Y direction. # This function returns the new surface, or NULL if there was an error. # -proc RenderGlyph_Shaded*(font: PFont, ch: Uint16, fg: TColor, bg: TColor): PSurface{. +proc renderGlyphShaded*(font: PFont, ch: uint16, fg: TColor, bg: TColor): PSurface{. cdecl, importc: "TTF_RenderGlyph_Shaded", dynlib: ttfLibName.} # Create a 32-bit ARGB surface and render the given text at high quality, # using alpha blending to dither the font with the given color. # This function returns the new surface, or NULL if there was an error. # -proc RenderText_Blended*(font: PFont, text: cstring, fg: TColor): PSurface{. +proc renderTextBlended*(font: PFont, text: cstring, fg: TColor): PSurface{. cdecl, importc: "TTF_RenderText_Blended", dynlib: ttfLibName.} -proc RenderUTF8_Blended*(font: PFont, text: cstring, fg: TColor): PSurface{. +proc renderUTF8Blended*(font: PFont, text: cstring, fg: TColor): PSurface{. cdecl, importc: "TTF_RenderUTF8_Blended", dynlib: ttfLibName.} -proc RenderUNICODE_Blended*(font: PFont, text: PUint16, fg: TColor): PSurface{. +proc RenderUNICODE_Blended*(font: PFont, text: PUInt16, fg: TColor): PSurface{. cdecl, importc: "TTF_RenderUNICODE_Blended", dynlib: ttfLibName.} # Create a 32-bit ARGB surface and render the given glyph at high quality, # using alpha blending to dither the font with the given color. @@ -309,29 +309,29 @@ proc RenderUNICODE_Blended*(font: PFont, text: PUint16, fg: TColor): PSurface{. # direction, and aligned normally in the Y direction. # This function returns the new surface, or NULL if there was an error. # -proc RenderGlyph_Blended*(font: PFont, ch: Uint16, fg: TColor): PSurface{. +proc renderGlyphBlended*(font: PFont, ch: uint16, fg: TColor): PSurface{. cdecl, importc: "TTF_RenderGlyph_Blended", dynlib: ttfLibName.} # For compatibility with previous versions, here are the old functions - ##define TTF_RenderText(font, text, fg, bg) + # #define TTF_RenderText(font, text, fg, bg) # TTF_RenderText_Shaded(font, text, fg, bg) - ##define TTF_RenderUTF8(font, text, fg, bg) + # #define TTF_RenderUTF8(font, text, fg, bg) # TTF_RenderUTF8_Shaded(font, text, fg, bg) - ##define TTF_RenderUNICODE(font, text, fg, bg) + # #define TTF_RenderUNICODE(font, text, fg, bg) # TTF_RenderUNICODE_Shaded(font, text, fg, bg) - # Close an opened font file -proc CloseFont*(font: PFont){.cdecl, importc: "TTF_CloseFont", + # Close an opened font file +proc closeFont*(font: PFont){.cdecl, importc: "TTF_CloseFont", dynlib: ttfLibName.} - #De-initialize TTF engine -proc Quit*(){.cdecl, importc: "TTF_Quit", dynlib: ttfLibName.} + # De-initialize TTF engine +proc quit*(){.cdecl, importc: "TTF_Quit", dynlib: ttfLibName.} # Check if the TTF engine is initialized -proc WasInit*(): cint{.cdecl, importc: "TTF_WasInit", dynlib: ttfLibName.} +proc wasInit*(): cint{.cdecl, importc: "TTF_WasInit", dynlib: ttfLibName.} -proc VERSION*(X: var sdl.Tversion) = - X.major = MAJOR_VERSION - X.minor = MINOR_VERSION - X.patch = PATCHLEVEL +proc version*(x: var sdl.Tversion) = + x.major = MAJOR_VERSION + x.minor = MINOR_VERSION + x.patch = PATCHLEVEL -proc RenderText_Solid*(font: PFont, text: cstring, fg: TColor): PSurface{. +proc renderTextSolid*(font: PFont, text: cstring, fg: TColor): PSurface{. cdecl, importc: "TTF_RenderText_Solid", dynlib: ttfLibName.} diff --git a/lib/wrappers/sdl/smpeg.nim b/lib/wrappers/sdl/smpeg.nim index 33f317631..318c0b3df 100644 --- a/lib/wrappers/sdl/smpeg.nim +++ b/lib/wrappers/sdl/smpeg.nim @@ -125,7 +125,7 @@ # #****************************************************************************** -import +import sdl when defined(windows): @@ -143,29 +143,29 @@ const type TFilterInfo*{.final.} = object - yuv_mb_square_error*: PUint16 - yuv_pixel_square_error*: PUint16 + yuvMbSquareError*: PUInt16 + yuvPixelSquareError*: PUInt16 PFilterInfo* = ptr TFilterInfo # MPEG filter definition PFilter* = ptr TFilter # Callback functions for the filter TFilterCallback* = proc (dest, source: POverlay, region: PRect, - filter_info: PFilterInfo, data: Pointer): Pointer{. + filterInfo: PFilterInfo, data: pointer): pointer{. cdecl.} - TFilterDestroy* = proc (Filter: PFilter): Pointer{.cdecl.} # The filter definition itself + TFilterDestroy* = proc (filter: PFilter): pointer{.cdecl.} # The filter definition itself TFilter*{.final.} = object # The null filter (default). It simply copies the source rectangle to the video overlay. - flags*: Uint32 - data*: Pointer + flags*: uint32 + data*: pointer callback*: TFilterCallback destroy*: TFilterDestroy -proc filter_null*(): PFilter{.cdecl, importc: "SMPEGfilter_null", +proc filterNull*(): PFilter{.cdecl, importc: "SMPEGfilter_null", dynlib: SmpegLibName.} # The bilinear filter. A basic low-pass filter that will produce a smoother image. -proc filter_bilinear*(): PFilter{.cdecl, +proc filterBilinear*(): PFilter{.cdecl, importc: "SMPEGfilter_bilinear", dynlib: SmpegLibName.} # The deblocking filter. It filters block borders and non-intra coded blocks to reduce blockiness -proc filter_deblocking*(): PFilter{.cdecl, +proc filterDeblocking*(): PFilter{.cdecl, importc: "SMPEGfilter_deblocking", dynlib: SmpegLibName.} #------------------------------------------------------------------------------ # SMPEG.h @@ -175,28 +175,28 @@ const MINOR_VERSION* = 4 PATCHLEVEL* = 2 -type - TVersion*{.final.} = object +type + TVersion* = object major*: byte minor*: byte patch*: byte - Pversion* = ptr Tversion # This is the actual SMPEG object - TSMPEG*{.final.} = object + Pversion* = ptr TVersion # This is the actual SMPEG object + TSMPEG* = object PSMPEG* = ptr TSMPEG # Used to get information about the SMPEG object - TInfo*{.final.} = object - has_audio*: int32 - has_video*: int32 + TInfo* = object + hasAudio*: int32 + hasVideo*: int32 width*: int32 height*: int32 - current_frame*: int32 - current_fps*: float64 - audio_string*: array[0..79, char] - audio_current_frame*: int32 - current_offset*: UInt32 - total_size*: UInt32 - current_time*: float64 - total_time*: float64 + currentFrame*: int32 + currentFps*: float64 + audioString*: array[0..79, char] + audioCurrentFrame*: int32 + currentOffset*: uint32 + totalSize*: uint32 + currentTime*: float64 + totalTime*: float64 PInfo* = ptr TInfo # Possible MPEG status codes @@ -208,7 +208,7 @@ const type Tstatus* = int32 Pstatus* = ptr int32 # Matches the declaration of SDL_UpdateRect() - TDisplayCallback* = proc (dst: PSurface, x, y: int, w, h: int): Pointer{. + TDisplayCallback* = proc (dst: PSurface, x, y: int, w, h: int): pointer{. cdecl.} # Create a new SMPEG object from an MPEG file. # On return, if 'info' is not NULL, it will be filled with information # about the MPEG object. @@ -218,15 +218,15 @@ type # subsystem. If not, you will have to use the playaudio() function below # to extract the decoded data. -proc SMPEG_new*(theFile: cstring, info: PInfo, audio: int): PSMPEG{.cdecl, +proc new*(theFile: cstring, info: PInfo, audio: int): PSMPEG{.cdecl, importc: "SMPEG_new", dynlib: SmpegLibName.} # The same as above for a file descriptor -proc new_descr*(theFile: int, info: PInfo, audio: int): PSMPEG{. +proc newDescr*(theFile: int, info: PInfo, audio: int): PSMPEG{. cdecl, importc: "SMPEG_new_descr", dynlib: SmpegLibName.} # The same as above but for a raw chunk of data. SMPEG makes a copy of the # data, so the application is free to delete after a successful call to this # function. -proc new_data*(data: Pointer, size: int, info: PInfo, audio: int): PSMPEG{. +proc newData*(data: pointer, size: int, info: PInfo, audio: int): PSMPEG{. cdecl, importc: "SMPEG_new_data", dynlib: SmpegLibName.} # Get current information about an SMPEG object proc getinfo*(mpeg: PSMPEG, info: PInfo){.cdecl, @@ -247,13 +247,13 @@ proc status*(mpeg: PSMPEG): Tstatus{.cdecl, importc: "SMPEG_status", dynlib: SmpegLibName.} # status # Set the audio volume of an MPEG stream, in the range 0-100 -proc setvolume*(mpeg: PSMPEG, volume: int){.cdecl, +proc setVolume*(mpeg: PSMPEG, volume: int){.cdecl, importc: "SMPEG_setvolume", dynlib: SmpegLibName.} # Set the destination surface for MPEG video playback # 'surfLock' is a mutex used to synchronize access to 'dst', and can be NULL. # 'callback' is a function called when an area of 'dst' needs to be updated. # If 'callback' is NULL, the default function (SDL_UpdateRect) will be used. -proc setdisplay*(mpeg: PSMPEG, dst: PSurface, surfLock: Pmutex, +proc setDisplay*(mpeg: PSMPEG, dst: PSurface, surfLock: PMutex, callback: TDisplayCallback){.cdecl, importc: "SMPEG_setdisplay", dynlib: SmpegLibName.} # Set or clear looping play on an SMPEG object @@ -264,12 +264,12 @@ proc scaleXY*(mpeg: PSMPEG, width, height: int){.cdecl, importc: "SMPEG_scaleXY", dynlib: SmpegLibName.} proc scale*(mpeg: PSMPEG, scale: int){.cdecl, importc: "SMPEG_scale", dynlib: SmpegLibName.} -proc Double*(mpeg: PSMPEG, doubleit: bool) +proc double*(mpeg: PSMPEG, doubleit: bool) # Move the video display area within the destination surface proc move*(mpeg: PSMPEG, x, y: int){.cdecl, importc: "SMPEG_move", dynlib: SmpegLibName.} # Set the region of the video to be shown -proc setdisplayregion*(mpeg: PSMPEG, x, y, w, h: int){.cdecl, +proc setDisplayRegion*(mpeg: PSMPEG, x, y, w, h: int){.cdecl, importc: "SMPEG_setdisplayregion", dynlib: SmpegLibName.} # Play an SMPEG object proc play*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_play", @@ -312,7 +312,7 @@ proc error*(mpeg: PSMPEG): cstring{.cdecl, importc: "SMPEG_error", proc playAudio*(mpeg: PSMPEG, stream: pointer, length: int): int{.cdecl, importc: "SMPEG_playAudio", dynlib: SmpegLibName.} # Wrapper for playAudio() that can be passed to SDL and SDL_mixer -proc playAudioSDL*(mpeg: Pointer, stream: pointer, length: int){.cdecl, +proc playAudioSDL*(mpeg: pointer, stream: pointer, length: int){.cdecl, importc: "SMPEG_playAudioSDL", dynlib: SmpegLibName.} # Get the best SDL audio spec for the audio stream proc wantedSpec*(mpeg: PSMPEG, wanted: PAudioSpec): int{.cdecl, @@ -322,14 +322,11 @@ proc actualSpec*(mpeg: PSMPEG, spec: PAudioSpec){.cdecl, importc: "SMPEG_actualSpec", dynlib: SmpegLibName.} # This macro can be used to fill a version structure with the compile-time # version of the SDL library. -proc GETVERSION*(X: var Tversion) -# implementation +proc getversion*(x: var TVersion) = + x.major = MAJOR_VERSION + x.minor = MINOR_VERSION + x.patch = PATCHLEVEL proc double(mpeg: PSMPEG, doubleit: bool) = if doubleit: scale(mpeg, 2) else: scale(mpeg, 1) - -proc GETVERSION(X: var Tversion) = - X.major = MAJOR_VERSION - X.minor = MINOR_VERSION - X.patch = PATCHLEVEL |