// Project: test image wrap
// Created: 2015-12-27
// set window properties
SetWindowTitle( "test image wrap" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
ClearScreen()
// draw an image
white = MakeColor(255,255,255)
red = MakeColor(255,0,0)
DrawBox(0,0,64,64,red,red,red,red,1)
DrawEllipse(32,32,32,32,white,white,1)
// grab the image for the first sprite
// with an auto-generated sprite ID
// and set the image uv wrap to "repeat"
MyImage = GetImage(0,0,64,64)
SetImageWrapU(MyImage, 1)
SetImageWrapv(MyImage, 1)
// grab it again for the second sprite
// with an assigned sprite ID
// and set the image uv wrap to "repeat"
MyImage2 = GetImage(0,0,64,64)
SetImageWrapU(MyImage2, 1)
SetImageWrapv(MyImage2, 1)
// create the two sprites
MySprite = CreateSprite(MyImage)
CreateSprite(1,MyImage2)
SetSpritePosition(MySprite, 100,100)
SetSpritePosition(1,200,100)
// use two methods to change the uv
// coords of the image on each sprite
SetSpriteUVScale(MySprite, .25, .25)
SetSpriteUV(1, 0,0, 0,3, 3,0, 3,3)
setclearcolor(0,0,255)
do
Sync()
loop
(AGK version: 2.0.18)
Submitted: 2016-05-13 07:52:13
hint:
at mode repeat
if you see a border (color from other side) at transparent area try
SetSpriteUVBorder(spr,1)
1=no pixel offset
Help make AGK better by submitting an example for this command! (All examples are subject to approval)
// Project: test image wrap // Created: 2015-12-27 // set window properties SetWindowTitle( "test image wrap" ) SetWindowSize( 1024, 768, 0 ) // set display properties SetVirtualResolution( 1024, 768 ) SetOrientationAllowed( 1, 1, 1, 1 ) ClearScreen() // draw an image white = MakeColor(255,255,255) red = MakeColor(255,0,0) DrawBox(0,0,64,64,red,red,red,red,1) DrawEllipse(32,32,32,32,white,white,1) // grab the image for the first sprite // with an auto-generated sprite ID // and set the image uv wrap to "repeat" MyImage = GetImage(0,0,64,64) SetImageWrapU(MyImage, 1) SetImageWrapv(MyImage, 1) // grab it again for the second sprite // with an assigned sprite ID // and set the image uv wrap to "repeat" MyImage2 = GetImage(0,0,64,64) SetImageWrapU(MyImage2, 1) SetImageWrapv(MyImage2, 1) // create the two sprites MySprite = CreateSprite(MyImage) CreateSprite(1,MyImage2) SetSpritePosition(MySprite, 100,100) SetSpritePosition(1,200,100) // use two methods to change the uv // coords of the image on each sprite SetSpriteUVScale(MySprite, .25, .25) SetSpriteUV(1, 0,0, 0,3, 3,0, 3,3) setclearcolor(0,0,255) do Sync() loop