GMLscripts.com

draw_surface_center_rotate

draw_surface_center_rotate(surface, cx, cy, rot)
Draws surface centered at given point with rotation.
COPY
  1. /// @func draw_surface_center_rotate(surface, cx, cy, rot)
  2. ///
  3. /// @desc Draws surface centered at given point with rotation.
  4. ///
  5. /// @param {surface} surface surface to draw
  6. /// @param {real} cx x-position for surface center
  7. /// @param {real} cy y-position for surface center
  8. /// @param {real} rot rotation in degrees
  9. ///
  10. /// GMLscripts.com/license
  11.  
  12. function draw_surface_center_rotate(surface, cx, cy, rot)
  13. {
  14. var mx = surface_get_width(surface) / 2;
  15. var my = surface_get_height(surface) / 2;
  16. var mat = matrix_get(matrix_world);
  17. matrix_stack_push(matrix_build(cx, cy, 0, 0, 0, rot, 1, 1, 1));
  18. matrix_set(matrix_world, matrix_stack_top());
  19. draw_surface(surface, -mx, -my);
  20. matrix_stack_pop();
  21. matrix_set(matrix_world, mat);
  22. }

Contributors: xot

GitHub: View · Commits · Blame · Raw