Some wasm fixes

This commit is contained in:
Braedon Lewis 2025-03-10 20:46:48 -04:00
parent 6e604a801b
commit 9a00da9fce
4 changed files with 3170 additions and 1067 deletions

View file

@ -186,9 +186,32 @@ namespace RaylibBeefGenerator
foreach (var func in functionsWStructs) foreach (var func in functionsWStructs)
{ {
AppendLine($"/// {func.Description}"); AppendLine($"/// {func.Description}");
// AppendLine($"[Import(Raylib.RaylibBin), CallingConvention(.Cdecl), LinkName(\"{func.Name}\")]");
AppendLine("[CLink]"); AppendLine("[Inline]");
AppendLine($"public static extern {func.ReturnType.ConvertTypes()} {func.Name.ConvertName()}({Parameters2String(func.Params, api, true)});"); AppendLine($"public static {func.ReturnType.ConvertTypes()} {func.Name.ConvertName()}({Parameters2String(func.Params, api, false)})");
AppendLine("{");
IncreaseTab();
{
var implParamsStr = new StringBuilder();
foreach (var param in func.Params)
{
implParamsStr.Append(param.Name.ConvertName());
if (param != func.Params.Last())
implParamsStr.Append(", ");
}
var lineStr = new StringBuilder();
if (func.ReturnType != "void")
lineStr.Append("return ");
lineStr.Append($"{func.Name.ConvertName()}_Impl({implParamsStr});");
AppendLine(lineStr.ToString());
}
DecreaseTab();
AppendLine("}");
AppendLine($"[LinkName(\"{func.Name}\")]");
AppendLine($"private static extern {func.ReturnType.ConvertTypes()} {func.Name.ConvertName()}_Impl({Parameters2String(func.Params, api, true)});");
GenerateBeefHelperFunctions(func, api); GenerateBeefHelperFunctions(func, api);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -875,28 +875,58 @@ public static class Rlgl
#else #else
/// Unload render batch system /// Unload render batch system
[CLink] [Inline]
public static extern void rlUnloadRenderBatch(in rlRenderBatch batch); public static void rlUnloadRenderBatch(rlRenderBatch batch)
{
rlUnloadRenderBatch_Impl(batch);
}
[LinkName("rlUnloadRenderBatch")]
private static extern void rlUnloadRenderBatch_Impl(in rlRenderBatch batch);
/// Set shader value matrix /// Set shader value matrix
[CLink] [Inline]
public static extern void rlSetUniformMatrix(int32 locIndex, in Matrix mat); public static void rlSetUniformMatrix(int32 locIndex, Matrix mat)
{
rlSetUniformMatrix_Impl(locIndex, mat);
}
[LinkName("rlSetUniformMatrix")]
private static extern void rlSetUniformMatrix_Impl(int32 locIndex, in Matrix mat);
/// Set a custom projection matrix (replaces internal projection matrix) /// Set a custom projection matrix (replaces internal projection matrix)
[CLink] [Inline]
public static extern void rlSetMatrixProjection(in Matrix proj); public static void rlSetMatrixProjection(Matrix proj)
{
rlSetMatrixProjection_Impl(proj);
}
[LinkName("rlSetMatrixProjection")]
private static extern void rlSetMatrixProjection_Impl(in Matrix proj);
/// Set a custom modelview matrix (replaces internal modelview matrix) /// Set a custom modelview matrix (replaces internal modelview matrix)
[CLink] [Inline]
public static extern void rlSetMatrixModelview(in Matrix view); public static void rlSetMatrixModelview(Matrix view)
{
rlSetMatrixModelview_Impl(view);
}
[LinkName("rlSetMatrixModelview")]
private static extern void rlSetMatrixModelview_Impl(in Matrix view);
/// Set eyes projection matrices for stereo rendering /// Set eyes projection matrices for stereo rendering
[CLink] [Inline]
public static extern void rlSetMatrixProjectionStereo(in Matrix right, in Matrix left); public static void rlSetMatrixProjectionStereo(Matrix right, Matrix left)
{
rlSetMatrixProjectionStereo_Impl(right, left);
}
[LinkName("rlSetMatrixProjectionStereo")]
private static extern void rlSetMatrixProjectionStereo_Impl(in Matrix right, in Matrix left);
/// Set eyes view offsets matrices for stereo rendering /// Set eyes view offsets matrices for stereo rendering
[CLink] [Inline]
public static extern void rlSetMatrixViewOffsetStereo(in Matrix right, in Matrix left); public static void rlSetMatrixViewOffsetStereo(Matrix right, Matrix left)
{
rlSetMatrixViewOffsetStereo_Impl(right, left);
}
[LinkName("rlSetMatrixViewOffsetStereo")]
private static extern void rlSetMatrixViewOffsetStereo_Impl(in Matrix right, in Matrix left);
#endif #endif