gmlscripts

draw_sprite_hdr_ext

Sep 23rd, 2016
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// draw_sprite_hdr_ext(sprite,subimg,x,y,xscale,yscale,rotate,r,g,b,alpha)
  2. {
  3.     var sprite, subimg, xposit, yposit, xscale, yscale, rotate, hdrRed, hdrGrn, hdrBlu, alpha;
  4.     sprite = argument0;
  5.     subimg = argument1;
  6.     xposit = argument2;
  7.     yposit = argument3;
  8.     xscale = argument4;
  9.     yscale = argument5;
  10.     rotate = argument6;
  11.     hdrRed = argument7;
  12.     hdrGrn = argument8;
  13.     hdrBlu = argument9;
  14.     alpha = argument10;
  15.     // normal draw mode for the first pass
  16.     draw_set_blend_mode(bm_normal);
  17.     do {
  18.         // determine color blending for this pass
  19.         color = make_color_rgb(min(max(0,hdrRed),255), min(max(0,hdrGrn),255), min(max(0,hdrBlu),255));
  20.         // draw the sprite with color blending
  21.         draw_sprite_ext(sprite, subimg, xposit, yposit, xscale, yscale, rotate, color, alpha);
  22.         // remove a full pass of light
  23.         hdrRed -= 255;
  24.         hdrGrn -= 255;
  25.         hdrBlu -= 255;
  26.         // every subsequent pass is drawn with add
  27.         draw_set_blend_mode(bm_add);  
  28.     // keep drawing until there is no more light
  29.     } until (max(hdrRed, hdrGrn, hdrBlu) <= 0);
  30.     draw_set_blend_mode(bm_normal);
  31. }
Add Comment
Please, Sign In to add comment