mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 04:41:47 +01:00
52 lines
2.4 KiB
C++
52 lines
2.4 KiB
C++
#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;
|
|
GuiButton* closeFuelButton = new GuiButton { "gui/close.png", closeButtonPos, Vector2f{0,0}, TextureManager::GetInstance() };
|
|
closeFuelButton->SetOnClick([this]() { ScreenManager::GetInstance()->CloseScreen(); });
|
|
this->AddElement(closeFuelButton);
|
|
|
|
const Vector2f oneDollarButtonPos = Vector2f { 451, 287 };
|
|
GuiButton* fiveDollarButton = new GuiButton { "gui/fuel/5dollars.png", oneDollarButtonPos , Vector2f{0,0}, TextureManager::GetInstance() };
|
|
this->AddElement(fiveDollarButton);
|
|
|
|
const Vector2f tenDollarButtonPos = oneDollarButtonPos + Vector2f { 113, -1 };
|
|
GuiButton* tenDollarButton = new GuiButton { "gui/fuel/10dollars.png", tenDollarButtonPos, Vector2f{0,0}, TextureManager::GetInstance() };
|
|
this->AddElement(tenDollarButton);
|
|
|
|
const Vector2f twentyFiveDollarButtonPos = oneDollarButtonPos + Vector2f { 0, -89 };
|
|
GuiButton* twentyFiveDollarButton = new GuiButton { "gui/fuel/25dollars.png", twentyFiveDollarButtonPos, Vector2f{0,0}, TextureManager::GetInstance() };
|
|
this->AddElement(twentyFiveDollarButton);
|
|
|
|
const Vector2f fiftyDollarButtonPos = twentyFiveDollarButtonPos + Vector2f { 114, 0 };
|
|
GuiButton* fiftyDollarButton = new GuiButton { "gui/fuel/50dollars.png", fiftyDollarButtonPos, Vector2f{0,0}, TextureManager::GetInstance() };
|
|
this->AddElement(fiftyDollarButton);
|
|
|
|
const Vector2f fillTankButtonPos = Vector2f { 450, 108 };
|
|
GuiButton* fillTankButton = new GuiButton { "gui/fuel/fillTank.png", fillTankButtonPos, Vector2f{0,0}, TextureManager::GetInstance() };
|
|
this->AddElement(fillTankButton);
|
|
|
|
}
|
|
|
|
FuelScreen::~FuelScreen() = default;
|
|
|
|
void FuelScreen::Draw() const {
|
|
Screen::Draw();
|
|
}
|
|
void FuelScreen::Update(float elapsedSecs) {
|
|
Screen::Update(elapsedSecs);
|
|
}
|