diff --git a/wrapper/raylib_gen.nim b/wrapper/raylib_gen.nim index 05a48a0..306a3e6 100644 --- a/wrapper/raylib_gen.nim +++ b/wrapper/raylib_gen.nim @@ -310,6 +310,22 @@ const "ModelAnimation/boneCount", "ModelAnimation/frameCount", ]) + openArrayParameters = toHashSet([ + "SetWindowIcons/images", + "DrawLineStrip/points", + "DrawTriangleFan/points", + "DrawTriangleStrip/points", + "DrawSplineLinear/points", + "DrawSplineBasis/points", + "DrawSplineCatmullRom/points", + "DrawSplineBezierQuadratic/points", + "DrawSplineBezierCubic/points", + "CheckCollisionPointPoly/points", + "ImageKernelConvolution/kernel", + "ImageDrawTriangleFan/points", + "ImageDrawTriangleStrip/points", + "DrawTriangleStrip3D/points", + ]) privateSymbols = toHashSet([ # Struct fields "MaterialMap/texture", @@ -621,10 +637,8 @@ proc preprocessFunctions(ctx: var ApiContext) = proc checkCstringType(fnc: FunctionInfo, kind: string): bool = kind == "cstring" and fnc.name notin wrappedFuncs and hasVarargs notin fnc.flags - proc checkOpenarrayType(fnc: FunctionInfo, kind: string, isArray: bool, nextName: string): bool = - kind != "pointer" and isArray and ((nextName == "count" or nextName.endsWith("Count")) or - (nextName == "size" or nextName.endsWith("Size"))) and - fnc.name notin wrappedFuncs and hasVarargs notin fnc.flags + proc isOpenArrayParameter(x, y: string): bool = + (if y != "": x & "/" & y else: x) in openArrayParameters keepIf(ctx.api.functions, proc (x: FunctionInfo): bool = x.name notin excludedFuncs) for fnc in mitems(ctx.api.functions): @@ -654,7 +668,7 @@ proc preprocessFunctions(ctx: var ApiContext) = if checkCstringType(fnc, paramType): param.flags.incl isString autoWrap = true - if i < fnc.params.high and checkOpenarrayType(fnc, paramType, isArray, fnc.params[i+1].name): + if isOpenArrayParameter(fnc.name, param.name): param.extra = convertType(param.`type`, ptOpenArray) param.flags.incl isOpenArray fnc.params[i+1].flags.incl isArrayLength