Advertisement
Guest User

Untitled

a guest
Aug 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. //Test area
  2. var x0:float=20;
  3. var y0:float= 50;
  4. var u1:float=30;
  5. var v1:float=10;
  6. var u2:float=90;
  7. var v2:float=50;
  8.  
  9. DrawTextureClipped(speedBaseTexture,u1,v1,u2,v2,x0,y0); //speedBase:Texture2D texture assigned in inspector
  10.  
  11. }
  12. function DrawTextureClipped(textureToDraw : Texture2D,u1:float,v1:float,u2:float,v2:float,x:float,y:float)
  13. /* Goal: to draw part of a texture on the screen
  14. parameters:
  15. u1,v1,u2,v2: pixel coordinates of the textureToDraw
  16. x,y pixel coordinates of the box (up, left corner)
  17. WARNING: u2>u1 and v2>v1
  18. */
  19. {
  20. var du: float=u2-u1;
  21. var dv: float=v2-v1;
  22. GUI.BeginGroup (Rect (x, y, du+1, dv+1));
  23. GUI.Label ( Rect(-u1,-v1 ,textureToDraw.width,textureToDraw.height), textureToDraw );  
  24. GUI.EndGroup ();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement