diff --git a/advanced_usage.md b/manual/advanced_usage.md similarity index 100% rename from advanced_usage.md rename to manual/advanced_usage.md diff --git a/alternatives_table.rst b/manual/alternatives_table.rst similarity index 100% rename from alternatives_table.rst rename to manual/alternatives_table.rst diff --git a/changes_overview.md b/manual/changes_overview.md similarity index 100% rename from changes_overview.md rename to manual/changes_overview.md diff --git a/config_guide.md b/manual/config_guide.md similarity index 100% rename from config_guide.md rename to manual/config_guide.md diff --git a/readme.md b/readme.md index 274f29b..c651101 100644 --- a/readme.md +++ b/readme.md @@ -43,21 +43,21 @@ To compile and run an example: `nim c -r -d:release example.nim` Naylib introduces several improvements and changes compared to the original Raylib. For a comprehensive overview of these changes, including memory management, naming conventions, and API improvements, please refer to our -[Changes Overview](changes_overview.md) document. +[Changes Overview](manual/changes_overview.md) document. ## Advanced Usage For detailed instructions on advanced topics, please refer to our -[Advanced Usage Guide](advanced_usage.md). +[Advanced Usage Guide](manual/advanced_usage.md). Here are quick links to some important sections: -- [Important Usage Tips](advanced_usage.md#important-usage-tips) - Learn how to properly call `closeWindow` and other crucial tips -- [Building for the Web (WebAssembly)](advanced_usage.md#building-for-the-web-webassembly) - Instructions for compiling your project for web browsers -- [Building for Android](advanced_usage.md#building-for-android) - Step-by-step guide for Android development -- [Raylib Functions to Nim Alternatives](alternatives_table.rst) - Find Nim equivalents for raylib functions +- [Important Usage Tips](manual/advanced_usage.md#important-usage-tips) - Learn how to properly call `closeWindow` and other crucial tips +- [Building for the Web (WebAssembly)](manual/advanced_usage.md#building-for-the-web-webassembly) - Instructions for compiling your project for web browsers +- [Building for Android](manual/advanced_usage.md#building-for-android) - Step-by-step guide for Android development +- [Raylib Functions to Nim Alternatives](manual/alternatives_table.rst) - Find Nim equivalents for raylib functions -Check out the wrapper's [Configuration Guide](config_guide.md) for detailed information on how to use and contribute to naylib-wrapper. +Check out the wrapper's [Configuration Guide](manual/config_guide.md) for detailed information on how to use and contribute to naylib-wrapper. ## Platform Support diff --git a/src/raylib.nim b/src/raylib.nim index acc54cd..2ff50d6 100644 --- a/src/raylib.nim +++ b/src/raylib.nim @@ -12,7 +12,7 @@ when defined(emscripten): {.passC: "-DPLATFORM_WEB".} when defined(GraphicsApiOpenGlEs3): {.passC: "-DGRAPHICS_API_OPENGL_ES3".} - {.passL: "-sFULL_ES3 -sMAX_WEBGL_VERSION=2".} + {.passL: "-sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2".} else: {.passC: "-DGRAPHICS_API_OPENGL_ES2".} {.passL: "-sUSE_GLFW=3 -sWASM=1 -sTOTAL_MEMORY=67108864".} # 64MiB {.passL: "-sEXPORTED_RUNTIME_METHODS=ccall".} diff --git a/src/rlgl.nim b/src/rlgl.nim index 64caa77..0c6d0b9 100644 --- a/src/rlgl.nim +++ b/src/rlgl.nim @@ -444,7 +444,7 @@ proc loadTexture*(data: pointer, width: int32, height: int32, format: int32, mip ## Load texture data proc loadTextureDepth*(width: int32, height: int32, useRenderBuffer: bool): uint32 {.importc: "rlLoadTextureDepth", sideEffect.} ## Load depth texture/renderbuffer (to be attached to fbo) -proc loadTextureCubemap*(data: pointer, size: int32, format: PixelFormat): uint32 {.importc: "rlLoadTextureCubemap", sideEffect.} +proc loadTextureCubemap*(data: pointer, size: int32, format: PixelFormat, mipmapCount: int32): uint32 {.importc: "rlLoadTextureCubemap", sideEffect.} ## Load texture cubemap data proc updateTexture*(id: uint32, offsetX: int32, offsetY: int32, width: int32, height: int32, format: PixelFormat, data: pointer) {.importc: "rlUpdateTexture", sideEffect.} ## Update texture with new data on GPU diff --git a/mangle_names.nim b/tools/mangler/naylib_mangler.nim similarity index 100% rename from mangle_names.nim rename to tools/mangler/naylib_mangler.nim diff --git a/wrapper/api/raylib.json b/tools/wrapper/api/raylib.json similarity index 100% rename from wrapper/api/raylib.json rename to tools/wrapper/api/raylib.json diff --git a/wrapper/api/raymath.json b/tools/wrapper/api/raymath.json similarity index 100% rename from wrapper/api/raymath.json rename to tools/wrapper/api/raymath.json diff --git a/wrapper/api/rlgl.json b/tools/wrapper/api/rlgl.json similarity index 99% rename from wrapper/api/rlgl.json rename to tools/wrapper/api/rlgl.json index d6b7268..be09807 100644 --- a/wrapper/api/rlgl.json +++ b/tools/wrapper/api/rlgl.json @@ -2821,6 +2821,10 @@ { "type": "int", "name": "format" + }, + { + "type": "int", + "name": "mipmapCount" } ] }, diff --git a/wrapper/builder.nim b/tools/wrapper/builder.nim similarity index 100% rename from wrapper/builder.nim rename to tools/wrapper/builder.nim diff --git a/wrapper/config.nim b/tools/wrapper/config.nim similarity index 100% rename from wrapper/config.nim rename to tools/wrapper/config.nim diff --git a/wrapper/config.nims b/tools/wrapper/config.nims similarity index 100% rename from wrapper/config.nims rename to tools/wrapper/config.nims diff --git a/wrapper/config/raylib.cfg b/tools/wrapper/config/raylib.cfg similarity index 100% rename from wrapper/config/raylib.cfg rename to tools/wrapper/config/raylib.cfg diff --git a/wrapper/config/rlgl.cfg b/tools/wrapper/config/rlgl.cfg similarity index 100% rename from wrapper/config/rlgl.cfg rename to tools/wrapper/config/rlgl.cfg diff --git a/wrapper/ctypes.nim b/tools/wrapper/ctypes.nim similarity index 100% rename from wrapper/ctypes.nim rename to tools/wrapper/ctypes.nim diff --git a/wrapper/naylib_wrapper.nim b/tools/wrapper/naylib_wrapper.nim similarity index 100% rename from wrapper/naylib_wrapper.nim rename to tools/wrapper/naylib_wrapper.nim diff --git a/wrapper/processor.nim b/tools/wrapper/processor.nim similarity index 100% rename from wrapper/processor.nim rename to tools/wrapper/processor.nim diff --git a/wrapper/schema.nim b/tools/wrapper/schema.nim similarity index 100% rename from wrapper/schema.nim rename to tools/wrapper/schema.nim diff --git a/wrapper/snippets/raylib_aux.nim b/tools/wrapper/snippets/raylib_aux.nim similarity index 100% rename from wrapper/snippets/raylib_aux.nim rename to tools/wrapper/snippets/raylib_aux.nim diff --git a/wrapper/snippets/raylib_funcs.nim b/tools/wrapper/snippets/raylib_funcs.nim similarity index 100% rename from wrapper/snippets/raylib_funcs.nim rename to tools/wrapper/snippets/raylib_funcs.nim diff --git a/wrapper/snippets/raylib_header.nim b/tools/wrapper/snippets/raylib_header.nim similarity index 99% rename from wrapper/snippets/raylib_header.nim rename to tools/wrapper/snippets/raylib_header.nim index 7a32534..5fd39e0 100644 --- a/wrapper/snippets/raylib_header.nim +++ b/tools/wrapper/snippets/raylib_header.nim @@ -12,7 +12,7 @@ when defined(emscripten): {.passC: "-DPLATFORM_WEB".} when defined(GraphicsApiOpenGlEs3): {.passC: "-DGRAPHICS_API_OPENGL_ES3".} - {.passL: "-sFULL_ES3 -sMAX_WEBGL_VERSION=2".} + {.passL: "-sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2".} else: {.passC: "-DGRAPHICS_API_OPENGL_ES2".} {.passL: "-sUSE_GLFW=3 -sWASM=1 -sTOTAL_MEMORY=67108864".} # 64MiB {.passL: "-sEXPORTED_RUNTIME_METHODS=ccall".} diff --git a/wrapper/snippets/raylib_types.nim b/tools/wrapper/snippets/raylib_types.nim similarity index 100% rename from wrapper/snippets/raylib_types.nim rename to tools/wrapper/snippets/raylib_types.nim diff --git a/wrapper/snippets/rlgl_enums.nim b/tools/wrapper/snippets/rlgl_enums.nim similarity index 100% rename from wrapper/snippets/rlgl_enums.nim rename to tools/wrapper/snippets/rlgl_enums.nim diff --git a/wrapper/snippets/rlgl_header.nim b/tools/wrapper/snippets/rlgl_header.nim similarity index 100% rename from wrapper/snippets/rlgl_header.nim rename to tools/wrapper/snippets/rlgl_header.nim diff --git a/wrapper/snippets/rlgl_wrap.nim b/tools/wrapper/snippets/rlgl_wrap.nim similarity index 100% rename from wrapper/snippets/rlgl_wrap.nim rename to tools/wrapper/snippets/rlgl_wrap.nim diff --git a/wrapper/utils.nim b/tools/wrapper/utils.nim similarity index 100% rename from wrapper/utils.nim rename to tools/wrapper/utils.nim diff --git a/update_bindings.nims b/update_bindings.nims index 60bcb4f..881a691 100644 --- a/update_bindings.nims +++ b/update_bindings.nims @@ -6,10 +6,9 @@ const RaylibDir = PkgDir / "raylib" RaylibGit = "https://github.com/raysan5/raylib.git" RayLatestCommit = "7ad8fa689f92de4796d9a4121677a16cd8798c81" - ApiDir = PkgDir / "wrapper/api" DocsDir = PkgDir / "docs" - ParserDir = RaylibDir / "parser" - WrapperDir = PkgDir / "wrapper" + ToolsDir = PkgDir / "tools" + ApiDir = ToolsDir / "wrapper/api" template `/.`(x: string): string = when defined(posix): "./" & x else: x @@ -23,28 +22,28 @@ proc fetchLatestRaylib() = exec "git checkout " & RayLatestCommit proc buildParser() = - withDir(ParserDir): + withDir(ToolsDir / "parser"): let src = "raylib_parser.c" let exe = toExe("raylib_parser") # if not fileExists(exe) or fileNewer(src, exe): exec "cc " & src & " -o " & exe proc buildMangler() = - withDir(PkgDir): - let src = "mangle_names.nim" - let exe = toExe("mangle_names") + withDir(ToolsDir / "mangler"): + let src = "naylib_mangler.nim" + let exe = toExe("naylib_mangler") # if not fileExists(exe) or fileNewer(src, exe): exec "nim c --mm:arc --panics:on -d:release " & src proc buildWrapper() = - withDir(WrapperDir): + withDir(ToolsDir / "wrapper"): let src = "naylib_wrapper.nim" let exe = toExe("naylib_wrapper") # if not fileExists(exe) or fileNewer(src, exe): exec "nim c --mm:arc --panics:on -d:release -d:emiLenient " & src proc genApiJson(lib, prefix, after: string) = - withDir(ParserDir): + withDir(ToolsDir / "parser"): mkDir(ApiDir) let header = RaylibDir / "src" / (lib & ".h") let apiJson = ApiDir / (lib & ".json") @@ -53,7 +52,7 @@ proc genApiJson(lib, prefix, after: string) = " -t " & after.quoteShell & " -o " & apiJson.quoteShell proc genWrapper(lib: string) = - withDir(WrapperDir): + withDir(ToolsDir / "wrapper"): let outp = PkgDir / "src" / (lib & ".nim") let conf = "config" / (lib & ".cfg") exec /.toExe("naylib_wrapper") & " -c:" & conf & " -o:" & outp @@ -78,15 +77,16 @@ task genWrappers, "Generate Nim wrappers": # genWrapper("raymath") genWrapper("rlgl") -task mangle, "Mangle identifiers in raylib source": - buildMangler() - withDir(PkgDir): - exec /.toExe("mangle_names") & " src/raylib" - task update, "Update the raylib git directory": fetchLatestRaylib() rmDir(PkgDir / "src/raylib") cpDir(RaylibDir / "src", PkgDir / "src/raylib") + cpFile(RaylibDir / "parser/raylib_parser.c", ToolsDir / "parser/raylib_parser.c") + +task mangle, "Mangle identifiers in raylib source": + buildMangler() + withDir(ToolsDir / "mangler"): + exec /.toExe("naylib_mangler") & " " & (PkgDir / "src/raylib") task wrap, "Produce all raylib Nim wrappers": buildToolsTask()