janet-lang / jaylib

Janet bindings to Raylib
MIT License
137 stars 36 forks source link

Update to raylib 4.5 #48

Closed archydragon closed 1 year ago

archydragon commented 1 year ago

I went through the official changelog of raylib releases after 4.0, and that's what came after this.

Not every new function from 4.2 and 4.5 has been added, only the ones which seemed really necessary by now (e.g. I skipped color manipulation functions added in 4.5), partially to not make this PR terribly huge and hard for reviewing.

sogaiu commented 1 year ago

I don't know if it's a new thing, but I get some warning about poll vs ppoll when building on a Linux box.

The following output is for jpm --workers=1 build:

compiling src/main.c to build/src___main.o...
compiling raylib/src/rcore.c to build/raylib___src___rcore.o...
compiling raylib/src/rmodels.c to build/raylib___src___rmodels.o...
compiling raylib/src/raudio.c to build/raylib___src___raudio.o...
raylib/src/raudio.c: In function ‘LoadMusicStream’:
raylib/src/raudio.c:1290:45: warning: passing argument 1 of ‘qoaplay_open’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 1290 |         qoaplay_desc *ctxQoa = qoaplay_open(fileName);
      |                                             ^~~~~~~~
In file included from raylib/src/raudio.c:233:
raylib/src/external/qoaplay.c:86:34: note: expected ‘char *’ but argument is of type ‘const char *’
   86 | qoaplay_desc *qoaplay_open(char *path)
      |                            ~~~~~~^~~~
In file included from raylib/src/raudio.c:268:
raylib/src/external/jar_mod.h: In function ‘jar_mod_load_file’:
raylib/src/external/jar_mod.h:1541:13: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 1541 |             fread(modctx->modfile, fsize, 1, f);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compiling raylib/src/rglfw.c to build/raylib___src___rglfw.o...
In file included from raylib/src/rglfw.c:87:
raylib/src/external/glfw/src/posix_poll.c: In function ‘_glfwPollPOSIX’:
raylib/src/external/glfw/src/posix_poll.c:49:32: warning: implicit declaration of function ‘ppoll’; did you mean ‘poll’? [-Wimplicit-function-declaration]
   49 |             const int result = ppoll(fds, count, &ts, NULL);
      |                                ^~~~~
      |                                poll
compiling raylib/src/rshapes.c to build/raylib___src___rshapes.o...
compiling raylib/src/rtext.c to build/raylib___src___rtext.o...
compiling raylib/src/rtextures.c to build/raylib___src___rtextures.o...
compiling raylib/src/utils.c to build/raylib___src___utils.o...
generating meta file build/jaylib.meta.janet...
compiling src/main.c to build/src___main.static.o...
compiling raylib/src/rcore.c to build/raylib___src___rcore.static.o...
compiling raylib/src/rmodels.c to build/raylib___src___rmodels.static.o...
compiling raylib/src/raudio.c to build/raylib___src___raudio.static.o...
raylib/src/raudio.c: In function ‘LoadMusicStream’:
raylib/src/raudio.c:1290:45: warning: passing argument 1 of ‘qoaplay_open’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 1290 |         qoaplay_desc *ctxQoa = qoaplay_open(fileName);
      |                                             ^~~~~~~~
In file included from raylib/src/raudio.c:233:
raylib/src/external/qoaplay.c:86:34: note: expected ‘char *’ but argument is of type ‘const char *’
   86 | qoaplay_desc *qoaplay_open(char *path)
      |                            ~~~~~~^~~~
In file included from raylib/src/raudio.c:268:
raylib/src/external/jar_mod.h: In function ‘jar_mod_load_file’:
raylib/src/external/jar_mod.h:1541:13: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 1541 |             fread(modctx->modfile, fsize, 1, f);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compiling raylib/src/rglfw.c to build/raylib___src___rglfw.static.o...
In file included from raylib/src/rglfw.c:87:
raylib/src/external/glfw/src/posix_poll.c: In function ‘_glfwPollPOSIX’:
raylib/src/external/glfw/src/posix_poll.c:49:32: warning: implicit declaration of function ‘ppoll’; did you mean ‘poll’? [-Wimplicit-function-declaration]
   49 |             const int result = ppoll(fds, count, &ts, NULL);
      |                                ^~~~~
      |                                poll
compiling raylib/src/rshapes.c to build/raylib___src___rshapes.static.o...
compiling raylib/src/rtext.c to build/raylib___src___rtext.static.o...
compiling raylib/src/rtextures.c to build/raylib___src___rtextures.static.o...
creating native module build/jaylib.so...
compiling raylib/src/utils.c to build/raylib___src___utils.static.o...
creating static library build/jaylib.a...

Build works though :+1: though some of the tests don't run.

It seems that test4.janet and test5.janet use set-camera-mode which appears to have gone away. Changing the calls to use the newly provided update-camera seems to help, but draw-cube-texture seems to have left the party as well.

Don't know if it's worth it / easy to update the tests.

archydragon commented 1 year ago

I get some warning about poll vs ppoll when building on a Linux box.

Added _GNU_SOURCE=true define. Same one is used inside raylib for buinding with Zig toolchain. The warning is gone now when building with gcc (and replaced with another warning about macro redefined, but, welp). Also tested building on Linux with clang, seems to be fine.

As of tests, I didn't touch them, honestly, but can take a look a bit later.

sogaiu commented 1 year ago

Thanks for taking a look.

I confirm that there are different (better than before?) warnings. I don't know what's up with that either.

Build still succeeds and except for test4.janet and test5.janet, looks like things are running :+1:

Regarding DrawCubeTexture, I noticed this [1] -- perhaps there is something in here that might help. If it's too much work, may be the tests can be removed / changed.

I'm not the person who decides these things though :)


[1] May be the creator of Raylib is the inventor of a new technique -- "deprecation by examplification" (^^;