plazma_arrow_shot_anim/Shared.c
/**
 * Draw the image with its CENTER at x,y and rotated by ANGLE around its
 * center. You should also specify x,y from left->right and bottom->up.
 *
 * @note The flip is as in SDL_RenderCopyEx.
 *
 * @note Angle is in radians.
 *
 * @note Generally speaking, the rotation is independent of the position,
 * which is independent of the flip. The parameters are chosen so that no
 * matter the order in which you think of applying these transformations
 * (translation, rotation, flip), you get the same results. This obviously
 * restricts what you can do, but it also makes it way simpler to use this
 * function.
 */
Draw the image with its CENTER at x,y and rotated by ANGLE around its
center. You should also specify x,y from left->right and bottom->up.

@note The flip is as in SDL_RenderCopyEx.

@note Angle is in radians.

@note Generally speaking, the rotation is independent of the position,
which is independent of the flip. The parameters are chosen so that no
matter the order in which you think of applying these transformations
(translation, rotation, flip), you get the same results. This obviously
restricts what you can do, but it also makes it way simpler to use this
function.
Draw the image with its CENTER at x y and rotated by ANGLE around its center . You should also specify x y from left - > right and bottom - > up . @note The flip is as in SDL_RenderCopyEx . @note Angle is in radians . @note Generally speaking the rotation is independent of the position which is independent of the flip . The parameters are chosen so that no matter the order in which you think of applying these transformations ( translation rotation flip ) you get the same results . This obviously restricts what you can do but it also makes it way simpler to use this function .
int
SHR_DrawRightImage(struct SHR_Screen *screen,
                   const struct SHR_Image *img,
                   struct SHR_Float2 center,
                   float angle,
                   SDL_RendererFlip flip)
{
  const double RAD_TO_DEG = 180.0 / M_PI;
  float x, y;
  y = (screen->h - 1 - center.y) - img->h/2;
  x = center.x - img->w/2;
  angle *= -1;
  SDL_Rect dest_rect = {x, y, img->w, img->h};
  return SDL_RenderCopyEx(screen->rend, img->tex, NULL, &dest_rect,
                          angle*RAD_TO_DEG, NULL, flip);
}
int SHR_DrawRightImage ( struct SHR_Screen * screen , const struct SHR_Image * img , struct SHR_Float2 center , float angle , SDL_RendererFlip flip ) { const double RAD_TO_DEG = 180.0 / M_PI ; float x , y ; y = ( screen -> h - 1 - center . y ) - img -> h / 2 ; x = center . x - img -> w / 2 ; angle *= -1 ; SDL_Rect dest_rect = { x , y , img -> w , img -> h } ; return SDL_RenderCopyEx ( screen -> rend , img -> tex , NULL , & dest_rect , angle * RAD_TO_DEG , NULL , flip ) ; }
Draw the image with its CENTER at x,y and rotated by ANGLE around its
 center.
Draw the image with its CENTER at x y and rotated by ANGLE around its center .