mirror of
https://github.com/Kapendev/parin.git
synced 2025-04-29 14:39:55 +03:00
Fixed a raylib-d bug with DUB.
This commit is contained in:
parent
5ca28d6340
commit
1b4e5f4736
3 changed files with 183 additions and 179 deletions
|
@ -53,6 +53,7 @@ While DUB simplifies the setup process, Popka itself doesn't require DUB.
|
||||||
```
|
```
|
||||||
|
|
||||||
Popka doesn't require raylib-d, but we include it as a dependency for its convenient raylib download script.
|
Popka doesn't require raylib-d, but we include it as a dependency for its convenient raylib download script.
|
||||||
|
It is recommended to remove raylib-d from your dub.json file after the installation is complete.
|
||||||
|
|
||||||
2. **Compile example**
|
2. **Compile example**
|
||||||
|
|
||||||
|
|
23
source/popka/vendor/ray/raylibpp.d
vendored
23
source/popka/vendor/ray/raylibpp.d
vendored
|
@ -7,6 +7,9 @@ module popka.vendor.ray.raylibpp;
|
||||||
|
|
||||||
import popka.vendor.ray.raylib;
|
import popka.vendor.ray.raylib;
|
||||||
|
|
||||||
|
enum isRaylibPackageAvailable = is(typeof((){import raylib;}));
|
||||||
|
|
||||||
|
static if (!isRaylibPackageAvailable) {
|
||||||
// Basic shapes drawing functions
|
// Basic shapes drawing functions
|
||||||
alias drawPixel = DrawPixel;
|
alias drawPixel = DrawPixel;
|
||||||
alias drawPixel = DrawPixelV;
|
alias drawPixel = DrawPixelV;
|
||||||
|
@ -162,16 +165,6 @@ alias drawBillboard = DrawBillboardPro;
|
||||||
alias drawMesh = DrawMesh;
|
alias drawMesh = DrawMesh;
|
||||||
alias drawMeshInstanced = DrawMeshInstanced;
|
alias drawMeshInstanced = DrawMeshInstanced;
|
||||||
|
|
||||||
version (WebAssembly) {
|
|
||||||
@nogc nothrow extern(C)
|
|
||||||
void emscripten_set_main_loop(void* ptr, int fps, int loop);
|
|
||||||
@nogc nothrow extern(C)
|
|
||||||
void emscripten_cancel_main_loop();
|
|
||||||
}
|
|
||||||
|
|
||||||
// We intentionally leave attributes out to provide maximum flexibility for any use case.
|
|
||||||
// The given function should return a bool value.
|
|
||||||
// A return value of true will exit the loop, while false will allow it to continue.
|
|
||||||
void updateWindow(alias loopFunc)() {
|
void updateWindow(alias loopFunc)() {
|
||||||
version(WebAssembly) {
|
version(WebAssembly) {
|
||||||
static void __loopFunc() {
|
static void __loopFunc() {
|
||||||
|
@ -207,3 +200,13 @@ mixin template addRayStart(alias startFunc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
pragma(msg, "Helper functions are not available when raylib-d is a DUB dependecy. Remove raylib-d from your dub.json file.");
|
||||||
|
}
|
||||||
|
|
||||||
|
version (WebAssembly) {
|
||||||
|
@nogc nothrow extern(C)
|
||||||
|
void emscripten_set_main_loop(void* ptr, int fps, int loop);
|
||||||
|
@nogc nothrow extern(C)
|
||||||
|
void emscripten_cancel_main_loop();
|
||||||
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ int main(string[] args) {
|
||||||
auto mode = args.length > 1 ? args[1] : "";
|
auto mode = args.length > 1 ? args[1] : "";
|
||||||
if (mode != "build" && mode != "run") {
|
if (mode != "build" && mode != "run") {
|
||||||
writeln("Error: `", mode, "` isn't a mode.\nAvailable modes: [build, run]");
|
writeln("Error: `", mode, "` isn't a mode.\nAvailable modes: [build, run]");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can pass extra flags to ldc if needed.
|
// Can pass extra flags to ldc if needed.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue