SetInterval

This function sets the time interval, in milliseconds, in which particles will be released.

Syntax

Parameters

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(1000);
emitter->SetEmissionVolume(0, 0, 0);
emitter->SetInterval(interval);

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;

Leadwerks::Leadwerks::Time::Update();
world->Update();
world->Render();

if (window->KeyDown(Key::Up))
{
interval += 1000;
emitter->SetInterval(interval);
}
else if (window->KeyDown(Key::Down) && interval > 0)
{
interval -= 1000;
emitter->SetInterval(interval);
}

context->SetBlendMode(Blend::Alpha);
context->DrawText("Interval: " + String(emitter->GetInterval() / 1000) + " seconds.", 2, 2);
context->SetBlendMode(Blend::Solid);

context->Sync();
}
}