Final Commit
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user