New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sf::cursor.loadFromPixels doesn't work. #2066
Comments
Can you give the |
I just tried 2.6.x from the snapshot. It is the same result |
The same bad (3.0.0 behavior) or same good (2.5.1 behavior) result? 😄 |
Yeah sorry, I mean same result as 3.0.0 haha. |
Are you able to bisect the commit history to find the exact commit which introduced the problem? That would be really helpful to know. |
It looks like the bug was introduced in e0f2356 |
This fixes the issue for me (branch 2.6.x): diff --git a/src/SFML/Window/Unix/CursorImpl.cpp b/src/SFML/Window/Unix/CursorImpl.cpp
index d0d51300..f2cfdf80 100644
--- a/src/SFML/Window/Unix/CursorImpl.cpp
+++ b/src/SFML/Window/Unix/CursorImpl.cpp
@@ -80,10 +80,10 @@ bool CursorImpl::loadFromPixelsARGB(const Uint8* pixels, Vector2u size, Vector2u
const std::size_t numPixels = size.x * size.y;
for (std::size_t pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex)
{
- cursorImage->pixels[pixelIndex] = static_cast<Uint8>(pixels[pixelIndex * 4 + 2] +
- (pixels[pixelIndex * 4 + 1] << 8) +
- (pixels[pixelIndex * 4 + 0] << 16) +
- (pixels[pixelIndex * 4 + 3] << 24));
+ cursorImage->pixels[pixelIndex] = static_cast<Uint32>(pixels[pixelIndex * 4 + 2] +
+ (pixels[pixelIndex * 4 + 1] << 8) +
+ (pixels[pixelIndex * 4 + 0] << 16) +
+ (pixels[pixelIndex * 4 + 3] << 24));
}
// Create the cursor. |
@Neko-Box-Coder, can you confirm that the merge fix (#2073) onto 2.6.x fixes the problem? |
@eXpl0it3r Thanks a lot, I can confirm it fixed the problem. Will this be merged to master at some point? |
Yes, might wait for some other 2.6.x PR, but if those don't come through soon, then I'll do another back merge. |
sf::cursor.loadFromPixels doesn't work.
sf::cursor.loadFromPixels is not showing anything (invisible cursor) despite it being set and returned true.
Note that this works on 2.5.1 (Monochrome) but not 3.0.0 (latest snapshot) at least on my machine, any confirmation on other Linux machines will be appreciated.
If there's anything needed, just message me and I will replay asap.
Your environment
Steps to reproduce
Expected behavior
It should show the cursor as a black 8x8 image.
Actual behavior
The cursor is invisible instead.
The text was updated successfully, but these errors were encountered: