GMLscripts.com

draw_sprite_shear

Draws a given sprite sheared by a given amount.

Adjust sliders to change shearing amount.Download
draw_sprite_shear(sprite, subimg, x, y, xshear, yshear)
Draws a given sprite sheared by a given amount.
COPY/// @func   draw_sprite_shear(sprite, subimg, x, y, xshear, yshear)
///
/// @desc   Draws a given sprite sheared by a given amount.
///
/// @param  {sprite}    sprite      sprite index
/// @param  {real}      subimg      image index
/// @param  {real}      x           x screen position
/// @param  {real}      y           y screen position
/// @param  {real}      xshear      shear rate of x axis
/// @param  {real}      yshear      shear rate of y axis
///
/// @return {real}      0 (unused)
///
/// GMLscripts.com/license

function draw_sprite_shear(sprite, subimg, x, y, xshear, yshear)
{
    var mShear = matrix_build_identity();
    mShear[4] = xshear;
    mShear[1] = yshear;
    mShear[12] = x;
    mShear[13] = y;

    matrix_stack_push(mShear);
    matrix_set(matrix_world, matrix_stack_top());
    draw_sprite(sprite, subimg, 0, 0);
    matrix_stack_pop();
    matrix_set(matrix_world, matrix_stack_top());

    return 0;
}

Contributors: xot

GitHub: View · Commits · Blame · Raw