Skip to content

Commit

Permalink
Repo reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
planetis-m committed Oct 26, 2024
1 parent 7205a2a commit 45336ae
Show file tree
Hide file tree
Showing 29 changed files with 29 additions and 25 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/raylib.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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".}
Expand Down
2 changes: 1 addition & 1 deletion src/rlgl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions wrapper/api/rlgl.json → tools/wrapper/api/rlgl.json
Original file line number Diff line number Diff line change
Expand Up @@ -2821,6 +2821,10 @@
{
"type": "int",
"name": "format"
},
{
"type": "int",
"name": "mipmapCount"
}
]
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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".}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 15 additions & 15 deletions update_bindings.nims
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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
Expand All @@ -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()
Expand Down

0 comments on commit 45336ae

Please sign in to comment.