#include "pch.h"
#include "FuelScreen.h"

#include "ScreenManager.h"
#include "utils.h"
FuelScreen::FuelScreen(const std::string& filePath, Vector2f pos, Vector2f size, TextureManager* manager): Screen(filePath, pos, size, manager)
{
	const Vector2f fuelScreenSize = Vector2f { 492, 396 };
	// Vector2f fuelScreenCenter = Vector2f { utils::GetViewport().x / 2 - fuelScreenSize.x / 2, utils::GetViewport().y / 2 - fuelScreenSize.y / 2 };
	const Vector2f ScreenCenter = Vector2f { utils::GetViewport().x / 2, utils::GetViewport().y / 2 };

	const Vector2f fuelScreenCenter = ScreenCenter - fuelScreenSize / 2;

	
	const Vector2f closeButtonOffset = Vector2f { 460, 396 - 14 };
	Vector2f closeButtonPos = fuelScreenCenter + closeButtonOffset;
	closeButtonPos.y -= 18;
	Button* closeFuelButton = new Button { "gui/close.png", closeButtonPos, Vector2f{0,0}, TextureManager::GetInstance() };
	closeFuelButton->SetOnClick([this]() { ScreenManager::GetInstance()->CloseScreen(); });
	this->AddButton(closeFuelButton);

	const Vector2f oneDollarButtonPos = Vector2f { 451, 287 };
	Button* fiveDollarButton = new Button { "gui/fuel/5dollars.png", oneDollarButtonPos	, Vector2f{0,0}, TextureManager::GetInstance() };
	this->AddButton(fiveDollarButton);

	const Vector2f tenDollarButtonPos = oneDollarButtonPos + Vector2f { 113, -1 };
	Button* tenDollarButton = new Button { "gui/fuel/10dollars.png", tenDollarButtonPos, Vector2f{0,0}, TextureManager::GetInstance() };
	this->AddButton(tenDollarButton);

	const Vector2f twentyFiveDollarButtonPos = oneDollarButtonPos + Vector2f { 0, -89 };
	Button* twentyFiveDollarButton = new Button { "gui/fuel/25dollars.png", twentyFiveDollarButtonPos, Vector2f{0,0}, TextureManager::GetInstance() };
	this->AddButton(twentyFiveDollarButton);

	const Vector2f fiftyDollarButtonPos = twentyFiveDollarButtonPos + Vector2f { 114, 0 };
	Button* fiftyDollarButton = new Button { "gui/fuel/50dollars.png", fiftyDollarButtonPos, Vector2f{0,0}, TextureManager::GetInstance() };
	this->AddButton(fiftyDollarButton);

	const Vector2f fillTankButtonPos = Vector2f { 450, 108 };
	Button* fillTankButton = new Button { "gui/fuel/fillTank.png", fillTankButtonPos, Vector2f{0,0}, TextureManager::GetInstance() };
	this->AddButton(fillTankButton);
	
}
void FuelScreen::Draw() const {
	Screen::Draw();
}
void FuelScreen::Update(float elapsedSecs) {
	Screen::Update(elapsedSecs);
}
