Hello all
I’m trying to draw a box onto an image by pasting sprites of various shapes. I’m using DrawSprite() to do the rendering onto a back image.
I’m new to DrawSprite(), and I’m obviously missing something here, because the positions and sizes of the pasted sprite change depending on whether the app is running in fullscreen or windowed:
WINDOWED
FULLSCREEN
Would anyone mind having a look and seeing where I’m going wrong? Here's the code, the media is attached.
// set window properties
// ** try changing windowed to fullscreen. The pasted sprite size **
// ** and position are different. **
SetWindowTitle( "RenderToImage" )
SetWindowSize( 1024, 768, 1 )
// Set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
// Load a background sprite
iBackSpriteImage = LoadImage("Back.png")
iBackSprite = CreateSprite(iBackSpriteImage)
// Load the image I'm going to paste
iSpriteToPaste = CreateSprite(LoadImage("ThingToPaste.png"))
SetImageMagFilter( iSpriteToPaste, 0 )
SetSpriteTransparency( iSpriteToPaste, 1 )
// Set RenderToImage & make sure rez is the same as the app's
SetRenderToImage(iBackSpriteImage,0)
SetVirtualResolution(GetVirtualWidth(),GetVirtualHeight())
// Do all the sprite pasting here.
XPos# = 100
YPos# = 100
for iterY = 0 to 2
for iterX = 0 to 3
SetSpritePosition(iSpriteToPaste,XPos#,YPos#)
DrawSprite(iSpriteToPaste)
XPos# = XPos# + GetSpriteWidth(iSpriteToPaste)
next iterX
XPos# = 100
YPos# = YPos# + GetSpriteHeight(iSpriteToPaste)
next iterY
// Back to rendering to the screen
SetRenderToScreen()
// Move the sprite (so we can see which one is the actual sprite and not the
// pasted ones!)
SetSpritePosition(iSpriteToPaste,300,300)
do
SetSpritePosition(iSpriteToPaste,GetSpriteX(iSpriteToPaste)+0.1,300)
if (GetRawKeyPressed(27))
End
endif
Sync()
loop
Thanks for any advice,
James