janet-lang / jaylib Goto Github PK
View Code? Open in Web Editor NEWJanet bindings to Raylib
License: MIT License
Janet bindings to Raylib
License: MIT License
What version of janet was jaylib last successfully built for?
Build attempts for janet 1.29.1-meson and raylib 4.5.0 (installed with brew) fail (macos 13.0.1).
$ janet -v
1.29.1-meson
$ jpm install https://github.com/janet-lang/jaylib.git
[RAYLIB (master #)]$ jpm install https://github.com/janet-lang/jaylib.git
Initialized empty Git repository in /usr/local/Cellar/janet/1.29.1/lib/janet/.cache/git__https___github.com_janet-lang_jaylib.git/.git/
remote: Enumerating objects: 640, done.
remote: Counting objects: 100% (437/437), done.
remote: Compressing objects: 100% (156/156), done.
remote: Total 640 (delta 317), reused 350 (delta 281), pack-reused 203
Receiving objects: 100% (640/640), 1.74 MiB | 2.39 MiB/s, done.
Resolving deltas: 100% (422/422), done.
From https://github.com/janet-lang/jaylib
* [new branch] master -> origin/master
From https://github.com/janet-lang/jaylib
* branch HEAD -> FETCH_HEAD
HEAD is now at 2355a67 Merge pull request #44 from turnerdev/shaders
Submodule 'raylib' (https://github.com/raysan5/raylib.git) registered for path 'raylib'
Cloning into '/usr/local/Cellar/janet/1.29.1/lib/janet/.cache/git__https___github.com_janet-lang_jaylib.git/raylib'...
Submodule path 'raylib': checked out 'fec96137e8d10ee6c88914fbe5e5429c13ee1dac'
compiling raylib/src/rtextures.c to build/raylib___src___rtextures.o...
compiling raylib/src/rtext.c to build/raylib___src___rtext.o...
compiling raylib/src/rglfw.c to build/raylib___src___rglfw.o...
compiling raylib/src/rshapes.c to build/raylib___src___rshapes.o...
compiling raylib/src/rcore.c to build/raylib___src___rcore.o...
compiling raylib/src/raudio.c to build/raylib___src___raudio.o...
compiling raylib/src/utils.c to build/raylib___src___utils.o...
generating meta file build/jaylib.meta.janet...
compiling raylib/src/rmodels.c to build/raylib___src___rmodels.o...
compiling src/main.c to build/src___main.o...
compiling raylib/src/utils.c to build/raylib___src___utils.static.o...
In file included from src/main.c:13:
src/3d.h:453:59: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
ModelAnimation *anims = LoadModelAnimations(fileName, &animCount);
^~~~~~~~~~
raylib/src/raylib.h:1488:79: note: passing argument to parameter 'animCount' here
RLAPI ModelAnimation *LoadModelAnimations(const char *fileName, unsigned int *animCount); // Load model animations from file
^
In file included from src/main.c:15:
src/shader.h:56:13: error: expected expression
float valueFloat = (float) janet_getnumber(argv, 2);
^
src/shader.h:57:62: error: use of undeclared identifier 'valueFloat'
SetShaderValue(*shader, locIndex, (const void*) &valueFloat, uniformType);
^
src/shader.h:60:13: error: expected expression
int valueInt = janet_getinteger(argv, 2);
^
src/shader.h:61:62: error: use of undeclared identifier 'valueInt'
SetShaderValue(*shader, locIndex, (const void*) &valueInt, uniformType);
^
src/shader.h:64:13: error: expected expression
Vector2 valueVec2 = jaylib_getvec2(argv, 2);
^
src/shader.h:65:62: error: use of undeclared identifier 'valueVec2'
SetShaderValue(*shader, locIndex, (const void*) &valueVec2, uniformType);
^
src/shader.h:68:13: error: expected expression
Vector3 valueVec3 = jaylib_getvec3(argv, 2);
^
src/shader.h:69:62: error: use of undeclared identifier 'valueVec3'
SetShaderValue(*shader, locIndex, (const void*) &valueVec3, uniformType);
^
src/shader.h:72:13: error: expected expression
Vector4 valueVec4 = jaylib_getvec4(argv, 2);
^
src/shader.h:73:62: error: use of undeclared identifier 'valueVec4'
SetShaderValue(*shader, locIndex, (const void*) &valueVec4, uniformType);
^
1 warning and 10 errors generated.
error: command failed with non-zero exit code 1
In file included from raylib/src/raudio.c:256:
raylib/src/external/jar_xm.h:521:9: warning: 'ALIGN' macro redefined [-Wmacro-redefined]
#define ALIGN(x, b) (((x) + ((b) - 1)) & ~((b) - 1))
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/i386/param.h:85:9: note: previous definition is here
#define ALIGN(p) __DARWIN_ALIGN(p)
^
raylib/src/raudio.c:1290:45: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
qoaplay_desc *ctxQoa = qoaplay_open(fileName);
^~~~~~~~
raylib/src/external/qoaplay.c:86:34: note: passing argument to parameter 'path' here
qoaplay_desc *qoaplay_open(char *path)
^
2 warnings generated.
error: build fail
in pdag [/usr/local/Cellar/janet/1.29.1/lib/janet/jpm/dagbuild.janet] (tailcall) on line 79, column 23
in <anonymous> [/usr/local/Cellar/janet/1.29.1/lib/janet/jpm/pm.janet] on line 236, column 9
in <anonymous> [/usr/local/Cellar/janet/1.29.1/lib/janet/jpm/pm.janet] on line 221, column 5
in bundle-install [/usr/local/Cellar/janet/1.29.1/lib/janet/jpm/pm.janet] on line 219, column 3
in install [/usr/local/Cellar/janet/1.29.1/lib/janet/jpm/commands.janet] on line 190, column 20
in run [/usr/local/Cellar/janet/1.29.1/lib/janet/jpm/cli.janet] (tailcall) on line 88, column 9
in run-main [boot.janet] on line 3889, column 16
in cli-main [boot.janet] on line 4042, column 17
Building a fresh clone fails with multiple unresolved external symbol
s and a warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
.
PS C:\Users\w1n5t0n\code\janet> git clone --recursive https://github.com/janet-lang/jaylib.git
Cloning into 'jaylib'...
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (21/21), done.
Receiving objects: 100% (198/198), 1.64 MiB | 4.30 MiB/s, done.
Resolving deltas: 100% (108/108), done.
Submodule 'raylib' (https://github.com/raysan5/raylib.git) registered for path 'raylib'
Cloning into 'C:/Users/w1n5t0n/code/janet/jaylib/raylib'...
remote: Enumerating objects: 28232, done.
remote: Total 28232 (delta 0), reused 0 (delta 0), pack-reused 28232
Receiving objects: 100% (28232/28232), 355.95 MiB | 10.19 MiB/s, done.
Resolving deltas: 100% (20070/20070), done.
Submodule path 'raylib': checked out '7ef114d1da2c34a70bba5442497103441647d8f3'
PS C:\Users\w1n5t0n\code\janet> cd .\jaylib\
PS C:\Users\w1n5t0n\code\janet\jaylib> jpm build
compiling src/main.c to build\src___main.obj...
main.c
compiling raylib/src/core.c to build\raylib___src___core.obj...
core.c
C:\Users\w1n5t0n\code\janet\jaylib\raylib\src\rlgl.h(1646): warning C4090: 'function': different 'const' qualifiers
compiling raylib/src/models.c to build\raylib___src___models.obj...
models.c
compiling raylib/src/raudio.c to build\raylib___src___raudio.obj...
raudio.c
compiling raylib/src/rglfw.c to build\raylib___src___rglfw.obj...
rglfw.c
compiling raylib/src/shapes.c to build\raylib___src___shapes.obj...
shapes.c
compiling raylib/src/text.c to build\raylib___src___text.obj...
text.c
compiling raylib/src/textures.c to build\raylib___src___textures.obj...
textures.c
compiling raylib/src/utils.c to build\raylib___src___utils.obj...
utils.c
linking build\jaylib.dll...
Creating library build\jaylib.lib and object build\jaylib.exp
src___main.obj : error LNK2019: unresolved external symbol _janet_unwrap_number referenced in function _idx_getfloat
src___main.obj : error LNK2019: unresolved external symbol _janet_wrap_number referenced in function _cfun_GetScreenWidth
src___main.obj : error LNK2019: unresolved external symbol _janet_nanbox32_from_tagi referenced in function _cfun_InitWindow
src___main.obj : error LNK2019: unresolved external symbol _janet_nanbox32_from_tagp referenced in function _cfun_GetWindowHandle
src___main.obj : error LNK2019: unresolved external symbol _janet_checkint referenced in function _jaylib_castdef
src___main.obj : error LNK2019: unresolved external symbol _janet_array referenced in function _cfun_SetConfigFlags
src___main.obj : error LNK2019: unresolved external symbol _janet_array_push referenced in function _cfun_SetConfigFlags
src___main.obj : error LNK2019: unresolved external symbol _janet_buffer_push_u8 referenced in function _cfun_DrawText
src___main.obj : error LNK2019: unresolved external symbol _janet_tuple_begin referenced in function _cfun_GetMousePosition
src___main.obj : error LNK2019: unresolved external symbol _janet_tuple_end referenced in function _cfun_GetMousePosition
src___main.obj : error LNK2019: unresolved external symbol _janet_tuple_n referenced in function _cfun_ImageDimensions
src___main.obj : error LNK2019: unresolved external symbol _janet_string_begin referenced in function _jaylib_tracelog_callback
src___main.obj : error LNK2019: unresolved external symbol _janet_string_end referenced in function _jaylib_tracelog_callback
src___main.obj : error LNK2019: unresolved external symbol _janet_cstring referenced in function _cfun_GetMonitorName
src___main.obj : error LNK2019: unresolved external symbol _janet_csymbol referenced in function _cfun_SetConfigFlags
src___main.obj : error LNK2019: unresolved external symbol _janet_indexed_view referenced in function _cfun_LoadImageEx
src___main.obj : error LNK2019: unresolved external symbol _janet_abstract referenced in function _cfun_Camera2D
src___main.obj : error LNK2019: unresolved external symbol _janet_gcroot referenced in function _cfun_SetTraceLogCallback
src___main.obj : error LNK2019: unresolved external symbol _janet_gcunroot referenced in function _cfun_SetTraceLogCallback
src___main.obj : error LNK2019: unresolved external symbol _janet_cstrcmp referenced in function _cfun_SetConfigFlags
src___main.obj : error LNK2019: unresolved external symbol _janet_pcall referenced in function _jaylib_tracelog_callback
src___main.obj : error LNK2019: unresolved external symbol _janet_stacktrace referenced in function _jaylib_tracelog_callback
src___main.obj : error LNK2019: unresolved external symbol _janet_smalloc referenced in function _cfun_LoadFontEx
src___main.obj : error LNK2019: unresolved external symbol _janet_sfree referenced in function _cfun_DrawLineStrip
src___main.obj : error LNK2019: unresolved external symbol _janet_cfuns referenced in function __janet_init
src___main.obj : error LNK2019: unresolved external symbol _janet_panicf referenced in function _cfun_SetConfigFlags
src___main.obj : error LNK2019: unresolved external symbol _janet_arity referenced in function _cfun_SetConfigFlags
src___main.obj : error LNK2019: unresolved external symbol _janet_fixarity referenced in function _cfun_InitWindow
src___main.obj : error LNK2019: unresolved external symbol _janet_getnumber referenced in function _cfun_SetMouseScale
src___main.obj : error LNK2019: unresolved external symbol _janet_getcstring referenced in function _cfun_InitWindow
src___main.obj : error LNK2019: unresolved external symbol _janet_getkeyword referenced in function _cfun_SetConfigFlags
src___main.obj : error LNK2019: unresolved external symbol _janet_getbuffer referenced in function _cfun_UpdateAudioStream
src___main.obj : error LNK2019: unresolved external symbol _janet_getfunction referenced in function _cfun_SetTraceLogCallback
src___main.obj : error LNK2019: unresolved external symbol _janet_getinteger referenced in function _cfun_InitWindow
src___main.obj : error LNK2019: unresolved external symbol _janet_getinteger64 referenced in function _cfun_LoadImageEx
src___main.obj : error LNK2019: unresolved external symbol _janet_getindexed referenced in function _cfun_LoadFontEx
src___main.obj : error LNK2019: unresolved external symbol _janet_getabstract referenced in function _cfun_BeginMode2D
C:\Users\w1n5t0n\AppData\Local\Apps\Janet\C\\\janet.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
build\jaylib.dll : fatal error LNK1120: 37 unresolved externals
error: command failed with non-zero exit code 1120
in os/execute
in shell [C:\Users\w1n5t0n\AppData\Local\Apps\Janet\bin\\jpm.janet] (tailcall) on line 172, column 3
in do-rule [C:\Users\w1n5t0n\AppData\Local\Apps\Janet\bin\\jpm.janet] on line 291, column 26
in do-rule [C:\Users\w1n5t0n\AppData\Local\Apps\Janet\bin\\jpm.janet] (tailcall) on line 287, column 44
in _thunk [C:\Users\w1n5t0n\AppData\Local\Apps\Janet\bin\\jpm.janet] on line -1, column -1
in cli-main [boot.janet] on line 3371, column 39
PS C:\Users\w1n5t0n\code\janet\jaylib> janet -v
1.15.3-6392b37
Janet version 1.15.3-6392b37
cflags, lflags, and defines need to be FreeBSD specific in this case:
diff --git a/project.janet b/project.janet
index 96e9e81..d954222 100644
--- a/project.janet
+++ b/project.janet
@@ -16,6 +16,7 @@
:windows '["user32.lib" "gdi32.lib" "winmm.lib" "shell32.lib"]
:macos '["-lpthread" "-framework" "Cocoa" "-framework" "CoreVideo" "-framework" "IOKit" "-framework" "OpenGL"]
:linux '["-lpthread" "-lX11"]
+ :freebsd '["-L/usr/local/lib" "-lpthread" "-lX11"]
#default
'["-lpthread"]))
@@ -24,7 +25,7 @@
:cflags [;default-cflags ;cflags]
- :defines {"PLATFORM_DESKTOP" true "_POSIX_C_SOURCE" "200809L"}
+ :defines {"PLATFORM_DESKTOP" true } # "_POSIX_C_SOURCE" "200809L"}
:source ["src/main.c"
@@ -47,6 +48,8 @@
"src/shapes.h"
"src/3d.h"]
+ :cflags [;default-cflags ;'["-I/usr/local/include"]]
+
:lflags [;default-lflags ;lflags])
# `jpm run repl` to run a repl with access to jaylib
That illustrates the changes necessary, however, is not fit for actual use (would probably break other platforms) so is mostly provided as documentation.
The other ordeal might be that the cflags, lflags, should be defaults under FreeBSD in jpm but am not sure if that is true or not. Depends on what those are under other platforms. The _POSIX_C_SOURCE
define breaks soundcard.h
on some platforms supposedly (currently on FreeBSD to our knowledge).
The Raylib documentation for LoadFontEx
says to "use NULL for codepoints and 0 for codepointCount to load the default character set". Literally every example of Raylib font loading I could find does this, but it seems not to be possible with Janet's wrapping of the API.
While using Janet 1.8.1 (installed with x64 exe installer) and VSCode 2017 or VSCode 2019 compiler, when I try to install the jaylib module I get an error C2099. Log attached below.
C:\Users\emman\workspace\janet\sandbox>jpm install https://github.com/janet-lang/jaylib.git
From https://github.com/janet-lang/jaylib
* branch master -> FETCH_HEAD
Already up to date.
no dependencies found
compiling build\src___main.obj...
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27038 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
main.c
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(203): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(204): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(205): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(206): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(207): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(208): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(209): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(210): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(211): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(212): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(213): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(214): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(215): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(216): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(217): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(218): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(219): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(220): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(221): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(222): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(223): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(224): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(225): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(226): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(227): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(228): error C2099: initializer is not a constant
c:\janet-1.8.1\library\.cache\https___github.com_janet-lang_jaylib.git\src\types.h(229): error C2099: initializer is not a constant
Error building git repository dependency: command exited with status 2
Hello.
I want to try hot-reload draw function as game runs. I tried to start game in another thread to save main thread's REPL:
(use jaylib)
(defn draw []
(begin-drawing)
(clear-background [0 0 0])
(end-drawing))
(defn worker [parent]
(init-window 100 100 "Test Game")
(while (not (window-should-close))
(draw))
(close-window)
(thread/send parent :done))
(thread/new worker)
(thread/receive)
I got this error message:
error: could not send worker function <function worker> to thread
in thread/new
in _thunk [janet-jaylib.janet] (tailcall) on line 15, column 1
This maybe means that raylib wants main thread. How can I run raylib in main thread but still use REPL? Is REPL works under janet's main thread or it is C wrapper?
Hi, this might be a simple error.
Do you happen to know why it fails to build?
Any help or advice is greatly appreciated.
I installed raylib with nix package manager and janet with xbps on void linux.
doas jpm install https://github.com/janet-lang/jaylib.git
From https://github.com/janet-lang/jaylib
* branch master -> FETCH_HEAD
Already up to date.
no dependencies found
compiling src/main.c to build/src___main.o...
Error building git repository dependency: ( "cc"
"-c"
"src/main.c"
"-D_POSIX_C_SOURCE=200809L"
"-DPLATFORM_DESKTOP"
"-std=c99"
"-Wall"
"-Wextra"
"-Iraylib/src"
"-I/usr/include/janet"
"-I/usr/lib64/janet"
"-O2"
"-fPIC"
"-o"
"build/src___main.o"): No such file or directory
error: ( "cc"
"-c"
"src/main.c"
"-D_POSIX_C_SOURCE=200809L"
"-DPLATFORM_DESKTOP"
"-std=c99"
"-Wall"
"-Wextra"
"-Iraylib/src"
"-I/usr/include/janet"
"-I/usr/lib64/janet"
"-O2"
"-fPIC"
"-o"
"build/src___main.o"): No such file or directory
in os/execute
in shell [/bin/jpm] (tailcall) on line 154, column 3
in do-rule [/bin/jpm] on line 273, column 26
in do-rule [/bin/jpm] on line 269, column 44
in do-rule [/bin/jpm] on line 269, column 44
in <anonymous> [/bin/jpm] on line 864, column 7
in <anonymous> [/bin/jpm] on line 850, column 5
in install-git [/bin/jpm] on line 866, column 71
in install [/bin/jpm] (tailcall) on line 1308, column 20
in _thunk [/bin/jpm] on line -1, column -1
in cli-main [boot.janet] on line 3559, column 39
Raylib's LoadImageFromMemory seems absent from Jaylib functions. Too complex to port or in the works? If neither, I'll take a look at it.
Hi, folks. With the latest janet/jpm (1.12.1-15e05b69) on Ubuntu 18.04:
$ env JANET_MODPATH=$PWD/modpath jpm install https://github.com/janet-lang/jaylib.git
...
raylib/src/core.c:191:14: fatal error: GLFW/glfw3.h: No such file or directory
#include <GLFW/glfw3.h> // GLFW3 library: Windows, OpenGL context and Input management
^~~~~~~~~~~~~~
It is my understanding that raylib comes with glfw bundled (raylib/src/external/glfw
), so this means some paths are not configured correctly for some reason. Any ideas?
jgame on master [?] via ❄️ impure
❯ cat game.janet
(use jaylib)
(init-window 100 100 "Test Game")
(set-target-fps 60)
(hide-cursor)
(while (not (window-should-close))
(begin-drawing)
(clear-background [0 0 0])
(let [[x y] (get-mouse-position)]
(draw-circle-gradient x y 31.4 :lime :red)
(draw-poly [500 200] 5 40 0 :magenta)
(draw-line-bezier
[(- x 100) y]
[(+ x 100) (+ y 50)]
4 :pink)
(draw-line-ex
[x (- y 10)]
[x (+ y 10)]
4 :sky-blue)
(draw-line-strip
[[x 0] [x 100] [50 y] [10 180]]
:ray-white))
(end-drawing))
(close-window)
jgame on master [?] via ❄️ impure
❯ janet game.janet
INFO: Initializing raylib 3.0
WARNING: GLFW: Error: 65542 Description: GLX: Failed to load GLX
WARNING: GLFW: Failed to initialize Window
INFO: TIMER: Target time per frame: 16.667 milliseconds
janet: raylib/src/external/glfw/src/input.c:501: glfwSetInputMode: Assertion `window != NULL' failed.
Aborted (core dumped)
jgame on master [?] via ❄️ impure
❯
I am on nixos version 20.09 and am getting this issue. From what ive looked up online it seems to be from a bad version of glx in relation to the system one. All the results seem to be about minecraft on windows 🤣
Minecraft works on my system tho :\
I upgraded janet 1.9.1 to the latest and in the process also installed the latest version of jaylib but now I'm getting this error,
error: could not load native /usr/local/Cellar/janet/1.10.1/lib/janet/jaylib.so: dlopen(/usr/local/Cellar/janet/1.10.1/lib/janet/jaylib.so, 2): Symbol not found: _alloca
Referenced from: /usr/local/Cellar/janet/1.10.1/lib/janet/jaylib.so
Expected in: flat namespace
in /usr/local/Cellar/janet/1.10.1/lib/janet/jaylib.so
in native
in <anonymous> [boot.janet] on line 2343, column 26
in require-1 [boot.janet] on line 2362, column 18
in import* [boot.janet] (tailcall) on line 2382, column 15
This was the code
(use jaylib)
(def [width height] [800 450])
(var [x y radius] [(/ width 2) (/ height 2) 50])
(defn main [& args]
(init-window width height "Jay")
(set-target-fps 60)
(while (not (window-should-close))
(when (key-pressed? :q)
(close-window))
(when (key-down? :right)
(if (< x 300)
(set x (+ x 3))))
(when (key-down? :left)
(if (> x 0)
(set x (- x 3))))
(when (key-down? :down)
(set y (+ y 3)))
(when (key-down? :up)
(set y (- y 3)))
(begin-drawing)
(clear-background [22 22 0])
(draw-text "move ball" 10 10 20 :white)
(draw-circle (+ x radius) (+ y radius) radius :maroon)
(draw-fps 50 50)
(end-drawing))
(close-window))
true code:
(pp nearest-vertex)
(draw-circle-gradient (splice nearest-vertex) 4.0 :lime :red))))
(264.160827636719 400)
error: bad slot #0, expected 32 bit signed integer, got 264.160827636719
in jaylib/draw-circle-gradient
in _thunk [main.janet] (tailcall) on line 42, column 9
(draw-circle-gradient [264.160827636719 400] 4.0 :lime :red)
Hi. This lib is really good. Thanks for that.
How do I create a color with transparency? (color-alpha 255 0 0 255)
seems a no-show.
Hi, I noticed mesh generation functions are marked as non-implemented and was curious as to why, is it a technical challenge or just work? I'd be happy to help to contribute if needed, any guidelines are appreciated!
Hi
The following error after running jpm build
git clone https://github.com/janet-lang/jaylib
cd jaylib/
git submodule update --init --recursive
jpm build
compiling build/src___main.o...
cc1: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
error: command exited with status 1
in shell [/Users/ben/builds/bin/jpm] (tailcall) on line 264, column 5
in do-rule [/Users/ben/builds/bin/jpm] on line 100, column 24
in do-rule [/Users/ben/builds/bin/jpm] on line 98, column 44
in do-rule [/Users/ben/builds/bin/jpm] (tailcall) on line 98, column 44
My system:
ProductName: Mac OS X
ProductVersion: 10.15.4
BuildVersion: 19E287
cc --version
cc (Homebrew GCC 9.3.0_1) 9.3.0
There appears to be an error in src/types.h
starting from this commit.
Apparently an extra trailing comma in this line.
Originally reported here.
Removing the comma appears to make build succeed.
Thank you for jaylib it works like a charm !
https://github.com/raysan5/raygui
Do you know if I can use raygui with jaylib ? if yes how ?
raygui looks like a set of .h files.
Regards
My current issue is when I try to install:
$ sudo jpm install jaylib
From https://github.com/janet-lang/jaylib
* branch HEAD -> FETCH_HEAD
HEAD is now at 14a0665 Merge pull request #37 from CFiggers/master
compiling raylib/src/rcore.c to build/raylib___src___rcore.o...
raylib/src/rcore.c:194:14: fatal error: GLFW/glfw3.h: No such file or directory
194 | #include "GLFW/glfw3.h" // GLFW3 library: Windows, OpenGL context and Input management
| ^~~~~~~~~~~~~~
compilation terminated.
error: command failed with non-zero exit code 1
error: build fail
in pdag [/usr/local/lib/janet/jpm/dagbuild.janet] (tailcall) on line 79, column 23
in <anonymous> [/usr/local/lib/janet/jpm/pm.janet] on line 236, column 9
in <anonymous> [/usr/local/lib/janet/jpm/pm.janet] on line 221, column 5
in bundle-install [/usr/local/lib/janet/jpm/pm.janet] on line 219, column 3
in install [/usr/local/lib/janet/jpm/commands.janet] (tailcall) on line 197, column 20
in run-main [boot.janet] on line 3783, column 16
in cli-main [boot.janet] on line 3928, column 17
I checked and the file is there:
13:40:58: /usr/lib
$ find . -name glfw3.h
./janet/.cache/git__https___github.com_janet-lang_jaylib.git/raylib/examples/others/external/include/GLFW/glfw3.h
./janet/.cache/git__https___github.com_janet-lang_jaylib.git/raylib/src/external/glfw/include/GLFW/glfw3.h
I also tried to clone the repository and and install with jpm directly from there as suggested in the README. However I got no luck.
I also tried to install another package (jtbox) to see if it was a jpm issue but this install was successful. That's why I am submitting the issue here.
Not sure if I am doing something wrong... Can anyone give me some direction on where to go from here?
Some versions info:
OS: Artix Linux
janet: Janet 1.26.0-75179de8 linux/x64 - '(doc)' for help
jpm: not sure how to check the version but I tried through the aur install and then I got the latest version from the repository
How does one access a texture's inner fields, for example tex.width
and tex.height
?
(def img (load-image-1 "raylib.png"))
(def tex (load-texture-from-image img))
(unload-image img)
# This doesn't work
(def w (get tex :width))
(def h (get tex :height))
Is it possible to use TCC and the Raylib TCC version with Janet on Windows? Thanks!
Ubuntu 22.04 on Windows Subsystem for Linux (WSL2)
gh repo clone janet-lang/jaylib -- --recurse-submodules
cd jaylib
jpm build
jpm test
Tests pass.
$ jpm test
running test/collision.janet ...
running test/test0.janet ...
INFO: Initializing raylib 4.0
WARNING: GLFW: Error: 65544 Description: X11: Failed to load Xlib
non-zero exit code in test/test0.janet: 139
running test/test1.janet ...
info: Initializing raylib 4.0
warning: GLFW: Error: 65544 Description: X11: Failed to load Xlib
non-zero exit code in test/test1.janet: 139
running test/test2.janet ...
INFO: Initializing raylib 4.0
WARNING: GLFW: Error: 65544 Description: X11: Failed to load Xlib
non-zero exit code in test/test2.janet: 139
running test/test3.janet ...
INFO: Initializing raylib 4.0
WARNING: GLFW: Error: 65544 Description: X11: Failed to load Xlib
non-zero exit code in test/test3.janet: 139
running test/test4.janet ...
INFO: Initializing raylib 4.0
WARNING: GLFW: Error: 65544 Description: X11: Failed to load Xlib
non-zero exit code in test/test4.janet: 139
running test/test5.janet ...
INFO: Initializing raylib 4.0
WARNING: GLFW: Error: 65544 Description: X11: Failed to load Xlib
non-zero exit code in test/test5.janet: 139
Failing test scripts: 6
Building raylib independent of jaylib
Building raylib itself works just fine:
cd raylib/src
make
cd ../examples
make core
cd core
core_basic_window
=> window appears correctlyLocating source of error message
Error seems to be triggered by the GLFW embedded in raylib submodule:
libX11.so.6
confirmed present on system:
Adjusting compiler flags in project.janet
Tried adding "-static"
flag to lflags
in project.janet
. Results in these errors during jpm build
:
[...]
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
[...]
error: command failed with non-zero exit code 1
creating static library build/jaylib.a...
error: build fail
in pdag [/usr/local/lib/janet/jpm/dagbuild.janet] (tailcall) on line 79, column 23
in run-main [boot.janet] on line 3783, column 16
in cli-main [boot.janet] on line 3928, column 17
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.