void PARTICLE::update(DISPLAY& disp, bool is_draw) { // update if (data.particle_type == 3 || data.particle_type == 2) life -= 1; else if (data.type != 2) life -= data.speed; if (data.particle_type == 0 || (data.particle_type == 1 && life < starting_life/2)) { x += data.speed * cos(theta); y += data.speed * sin(theta); } // update frame frame_index += data.frame_rate; if (frame_index >= data.num_frames) { if (data.type == 0) { frame_index -= data.num_frames; } else if (data.type) { frame_index = data.num_frames-1; if (data.type == 2) life = 0; } } // update expansion (zoom type) if (data.particle_type == 1) { if (life < starting_life/2) { expansion = life / starting_life; if (!done_damage) do_damage(); if (chain_factor) chain(); } else expansion = (starting_life - life) / starting_life; } else if (data.particle_type == 2) { // update expansion (solid type) expansion = 1.0; } // draw if (is_draw && is_on_screen(disp)) draw(disp); }
void nx_display_cursor_set_pos(U8 x, U8 y) { NX_ASSERT(is_on_screen(x, y)); display.cursor.x = x; display.cursor.y = y; }