First of all, I am very new to C ++, so I may have to plunge into pseudocode and / or Python to explain what I'm trying to do ...
I am trying to save pairs of X and Y coordinates for each frame of the animation, for multiple sprites. I assumed that it was something like the following: suppose PLAIN == 1 (using an enumeration):
animationFrames[PLAIN][0] = { 20, 50 }
animationFrames[PLAIN][1] = { 25, 55 }
Et cetera. In fact, I would like to be able to request animated frames with a sprite identifier and get a set of X, Y coordinates for iteration. I find it rather complicated. Here is my attempt, which does not work ...
std::vector< std::vector< std::pair<int, int> > > frames = {
{
{ 1, 1 }, { 2, 2 }
},
{
{ 3, 3 }, { 4, 4 }
}
};
As a result, you receive the following error message:
prog.cpp: In function 'int main()':
prog.cpp:15: error: braces around initializer for non-aggregate type 'std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >'
I have tried various mutations of vectors, pairs and arrays, but I cannot figure it out.
Thanks in advance!