Render issue with DrawRectangleLines/DrawRectangleLinesEx
Hi there, I'm currently experiencing the extra pixel issue described in the following links using your go wrapper: https://github.com/raylib-cs/raylib-cs/issues/311 https://github.com/raysan5/raylib/issues/3973
The issue I'm seeing on Linux - KDE Neon using Wayland shows an extra pixel on the top right and bottom right of a one pixel rectangle.
I was curious if this is something that could easily be resolved with raylib-go, since it's been resolved in those other issues? Or do you happen to know a way I could resolve this using raylib-go?
Thanks for your time!
I'm going to take a stab at getting raylib updated to the latest.. I'll open a PR shortly.
If you didn't pay attention to your update in PR, then it breaks Android, noaudio build, etc. It is never just about copying files. And as far as I can see from your links, the partial fix is from last year. Have you tried using the @master branch rather than the latest tagged version? And in the first link, you can see how to work around the issue.
Apologies, I should have marked that as WIP. I didn't realize that I had to enable github actions on the fork I created so the workflows never ran. There are a number of errors that were not happening for me locally. I've corrected this on my fork and am continuing to work on resolving those errors on the PR.
And in the first link, you can see how to work around the issue.
I tried the suggested workarounds from the first link but I was unable to resolve it on my end.
@gen2brain This repository has a separation between SDL2 and SDL3 currently, however raylib 5.5.0 does not support SDL2 it seems. The rcore_desktop_sdl.c file in raylib is using syntax which is not compatible with SDL2:
In file included from rcore.c:545:
platforms/rcore_desktop_sdl.c: In function ‘PollInputEvents’:
platforms/rcore_desktop_sdl.c:1753:31: error: ‘SDL_Event’ has no member named ‘gbutton’; did you mean ‘button’?
1753 | switch (event.gbutton.button)
| ^~~~~~~
| button
platforms/rcore_desktop_sdl.c:1781:60: error: ‘SDL_Event’ has no member named ‘gbutton’; did you mean ‘button’?
1781 | if (platform.gamepadId[i] == event.gbutton.which)
| ^~~~~~~
| button
platforms/rcore_desktop_sdl.c:1794:31: error: ‘SDL_Event’ has no member named ‘gbutton’; did you mean ‘button’?
1794 | switch (event.gbutton.button)
| ^~~~~~~
| button
platforms/rcore_desktop_sdl.c:1822:60: error: ‘SDL_Event’ has no member named ‘gbutton’; did you mean ‘button’?
1822 | if (platform.gamepadId[i] == event.gbutton.which)
| ^~~~~~~
| button
platforms/rcore_desktop_sdl.c: In function ‘InitPlatform’:
platforms/rcore_desktop_sdl.c:2058:33: warning: initialization of ‘SDL_JoystickID *’ {aka ‘int *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
2058 | SDL_JoystickID *joysticks = SDL_GetJoysticks(&numJoysticks); // array of joystick IDs, they do not start from 0
| ^~~~~~~~~~~~~~~~
Should I go with the assumption that if we're using the sdl build tag, that we will only be working with sdl3?
Update: I was able to resolve compiling with sdl2 by adding an sdl_shim.h file and
#ifdef USING_SDL2_PROJECT
#include "SDL2/SDL.h"
SDL_JoystickID* rl_sdl2_GetJoysticks(int* count) {
int n = SDL_NumJoysticks();
if (count) *count = n;
SDL_JoystickID* ids = (SDL_JoystickID*)SDL_malloc(sizeof(SDL_JoystickID) * (n > 0 ? n : 1));
if (!ids) return NULL;
for (int i = 0; i < n; ++i) {
if (!SDL_IsGameController(i)) { ids[i] = -1; continue; }
SDL_GameController* gc = SDL_GameControllerOpen(i);
if (!gc) { ids[i] = -1; continue; }
ids[i] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(gc));
SDL_GameControllerClose(gc);
}
return ids;
}
#endif