scottferg / Go-SDL2

Go bindings for SDL 2.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cast to C.SDL_Rect is wrong, due to int size

jsfr opened this issue · comments

As far as I can see C.SDL_Rect uses standard C ints (and not int16). Thus when the sdl.Rect is casted the int16 and uint16 fields as only half of an int. This means that the width, height, x and y of a rectangle gets all screwed up, and often nothing can be seen.

I'm not all to sharp in C, but as at least on my 64-bit machine changing the sdl.Rect fields to int32 in structs_amd64.go seems to do the trick.

This is similar to how it is done in veandco's SDL-wrapper, see rect.go.

Functions this affect is e.g. Render.FillRect(&rect)

Closing as this seems to go nowhere