Final Commit

This commit is contained in:
Bram Verhulst
2024-06-09 23:32:29 +02:00
parent caabb12838
commit 81746db9ae
36 changed files with 112 additions and 59426 deletions

View File

@@ -17,6 +17,7 @@ void GuiButton::Draw() const {
Rectf src = Rectf(0, 0, m_Texture->GetWidth(), m_Texture->GetHeight());
if (m_IsHovered || !m_shouldHide) {
m_Texture->Draw(dest, src, false);
}
}
void GuiButton::Update(float elapsedSec) {

View File

@@ -91,7 +91,7 @@ FuelScreen::FuelScreen(const std::string& filePath, Vector2f pos, Vector2f size,
if (GameManager::GetInstance().GetFuel() < GameManager::GetInstance().GetMaxFuel() - 2) {
int fuelNeeded = static_cast<int>(GameManager::GetInstance().GetMaxFuel() - GameManager::GetInstance().GetFuel());
if (fuelNeeded <= GameManager::GetInstance().GetMoney()) {
GameManager::GetInstance().AddFuel(fuelNeeded);
GameManager::GetInstance().AddFuel((float)fuelNeeded);
GameManager::GetInstance().IncreaseMoney(-fuelNeeded);
m_BuySound->Play(0);
}
@@ -118,13 +118,13 @@ FuelScreen::~FuelScreen() {
void FuelScreen::Draw() const {
int currentFuel = GameManager::GetInstance().GetFuel();
int currentFuel = (int) GameManager::GetInstance().GetFuel();
int maxFuel = GameManager::GetInstance().GetMaxFuel();
utils::SetColor(Color4f { 99.f / 255.f, 82.f / 255.f, 36.f / 255.f, 1.f });
Vector2f fuelBarPos = Vector2f { 275, 135 };
const int MAX_HEIGHT = 210;
Vector2f fuelBarSize = Vector2f { 40, utils::map(currentFuel, 0, maxFuel, 0, MAX_HEIGHT) };
Vector2f fuelBarSize = Vector2f { 40, utils::map(currentFuel, 0.f, maxFuel, 0.f, MAX_HEIGHT) };
utils::FillRect(Rectf { fuelBarPos, fuelBarSize });
Screen::Draw();