* * *

Author Topic: BGRA Sprites  (Read 646 times)

JasonLugg

  • Jr. Member
  • **
  • Posts: 55
BGRA Sprites
« on: March 14, 2018, 12:09:32 pm »
Hi all and thx in advance

I have been using BGRABitmap and have noticed it has a Sprite Type and Sprite Engine, but cannot see any demos of how to implement it?

1) I want to draw on a TBGRABitmap and then use this image as a sprite.
2) I want to use sprites as I wish to implement animation and also scale them easily ad hoc.

I am able to animate using a IBGLTexture and achieve most of the above but thought it would have better batch rendering using the sprites/sprite engine?

Any input appreciated.

circular

  • Hero Member
  • *****
  • Posts: 2724
    • Personal webpage
Re: BGRA Sprites
« Reply #1 on: April 04, 2018, 11:04:07 am »
Here is an example:
https://github.com/bgrabitmap/bgrabitmap/tree/master/test/test4lcl_opengl/tux_game

Basically you can create a sprite by instantiating TBGLSprite class during the LoadTexture event. You can derive the TBGLSprite to define a custom behavior for the sprite.

In the TBGLContext, you can access all the sprites using the Sprites property. By calling Sprites.OnTimer, it will call that event for all sprites, so that they move according to their behavior. Calling Sprites.OnDraw will draw all the sprites.

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