I want to use cocos2d-x in windows. i have many pyro file(The previous project)。 I found, I don’t konw how to use pyro SDK in cocos2d-x. the pyro particle support OpenGL API。
Not right no matter how I set the matrix。 I hope someone can help me.
this is the pyro Official Website。 It is a very good particle editor.
http://pyro.fenomen-games.com/
please help me!
please help me! somebody…
@liuyiguo0727 @126.com hi,can you tell me how to use the IPyroFileIO class because it is an abstract class and i want to load particle files from allocated memory buffer which stroages my particle file binary data,could you tell me how i can do it with the sdk.i have tried the function LoadPyroFile(IPyroFileIO *pFile), but it did not work, because the IPyroFileIO is an abstract class.
11110
July 7, 2015, 2:36am
#6
I have the same problem!Did you solve it? please help me
11110
July 7, 2015, 3:12am
#7
This is my code:
bool HelloWorld::init()
{
if(!Layer::init())
{
return false;
}
m_fTime = 0;
PyroParticles::PyroGraphics::IDevice *pPyroGraphicsDevice = new PyroParticles::CGraphics_OGL();
auto g_pParticleLibrary = CreateParticleLibrary(PYRO_SDK_VERSION);
g_pParticleLibrary->Init(pPyroGraphicsDevice);
m_Emitters = new PyroParticles::CEmitterList();
m_PyroFile = g_pParticleLibrary->LoadPyroFile("PyroDemo.pyro");
m_PyroFile->CreateTextures();
const PyroParticles::IPyroParticleEmitter *pEmitter = m_PyroFile->GetFileEmitter(0);
const char *pEmitterName = pEmitter->GetName();
m_Emitters->Append(m_PyroFile, pEmitterName, m_fTime, 300, 300);
scheduleUpdate();
}
void HelloWorld::update(float delta)
{
float PrevTime = m_fTime;
m_fTime += delta;
float TimeDelta = m_fTime - PrevTime;
float CurTime = PrevTime;
while (TimeDelta > 0.0f)
{
float SafeTimeDelta = (TimeDelta >= 0.02f) ? 0.02f : TimeDelta;
m_Emitters->Move(CurTime, SafeTimeDelta);
m_Emitters->Prepare(CurTime, SafeTimeDelta);
CurTime += SafeTimeDelta;
TimeDelta -= SafeTimeDelta;
}
}
void HelloWorld::draw(Renderer *renderer, const Mat4& transform, uint32_t flags)
{
_customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(HelloWorld::onDraw, this, transform, flags);
renderer->addCommand(&_customCommand);
}
void HelloWorld::onDraw(const Mat4 &transform, uint32_t flags)
{
Director* director = Director::getInstance();
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
m_Emitters->Render(m_fTime);
m_Emitters->RemoveInactive(m_fTime, 0.1f);
}
But it doesn’t work!Can somebody help me?