* * *

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

JasonLugg

  • Jr. Member
  • **
  • Posts: 55
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: 2639
    • 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

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus