TimelineFX particle system in C++ with Marmalade as sample.
This is a C++ library to read, process and show particles from TimelineFX Editor. It's ready to be integrated into your current engine/system (see below). The sources can be found in timelinefx/source.
The editor is paid, but there are lots of free premade effects ready for use on their website. Check out the youtube video at every package.
The library is based on the official TimelineFX's BlitzMax sources.
The system should support both fixed and variable timestep with optional tweening between states in Draw, although I didn't test it yet.
I didn't want to bring additional dependency, so you have two options:
- Unzip the official .eff file before use and edit the sprite paths in data.xml (in the end usually) manually.
- File->Export .zip from TimelineFX editor, unzip it and you are ready to go.
Sorry for this. Looks more convenient to me than implementing libzip and loading images from memory stream.
Basic usage is described here.
- Take the source from timelinefx/source.
- Take the PugiXML from official website or here from pugixml. OR inherit XMLLoader and implement your own xml loader.
- Inherit AnimImage to load and keep the sprites.
- Inherit ParticleManager for drawing the images (the particle system is calling DrawSprite with correct parameters).
- Inherit EffectsLibrary and implement two Create methods with correct classes (this is a factory).
Check out timelinefx-sample/source/MarmaladeEffectsLibrary.h+cpp for example.
- Checkout three projects - pugixml, timelinefx and timelinefx-sample
- Open timelinefx-sample.mkb
- Run
You can use timelinefx subproject directly in your game/app. Simply implement the classes like in Common C++.
timelinefx subproject can be used as precompiled and linked static libraries (timelinefx.mkf and .mkb) or the sources (timelinefx-source.mkf).
There are three parts which can be implemented by you by simple inheriting the specific classes and defining your own behaviour:
- XMLLoader - right now, PugiXMLLoader (dependency) is implemented and used, but you can reimplement it by your XML parser.
- AnimImage - you should inherit this to keep image data for your system/engine.
- ParticleManager::DrawSprite - inherit this to take your AnimImage and send/queue it to your rendering system
Except of PugiXML, I implemented Marmalade sample for 2. and 3. There is a sample project showing how to use it. DrawSprite is implemented with basic batching.
There are still some minor issues I know about, especially when using subeffects, but don't hesitate to report or fix.