I didn't wanted to have to add another include in all my files in order to use that, since I already had my Utility.h included I put my class inside of that. There is a way to add the std::pair to my Utility.h so that all files including it get to use std::pair without including anything else?
Quote
A size is a conceptually richer concept, which includes a different set of operations and relationships than the more-generic "pair" concept
I don't fully understand this, I basically just needed to pass around width and height so that I can spawn my Entities like so(code below:
EDIT: by the way, why the code below is being pasted in this crazy way?! Maybe a problem in how the tab character is interpreted?
It should appear like this --> https://pastebin.com/iddWWWfH
GameMode::GameMode(SDL_Window* Window, SDL_Renderer* Renderer, App* App)
:Window{ Window }, Renderer{ Renderer }, AppRef{ App }, Running{ true }
{
float WindowWidth = static_cast<float>(AppRef->GetWindowSize().First);
float WindowHeight = static_cast<float>(AppRef->GetWindowSize().Second);
//PhysicsManager
PhysicsManager = std::make_unique<Physics>(this);
//Create Player
Entities.push_back(std::make_unique<Paddle>(this,
static_cast<int>(WindowWidth) / 2,
static_cast<int>(WindowHeight) - 40,
PivotMode::CENTER));
//Boundaries
//Right
Entities.push_back(std::make_unique<Boundary>(this,
Rect{ WindowWidth - 5.f, 0.f,
50.f, WindowHeight },
PivotMode::CENTER));
//Left
Entities.push_back(std::make_unique<Boundary>(this,
Rect{ -45.f, 0.f,
50.f, WindowHeight },
PivotMode::CENTER));
//Top
Entities.push_back(std::make_unique<Boundary>(this,
Rect{ 6.f, -45.f,
WindowWidth - 12.f, 50.f },
PivotMode::CENTER));
//Bottom
Entities.push_back(std::make_unique<Boundary>(this,
Rect{ 6.f, WindowHeight - 5.f,
WindowWidth - 12.f, 50.f },
PivotMode::CENTER));
//Create Ball
Entities.push_back(std::make_unique<Ball>(this,
static_cast<int>(WindowWidth) / 2,
200,
PivotMode::CENTER));
}