-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimation.h
More file actions
69 lines (60 loc) · 1.37 KB
/
Animation.h
File metadata and controls
69 lines (60 loc) · 1.37 KB
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
/**
* @file Animation.h
*
* Defintion for a class that encapsulates creating animated images from a
* set of PNG object frames.
*
* @author Wade Fagen-Ulmschneider
* @date Fall 2017
*
* @author Jack Toole
* @date Fall 2011
*/
#pragma once
#include <string>
#include <vector>
#include "cs225/PNG.h"
using namespace std;
using namespace cs225;
/**
* Animation class---used to create animated images from a sequence of PNG
* objects as frames of the animation.
*
* @author Wade Fagen-Ulmschneider
* @date Fall 2017
*
* @author Jack Toole
* @date Fall 2011
*/
class Animation
{
public:
/**
* Adds a frame to the animation.
*
* @param img The image to be added.
*/
void addFrame(const PNG& img);
/**
* Writes the animation to the file name specified.
*
* @param filename The name of the file to be written to.
*/
void write(const std::string& filename);
/**
* Returns a frame at a specific index.
*
* @param index The zero-based index frame to return
*/
PNG getFrame(unsigned index);
/**
* Returns the number of frames currently in the animation.
*/
unsigned frameCount();
private:
std::vector<PNG> frames;
template <typename T>
string to_string(const T& value);
string getString(int i, int padToSameLengthAs);
bool exists(const string& path);
};