I was really wondering what is going on here :D I believe this code
tried initially to out-cast 'const' specifier but this is not needed here
at all. Currently, it just confuses whoever reads this so I changed it.
The old code would also trigger -Wcast-qual warning on some compilers.
Currently, a warning about _GNU_SOURCE being redefined is emitted when
compiling rglfw.c
In file included from rglfw.c:99:
external/glfw/src/posix_poll.c:27:9: warning: "_GNU_SOURCE" redefined
27 | #define _GNU_SOURCE
| ^~~~~~~~~~~
<command-line>: note: this is the location of the previous definition
This can be avoided by not defining _GNU_SOURCE on the command line for
this file.
Defining feature test macros in source code is not really good practice
so this should probably reviewed in glfw itself, at least to maybe check
#ifdef _GNU_SOURCE first. But for now this change will suffice.
Fixes#4725
When asking Makefile to create SHARED library for WEB
$ make TARGET_PLATFORM=PLATFORM_WEB RAYLIB_LIBTYPE=SHARED
it would instead silently create STATIC library
thus not fulfilling the request as expected
This commit adds an error in this case and stops further execution.
This is not consistent with Cmake, because Cmake throws the warning and
does not stop, but Cmake can easily recover from this case and people
probably does not even notice it. However, Makefile is something that
you have to handle yourself and you have to recover from any issues so
having an error and aborting with exit code 1 is more expected.
Otherwise people may spend a lot of time debugging Makefile in order to
understand what's even going on.
Fixes: https://github.com/raysan5/raylib/issues/4717
define STBIR_NO_SIMD when __TINYC__ is defined so stb_image_resize2 will
not include *mmintrin which are not supported by all compilers.
There are similar checks for __TINYC__ already elswere in raylib
and they are also mostly there to disable SIMD headers.
Additionally, move similar check for stb_image, to be a little bit
deeper. Before it was defining STBI_NO_SIMD without including stb_image
It was also clashing with note, causing said note to make no sense.
Fixes: https://github.com/raysan5/raylib/discussions/2994
Reference: https://github.com/nothings/stb/issues/1738
This change is replacing the hardcoded "#canvas" element references in
rcore_web to allow using canvas elements that use different names
(which is necessary when using multiple canvas elements on one page).
Also adding a cursor hiding example to mouse example.
Lately got some compilation `errors` related, it seems GCC 14 interprets some `const`-missmatch as errors instead of warnings (as previous versions).
But in any case, I don't see why an user won't be able to operate directly over of those returned buffers; `const` adds a restriction (for security reasons?) that in my opinion is useless.
From an expert on compilers (w64devkit creator), here there are some notes I agree with:
```
No const. It serves no practical role in optimization, and I cannot recall an instance where it caught, or would have caught, a mistake. I held out for awhile as prototype documentation, but on reflection I found that good parameter names were sufficient. Dropping const has made me noticeably more productive by reducing cognitive load and eliminating visual clutter. I now believe its inclusion in C was a costly mistake.
(One small exception: I still like it as a hint to place static tables in read-only memory closer to the code. I’ll cast away the const if needed. This is only of minor importance.)
```
Ref: https://nullprogram.com/blog/2023/10/08/
This optimization works in the following ways:
1. Reduces calls to malloc to 1. Instead of needing an extra array, we
can just swap the top half with the bottom half of the one array.
2. Unroll the inner for loop and remove a condition. Unrolling loops
buys some performance wins, but the real goal was to remove the if check
and just set the alpha channel to 255.
On my hidpi arm64 laptop, I saw ~60% improvement in performance in my
debug build (29 FPS vs 47 FPS). When optimized, the gains were roughly
10% (75 FPS vs 83%).
Signed-off-by: K. Adam Christensen <pope@shifteleven.com>
* Add implementation for CORE.Window.eventWaiting on PLATFORM_DESKTOP_SDL
* Optimize GetFrameTime() reset
* Optimize FLAG_WINDOW_ALWAYS_RUN and GetFrameTime() reset for PLATFORM_DESKTOP_GLFW
* Enable FLAG_WINDOW_ALWAYS_RUN by default on PLATFORM_DESKTOP_GLFW
* Revert enabling FLAG_WINDOW_ALWAYS_RUN by default on PLATFORM_DESKTOP_GLFW
* Add implementation for FLAG_WINDOW_ALWAYS_RUN on PLATFORM_DESKTOP_SDL
* Add reset for GetFrameTime()
* Update rmodels.c
resolves segfault with missing bone weights or bone IDs
* Update rmodels.c segfault with animation and missing normals/animnormals
* correct place.