GetParticleColor

This function gets the particle's initial or final color.

Syntax

Parameters

Returns

This function returns a vector 4 containing the color values: red, green, blue, alpha.

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);

//Create an emitter
Emitter* emitter = Emitter::Create(50);
emitter->SetParticleColor(1, 0, 0, 1, 0); //inital color: red
emitter->SetParticleColor(0, 1, 0, 1, 1); //final color: green

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

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

context->SetBlendMode(Blend::Alpha);
context->DrawText("Initial Color: " + (emitter->GetParticleColor(0)).ToString(), 2, 2);
context->DrawText("Final Color: " + (emitter->GetParticleColor(1)).ToString(), 2, 22);
context->SetBlendMode(Blend::Solid);

context->Sync();
}
}