Presumably, either Pad
or Ball
(or both) has no default constructor; therefore one can't be generated for a class that contains them. They must be initialised using one of their declared constructors.
The best solution is to remove your weird init
function, and replace it with a constructor:
ArkanoidGame(int windowWidth, int windowHeight) :
running(true),
window(new ...),
Pad(windowWidth / 2, windowHeight - 50),
Ball(0,0)
{
window->setFramerateLimit(60);
}
int main() {
ArkanoidGame game(800, 600);
// ...
}
If you really want a two-stage initialisation dance for some reason, then you'll need to provide default constructors for both Pad
and Ball
. I wouldn't recommend that though; there's less scope for errors if an object can't be created in an invalid state.