Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Test area
- var x0:float=20;
- var y0:float= 50;
- var u1:float=30;
- var v1:float=10;
- var u2:float=90;
- var v2:float=50;
- DrawTextureClipped(speedBaseTexture,u1,v1,u2,v2,x0,y0); //speedBase:Texture2D texture assigned in inspector
- }
- function DrawTextureClipped(textureToDraw : Texture2D,u1:float,v1:float,u2:float,v2:float,x:float,y:float)
- /* Goal: to draw part of a texture on the screen
- parameters:
- u1,v1,u2,v2: pixel coordinates of the textureToDraw
- x,y pixel coordinates of the box (up, left corner)
- WARNING: u2>u1 and v2>v1
- */
- {
- var du: float=u2-u1;
- var dv: float=v2-v1;
- GUI.BeginGroup (Rect (x, y, du+1, dv+1));
- GUI.Label ( Rect(-u1,-v1 ,textureToDraw.width,textureToDraw.height), textureToDraw );
- GUI.EndGroup ();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement