sdl-gpu
sdl-gpu copied to clipboard
How to rotate rectangles?
I am new to sdl_gpu and I know I can draw rectangles using GPU_RectangleFilled2
How would I go about rotating this? Thank you in advanced
You can use GPU_Rotate
to rotate the matrix, then all proceeding rendering would be rotated. You can rotate the matrix back when you're done
Personally I'd use GPU_PolygonFilled
to draw a rectangular polygon, and rotate the vertices in code
Thank you very much!
So GPU_Rotate works, but is there any way to control the speed of the rotation?
If you want to rotate over time to sort of "spin", you'd just have to rotate using higher values to rotate "faster". This also depends on how quickly you're calling the function.
OK so I've been trying to use rotation for some time now and i can't really get it to work that well. Could you please send some example code? Thank you very much in advanced