blob: 8974ba3f90b47dd2a3b06730faff1b316fad4677 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include "AnimationRender.h"
#include "FrameCallback.h"
void RenderAnimation(u32 width, u32 height, u32 totalFrames, const FrameCallback** callbacks, usize sizeCallbacks) {
RGBImage frameBuffer = RGBImage_new(width, height);
struct FrameContext fc;
fc.startFrame = 0;
fc.endFrame = totalFrames;
fc.frameBuffer = frameBuffer;
for (u32 f = 0; f < totalFrames; ++f) {
fc.frame = f;
for (usize i = 0; i < sizeCallbacks; ++i) {
// Soft context reset
if (callbacks[i] == NULL) {
fc.startFrame = 0;
fc.endFrame = totalFrames;
}
else
callbacks[i]->callback(callbacks[i]->callback_self, &fc);
}
}
RGBImage_delete(&frameBuffer);
}
|