gmlscripts

draw_sprite_halfpixel

Jun 26th, 2014
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// draw_sprite_halfpixel(sprite, subimg, x, y, xscale, yscale, rot, color, alpha)
  2. //
  3. //  Draws a sprite transformed about the center of its origin pixel
  4. //  instead of the top-left corner. This can be useful when you require
  5. //  a sprite to maintain the on-screen position of its origin pixel as it
  6. //  is scaled and rotated. Otherwise works the same as draw_sprite_ext().
  7. //
  8. //      sprite      sprite index, real
  9. //      subimg      sprite subimage, real
  10. //      x,y         position, real
  11. //      xscale      horizontal scaling, real
  12. //      yscale      vertical scaling, real
  13. //      rot         rotation in degrees, real
  14. //      blend       color blending, real
  15. //      alpha       alpha blending, real
  16. //
  17. /// GMLscripts.com/license
  18. {
  19.     d3d_transform_stack_push();
  20.     d3d_transform_add_translation(-0.5, -0.5, 0);
  21.     d3d_transform_add_rotation_z(argument6);
  22.     d3d_transform_add_scaling(argument4, argument5, 1);
  23.     d3d_transform_add_translation(argument2+0.5, argument3+0.5, 0);
  24.     draw_sprite_ext(argument0, argument1, 0, 0, 1, 1, 0, argument7, argument8);
  25.     d3d_transform_stack_pop();
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment