Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Rotate Image on a non Center point.

$
0
0

Hey guys! So I am working on a game, and I'm using SdlDotNet as my graphics library. I can rotate images no problem without them moving to a different X and Y. This is because when you rotate an image in SdlDotNet the image's Size will change and its position within its Surface.. Long story I have a solution to this:

OffsetX = (Rotate Width / 2) - (Original Width / 2)

OffsetY = (Rotate Height / 2) - (Original Height / 2)

Posx -= OffsetX

Posy -= OffsetY.

However, I would like to create a Lever, in which its rotate point is not center, I want the rotate point to be somewhere within the image, maybe (Original Width / 2 / 2). However I don't know the equation or Math used in order to move the Object to that point when its rotated so it looks like its at a fixed point, if that makes sense, kinda like a wrench connected to a bolt.

Can someone please show me the equation and math to achieve this?

Thanks guys, Matt


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>