Skip to content
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

How to rotate rectangles? #241

Open
AxorusMT opened this issue Aug 29, 2022 · 5 comments
Open

How to rotate rectangles? #241

AxorusMT opened this issue Aug 29, 2022 · 5 comments

Comments

@AxorusMT
Copy link

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

@avahe-kellenberger
Copy link

avahe-kellenberger commented Aug 29, 2022

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

@AxorusMT
Copy link
Author

Thank you very much!

@AxorusMT
Copy link
Author

So GPU_Rotate works, but is there any way to control the speed of the rotation?

@avahe-kellenberger
Copy link

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.

@AxorusMT
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants