plazma_arrow_shot_anim/Shared.c
/**
 * Assumes the base of the image is at its mid-left point. This isn't a problem
 * if you're drawing your images with the appropriated Draw<DIR>Image call.
 */
Assumes the base of the image is at its mid-left point. This isn't a problem
if you're drawing your images with the appropriated DrawImage call.
Assumes the base of the image is at its mid - left point . This isn ' t a problem if you ' re drawing your images with the appropriated DrawImage call .
struct SHR_Float2
SHR_CenterForTopAt(const struct SHR_Image *img,
                   struct SHR_Float2 top,
                   struct SHR_Float2 unit_direction)
{
  float x = top.x - (img->h * unit_direction.x)/2.0f;
  float y = top.y - (img->h * unit_direction.y)/2.0f;
  return (struct SHR_Float2){x, y};
}
struct SHR_Float2 SHR_CenterForTopAt ( const struct SHR_Image * img , struct SHR_Float2 top , struct SHR_Float2 unit_direction ) { float x = top . x - ( img -> h * unit_direction . x ) / 2.0f ; float y = top . y - ( img -> h * unit_direction . y ) / 2.0f ; return ( struct SHR_Float2 ) { x , y } ; }
Assumes the base of the image is at its mid-left point.
Assumes the base of the image is at its mid - left point .
// Notice that unit_direction.x is the cosine of the angle for // that direction. Also unit_direction.y is the sine of the angle // for the direction.