SDL2 Animation loading


#1

Hey guys i just invented a little code snippet and wanted to ask if it works in practice.
Every answer is very appreciated ;).

Player.cpp:

void Player::LoadAnimation(char*animationFrames[], SDL_Renderer *renderer, int count, int index) {
for (int i = 0; i < count; i++) {
SDL_Surface *surf_temp = LoadSurfaceFromImage(animationFrames[i],“PNG”);
SDL_Texture *tex_temp = SDL_CreateTextureFromSurface(renderer, surf_temp);
AnimationFrames.push_back(tex_temp);
}
PlayerAnimations.at(index) = AnimationFrames;
AnimationFrames.clear();
}

Player.h:

class Player{
public:
Player(SDL_Rect bounds);//bounds either in SDL_Rect or in ints
Player(int x, int y, int w, int h);
void Player::LoadAnimation(charanimationFrames[], SDL_Renderer renderer, int count, int index);//parameters: animationFrames: names of the files of one animation
//renderer: the renderer object for the launcher, count: how many frames the animation has, index: the index of the animation in the array
private:
std::array <std::vector<SDL_Texture
>,10>PlayerAnimations;
std::vector<SDL_Texture
>AnimationFrames;