Well, I can't post the whole thing, but here's how it looks like:
Easyparticles.h
#ifndef HELPFUL_EASY_PARTICLES_H
#define HELPFUL_EASY_PARTICLES_H
#include "agk.h"
using namespace AGK;
class easyparticles
{
public:
int img_id, particles_id;
easyparticles() { };
void Init(char* img_path, float x, float y, float w, float h, float livefor, float freq)
{
img_id = agk::LoadImage(img_path);
particles_id = agk::CreateParticles(x,y);
agk::SetParticlesSize(particles_id,agk::GetImageWidth(img_id));
agk::SetParticlesImage(particles_id,img_id);
agk::SetParticlesStartZone(particles_id,x,y,x+w,y+h);
agk::SetParticlesLife(particles_id,livefor);
agk::SetParticlesFrequency(particles_id,freq);
}
void ColorFrame(float time, float r, float g, float b, float a)
{
agk::AddParticlesColorKeyFrame(particles_id,time,r,g,b,a);
}
~easyparticles() {
agk::DeleteParticles(particles_id);
agk::DeleteImage(img_id);
}
};
#endif
Using:
#include "template.h"
using namespace AGK;
#include "easyparticles.h"
easyparticles clickparticles;
void app::Begin( void )
{
clickparticles.Init("assets/newgame/particle.png",0.0f,0.0f,1.0f,1.0f,0.5f,60.0f);
agk::SetParticlesDepth(clickparticles.particles_id,6);
agk::SetParticlesVelocityRange(clickparticles.particles_id,6.0f,10.0f);
clickparticles.ColorFrame(0.0f,255,255,255,255.0f);
clickparticles.ColorFrame(0.5f,255,255,255,0.0f);
agk::SetParticlesVisible(clickparticles.particles_id,1);
agk::SetParticlesPosition(clickparticles.particles_id,100,100);
agk::UpdateParticles(clickparticles.particles_id,1.0f);
}
void app::Loop( void )
{
Sync();
}
void app::End( void )
{
clickparticles.~clickparticles();
}