natiny_render_particles

C
void natiny_render_particles(NatinyParticles particles);

Draws a particle system in 2D, in the coordinates of the current render target, over what was drawn before it.

Parameters

Name Type Description
particles NatinyParticles Particle system handle from natiny_particles_create

Example

C
NatinyParticles sparkle = natiny_particles_create(1000);
natiny_particles_set_shape(sparkle, NATINY_PARTICLES_SHAPE_CIRCLE, 16.0f, 0.0f, 0.0f);
natiny_particles_set_speed(sparkle, 40.0f, 120.0f);
natiny_particles_set_size(sparkle, 8.0f, 20.0f);
natiny_particles_set_blend(sparkle, NATINY_BLEND_ADD);

/* every frame */
natiny_entity_set_position(sparkle, NATINY_SPACE_WORLD,
                           (float)natiny_input_get_mouse_x(),
                           (float)natiny_input_get_mouse_y(), 0.0f);
natiny_window_bind(window);
natiny_render_clear(background);
natiny_render_particles(sparkle);
natiny_window_unbind();