so I've been trying for the last four hours to get this to work and although I can get to the center of the screen when printing one texture using:
TextureManager::getInstance()->drawTexture("block_brown",
SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->w / 2 - 101 / 2,
SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->h / 2 - 171 /2,
101,
171,
Game::getInstance()->getPrimaryRenderer(),
SDL_FLIP_NONE);
I get the following result:
I can keep the center of up to two textures in a row and after that it gets out of hand and I completely lose it. I'm using the following for the two:
for (int i = 0; i < 2; i++) {
for int j = 0; j < 2; i++) {
TextureManager::getInstance()->drawTexture("block_brown",
SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->w / 2 - i * 101,
SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->h / 2 - 171 / 2,
101,
171,
Game::getInstance()->getPrimaryRenderer(),
SDL_FLIP_NONE);
which produces the following result:
As you can see, it looks to be in the center of the window, but if I try to add more than two in a row or more than one in a column, I then have to start fighting it to keep it in the center.
So my question is, how would one manage to get the textures to stay central, no matter how many I add?
EDIT:
This is the final result I'm ultimately looking for:
When I start trying to add layers I then have to start fighting it again to keep it central?
This the result I'm having right now:
The more I think about this, the more I think I'm going completely the wrong way and doing it completely wrong.