/
animator.hpp
58 lines (44 loc) · 971 Bytes
/
animator.hpp
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef _ANIMATOR_HPP_
#define _ANIMATOR_HPP_
#include <iostream>
#include <fstream>
#include <string>
#include "world.hpp"
#include "frame.hpp"
#define RECORDFILE "keyframes.txt"
enum {NONE,RECORD,PLAY};
class Animator {
std::string recordFile;
public:
int screenWidth,screenHeight;
int mode;
World WORLD;
Frame nextFrame;
int frameNo;
int nFrames;
int defaultNFrames;
unsigned char *pRGB;
bool capture;
Animator(int w,int h) {
screenWidth = w;
screenHeight = h;
recordFile = RECORDFILE;
WORLD=World();
nextFrame=Frame();
mode = NONE;
nFrames = 0;
defaultNFrames = 5;
frameNo = 0;
capture = false;
}
void renderFrame();
void resetFile();
void record();
Frame read(ifstream &file);
void play();
void draw();
Frame interpolate(Frame &next,Frame &prev,int progress);
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
void capture_frame(unsigned int framenum);
};
#endif