Recent

Author Topic: How to Animate Sprites in a Virtual Screen  (Read 1803 times)

JasonLugg

  • Jr. Member
  • **
  • Posts: 67
How to Animate Sprites in a Virtual Screen
« on: April 15, 2018, 06:15:29 pm »
Hi All,

Thanks in advance!

I am able to animate an IBGLTexture, however want to have the ViertScreens sprites animating. I set the texture (Frame Size & Frame Index) the same way but no animation is shown?

Code: Pascal  [Select][+][-]
  1. AniImg:=TBGLBitmap.Create('PolyRoundCross.png');
  2.   AniImg.Texture.SetFrameSize(64,64);
  3.   AniImg.Texture.SetFrame(1);
  4.  
  5.   AniSpr:=TBGLSprite.Create(AniImg.Texture, 0);
  6.   AniSpr.X:=150;
  7.   AniSpr.Y:=250;
  8.   AniSpr.W:=64;
  9.   AniSpr.H:=64;
  10.  
  11.   BGLVirtualScreen1.Sprites.Add(AniSpr);
  12.  

Then in Screen Redraw:

Code: Pascal  [Select][+][-]
  1. BGLVirtualScreen1.Sprites.OnDraw;
  2.  

No sprite is displayed? Any ideas?

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: How to Animate Sprites in a Virtual Screen
« Reply #1 on: April 17, 2018, 12:49:03 pm »
Hi. You need to store the Texture in an IBGLTexture variable. Indeed the IBGLTexture interface is not guaranteed to exist continuously unless it is referenced somehow.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018