Closed Matias-Barrios closed 5 years ago
Hi @Matias-Barrios, I have been investigating the issue but I haven't found the real problem that is causing it yet. I did find that the board.Draw
function seems to contribute to the problem, at least at a glance. For example, if I call the function three more times, it seems to reproduce the problem as soon as the next piece appears. However, if I play the sound before the next piece appears, it seems to be fine.
It is strange that if I comment the body of SDL.DrawStuff
out, the problem seems to be gone even though it doesn't seem to be related. Perhaps memory corruption somewhere?
I will continue to investigate the issue when I can!
@veeableful Thanks for checking on this. I'll try to check on that relationship and I'll post here with my findings
@veeableful so I tried removing the board.Draw method entirely and it works fine. Then I tried removing only the SDL.Draw from it, and it also works fine.
So the issue is happening only because of the amount of times I call SDL.Draw. (?)
Do you have any idea if this is possible and why? I can help to solve the bug if you give me some hint
Hi @Matias-Barrios,
I seem to have fixed it by allocating the destination rectangle for Copy()
in the native C context. I suppose it has something to do with how Go's memory works (perhaps the rectangle got cleaned up before it can be used by SDL_Renderer?). I have pushed the fix into the master
branch so let me know if it works for you!
@veeableful Hi ! I have just downloaded the latest version and now it works perfectly fine. thanks so much for your help!! Your work is awesome.
No problem! Thanks for reporting the issue!
I'm trying to add audio to a game I'm making.
I can see the audio plays ok just the first three times ( .WAV by the way ) and from the 4th time.onwards is messed up ( like it were radio static ).
Here is the repo of my code : https://github.com/Matias-Barrios/SDL_Universe/blob/master/SDL/audio.go
Can someone tell me if I'm doing something wrong that might cause the issue?