#include "particles.h" #include #include #include #include extern bopti_image_t img_fill_circ_0; extern bopti_image_t img_fill_circ_1; extern bopti_image_t img_fill_circ_2; extern bopti_image_t img_fill_circ_3; extern bopti_image_t img_fill_circ_4; extern bopti_image_t img_fill_circ_5; Particle::Particle( uint16_t lx, uint16_t ly ) { x = lx; y = ly; sx = (float) (((rand() % 11)-5)/2.0f); sy = (float) (((rand() % 11)-5)/2.0f); age = rand() % 10; maxage = 15 + rand() % 20; size = 1+ rand() % 7; } Particle::~Particle() { } void Particle::Update( ) { x = (uint16_t) ((float) x + sx); y = (uint16_t) ((float) y + sy); age += 1; sx *= 0.9; sy *= 0.9; } void Particle::Render( ) { uint8_t dximg = (size-1)*15; if (age>25) azrp_subimage( x-7, y-7, &img_fill_circ_5, dximg, 0, 15, 15, DIMAGE_NONE ); else if (age>20) azrp_subimage( x-7, y-7, &img_fill_circ_4, dximg, 0, 15, 15, DIMAGE_NONE ); else if (age>15) azrp_subimage( x-7, y-7, &img_fill_circ_3, dximg, 0, 15, 15, DIMAGE_NONE ); else if (age>10) azrp_subimage( x-7, y-7, &img_fill_circ_2, dximg, 0, 15, 15, DIMAGE_NONE ); else if (age>5) azrp_subimage( x-7, y-7, &img_fill_circ_1, dximg, 0, 15, 15, DIMAGE_NONE ); else azrp_subimage( x-7, y-7, &img_fill_circ_0, dximg, 0, 15, 15, DIMAGE_NONE ); //azrp_subimage( x-7, y-7, &img_fill_circ, dximg, 0, 15, 15, DIMAGE_DYE, color ); }