Page 1 of 1

ZoomSprite() without Sprite3D

Posted: Fri Jul 29, 2011 5:05 am
by J. Baker
Here's the procedure and an example to download. ;)

DOWNLOAD EXAMPLE

Code: Select all

Structure ZoomSpriteCalculations
  SavedSpriteWidth.f
  SavedSpriteHeight.f
  SaveData.l
EndStructure

Procedure ZoomSprite(Sprite, SpriteWidth.f, SpriteHeight.f)

  Static Dim SpriteZoom.ZoomSpriteCalculations(99)
  
  If SpriteZoom(Sprite)\SaveData = 0
    
      SpriteZoom(Sprite)\SavedSpriteWidth = SpriteWidth
      SpriteZoom(Sprite)\SavedSpriteHeight = SpriteHeight
      
       CreateSprite(Sprite, SpriteWidth, SpriteHeight)
  
        StartDrawing(SpriteOutput(Sprite))
          DrawImage(ImageID(Sprite), 0, 0, SpriteWidth, SpriteHeight)
         StopDrawing()
          
       SpriteZoom(Sprite)\SaveData = 1
  EndIf
  
  If SpriteZoom(Sprite)\SavedSpriteWidth <> SpriteWidth Or SpriteZoom(Sprite)\SavedSpriteHeight <> SpriteHeight
    SpriteZoom(Sprite)\SaveData = 0
  EndIf
  
EndProcedure

Re: ZoomSprite() without Sprite3D

Posted: Fri Jul 29, 2011 6:24 am
by J. Baker
If you are using windows, I just noticed Library Subsystem: DirectX7 gives better results when zooming.

Re: ZoomSprite() without Sprite3D

Posted: Fri Jul 29, 2011 1:15 pm
by STARGÅTE
Not a good trick / tip.
The procedure is much too slow for the application.
The procedure works only with sprite numbers 0-99 ... and there is no check whether sprite is within a range of 0-99
but many use random numbers with #PB_Any
why you not use a Map like SpriteZoom(Str(Sprite))?

Re: ZoomSprite() without Sprite3D

Posted: Fri Jul 29, 2011 8:38 pm
by J. Baker
STARGÅTE wrote:Not a good trick / tip.
The procedure is much too slow for the application.
The procedure works only with sprite numbers 0-99 ... and there is no check whether sprite is within a range of 0-99
but many use random numbers with #PB_Any
why you not use a Map like SpriteZoom(Str(Sprite))?
I simply showed that it can be done. You are welcome to do with it how ever you want. ;)