-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathanimation.h
83 lines (63 loc) · 1.46 KB
/
animation.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef ANIMATION_H
#define ANIMATION_H
#include <vector>
#include <array>
#include <stdio.h>
#include "blob.h"
#include "food.h"
#include "simulationResults.h"
#include "olcPixelGameEngine.h"
class Animation : public olc::PixelGameEngine
{
public:
enum ColourStat
{
SIZE = 2,
SPEED = 3,
SENSE = 4
};
enum TriLabel
{
MEAN = -1,
MAX = +2,
MIN = +5
};
private:
int m_blackBorder;
int m_screenCount;
int m_homeCount;
int m_gridCount;
int m_cellSize;
int m_day;
int m_frame;
double m_scaleRange;
double m_colourBarMax;
bool m_paused;
ColourStat m_colourStat;
simulationResults m_stats;
std::vector<std::vector<Food>> m_eachFoodPositions;
std::vector<std::vector<std::vector<std::array<double, 6>>>> m_dailyBlobFrames;
std::vector<std::array<double, 10>> m_avgBlobStats;
FILE* m_ffmpeg;
int* m_buffer;
int m_xRes;
int m_yRes;
std::string m_vidName;
public:
Animation();
Animation(int cellCount, simulationResults &stats,
std::string vidName, ColourStat stat );
bool colourStatValid();
std::string getColourStatStr();
std::string getDefaultFilename();
void scaleStats(double scaleRange);
void Animation::drawTriLabel(int x2, int yZero, int textScale, TriLabel label);
void drawColourBar();
void drawBlob(int x, int y, double scaledStat);
void drawFood(int x, int y);
void openPipe(FILE* &m_ffmpeg);
void closePipe(FILE* &m_ffmpeg);
bool OnUserCreate() override;
bool OnUserUpdate(float fElapsedTime) override;
};
#endif