SetLoopMode
This function determines if the particle system will play once or loop.
Syntax
- void SetLoopMode(bool Loop)
Parameters
- Loop: if true, the particle system will loop. When false, the particle system will only play for one duration.
Example
#include "Leadwerks.h"
using namespace Leadwerks;
int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
camera->Move(0, 0, -3);
int interval = 1000;
//Create an emitter
Emitter* emitter = Emitter::Create(10);
emitter->SetLoopMode(false);
while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
Leadwerks::Leadwerks::Time::Update();
world->Update();
world->Render();
context->SetBlendMode(Blend::Alpha);
if (emitter->GetLoopMode())
{
context->DrawText("Particles will loop.", 2, 2);
}
else
{
context->DrawText("Particles will not loop.", 2, 2);
}
context->SetBlendMode(Blend::Solid);
context->Sync();
}
}