So, I have this Game
class, and I have an array of SDL_Rect
s. I would like to initialize it in the member initializer list if that's possible, instead of initializing the array inside the constructor body.
//Game.h
#pragma once
class Game {
public:
Game(SDL_Window* window, SDL_Renderer* renderer);
private:
SDL_Rect down[4];
};
// Game.cpp
#include "Game.h"
Game::Game(SDL_Window* window, SDL_Renderer* renderer){
down[0] = {1,4,31,48};
down[1] = {35,5,25,47};
down[2] = {65,4,31,48};
down[3] = {100,5,26,47};
}
I would like to do something like this:
// Game.cpp
Game::Game()
: down[0]({1,4,31,48};
// etc, etc...
{}