GetSpriteImageU returns a sprites current U coordinate of the sprites current image.
FACTS:
* Sprites vertex range from vertex 0 to 3 and are ordered in a clock wise fshion I.e [0]= top left, [1]= Top right, [2]=Bottom right, [3]=Bottom Left.
* See SpriteImageUV
Mini Tutorial:
This example creates an random image then applies this image to the screen full of sprites. Each sprites has it's UV coords stepped in, so the sprites will show the various stages of zooming.
; set variable to hold the image width and height ImgWidth=100 ImgHeight=100 ; First we'll create our FX image MyImage=NewFXImage(ImgWidth,Imgheight) ; tTll pb to redirect all drawing operations ; to this image RenderToImage MyImage ; now we draw 50 randomly sized circles onto the image For lp=0 To 50 CircleC Rnd(ImgWidth),Rnd(ImgHeight),Rnd(20),1,RndRGB() Next lp ; Tell PB to re-direct all drawing back to the screen RenderToScreen MaxSprites=20 pad=80 y=pad x=(pad*2) ; Start a For next loop to create a collection of sprites For lp=0 To MaxSprites ; create a sprite and assign it image #1 Spr=NewSprite(X,y,MyImage) ; center this sprites image handles CenterSpriteHandle spr ; Set this sprite to Draw Mode #2 (rotated) SpriteDrawMode spr,2 clip=lp*5 ; set the 4 UV corners of this sprite SpriteImageUV Spr,0,Clip,Clip SpriteImageUV Spr,1,ImgWidth-Clip,Clip SpriteImageUV Spr,2,ImgWidth-Clip,ImgHeight-Clip SpriteImageUV Spr,3,lp,ImgHeight-Clip DrawSprite Spr ; Read the Sprites Vertex positions For Vertex=0 To 3 Vx#=GetSpriteVertexX(Spr,Vertex) Vy#=GetSpriteVertexY(Spr,Vertex) u=GetSpriteImageU(Spr,Vertex) v=GetSpriteImageV(Spr,Vertex) s$=Digits$(u,3)+"x,"+Digits$(v,3)+"y" CenterText vx#,vy#,s$ Next vertex x=x+200 If x=>(GetScreenWidth()-pad) X=(Pad*2) Y=y+200 EndIf Next ; Display the Screen and wait for the user to press a key Sync WaitKey |
|