SHARE
TWEET

Untitled

a guest Dec 28th, 2014 179 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void draw_surface(int id, gs_scalar x, gs_scalar y, int color, gs_scalar alpha)
  2. {
  3.         int w=surface_get_width(id);
  4.         int h=surface_get_height(id);
  5.  
  6.         draw_primitive_begin_texture(pr_trianglestrip, surface_get_texture(id));
  7.         draw_vertex_texture_color(x,y,0,1,color,alpha);
  8.         draw_vertex_texture_color(x+w,y,1,1,color,alpha);
  9.         draw_vertex_texture_color(x,y+h,0,0,color,alpha);
  10.         draw_vertex_texture_color(x+w,y+h,1,0,color,alpha);
  11.         draw_primitive_end();
  12. }
  13.  
  14. void draw_surface_ext(int id,gs_scalar x, gs_scalar y,gs_scalar xscale, gs_scalar yscale,double rot,int color,gs_scalar alpha)
  15. {
  16.     const gs_scalar w=surface_get_width(id)*xscale, h=surface_get_height(id)*yscale;
  17.     rot *= M_PI/180;
  18.  
  19.     gs_scalar ulcx = x + xscale * cos(M_PI+rot) + yscale * cos(M_PI/2+rot),
  20.           ulcy = y - yscale * sin(M_PI+rot) - yscale * sin(M_PI/2+rot);
  21.  
  22.         draw_primitive_begin_texture(pr_trianglestrip, surface_get_texture(id));
  23.         draw_vertex_texture_color(ulcx,ulcy,0,1,color,alpha);
  24.         draw_vertex_texture_color(ulcx + w*cos(rot), ulcy - w*sin(rot),1,1,color,alpha);
  25.         ulcx += h * cos(3*M_PI/2 + rot);
  26.         ulcy -= h * sin(3*M_PI/2 + rot);
  27.         draw_vertex_texture_color(ulcx,ulcy,0,0,color,alpha);
  28.         draw_vertex_texture_color(ulcx + w*cos(rot), ulcy - w*sin(rot),1,0,color,alpha);
  29.         draw_primitive_end();
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top