I have trouble to make my sprite(Arrow) to point at the position of my mouse cursor but i don't get the Right results. I've tried this:
SDL_Point Center{ 40,40 };
int Delta_x; int Delta_y;
int mouse_x, mouse_y;
double Result;
SDL_GetMouseState(&mouse_x, &mouse_y);
Delta_x = xPos - mouse_x;
Delta_y = yPos - mouse_y;
Result = (atan2(Delta_x, Delta_y) * 180.0000)/ 3.14159265;
m_Sprite->Render(Result, Center);
RendercopyEx:
SDL_RenderCopyEx(m_Renderer, m_Texture, NULL, &m_Rect, Angle , &Center, SDL_FLIP_NONE);
This is the result I get (in the original picture, the arrow is pointing up):