updated SDL wrapper

This commit is contained in:
Araq
2014-09-18 23:08:55 +02:00
parent 03744be67e
commit e7140f290b
8 changed files with 732 additions and 747 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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",

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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.}

View File

@@ -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