31 animation.current_time += dt;
33 if (animation.current_time >= animation.frame_duration)
35 animation.current_time = 0.0f;
36 animation.current_frame = (animation.current_frame + 1) % animation.total_frames;
44 int frame_x = (animation.current_frame % animation.frames_per_row) * animation.frame_width;
45 int frame_y = (animation.current_frame / animation.frames_per_row) * animation.frame_height;
46 if (rect->pos_x !=
static_cast<float>(frame_x) || rect->pos_y !=
static_cast<float>(frame_y))
48 rect->pos_x =
static_cast<float>(frame_x);
49 rect->pos_y =
static_cast<float>(frame_y);
50 rect->size_x = animation.frame_width;
51 rect->size_y = animation.frame_height;