Deux Ex Machina

This commit is contained in:
Bram Verhulst
2024-06-09 23:23:55 +02:00
parent 5f1dcd5788
commit caabb12838
17 changed files with 151 additions and 77 deletions

View File

@@ -12,6 +12,7 @@ SellScreen::SellScreen(const std::string& filePath, Vector2f pos, Vector2f size,
const Vector2f ScreenCenter = Vector2f { utils::GetViewport().x / 2, utils::GetViewport().y / 2 };
const Vector2f sellScreenCenter = ScreenCenter - sellScreenSize / 2;
m_BuySound = new SoundEffect { "sound/buy.wav" };
const Vector2f closeButtonOffset = Vector2f { 460, 396 - 14 };
Vector2f closeButtonPos = sellScreenCenter + closeButtonOffset;
@@ -36,6 +37,7 @@ SellScreen::SellScreen(const std::string& filePath, Vector2f pos, Vector2f size,
sellAllButton->SetOnClick([this]()
{
this->SellAll();
m_BuySound->Play(0);
});
this->AddElement(sellAllButton);
@@ -48,6 +50,7 @@ SellScreen::~SellScreen() {
for (SellSreenRow* row : m_Rows) {
delete row;
}
delete m_BuySound;
}
void SellScreen::Draw() const {
Screen::Draw();

View File

@@ -3,6 +3,8 @@
#include "../../Screen.h"
#include "Gui/GuiText.h"
class SoundEffect;
class SellScreen final : public Screen {
public:
SellScreen(const std::string& filePath, Vector2f pos, Vector2f size, TextureManager* manager);
@@ -20,4 +22,7 @@ private:
std::vector<SellSreenRow *> m_Rows;
bool m_AreRowsDirty { true };
SoundEffect* m_BuySound { nullptr };
};

View File

@@ -26,8 +26,8 @@ void SellSreenRow::Draw() const {
Vector2f amountPos { namePos.x + 100, m_Pos.y + 8 };
m_CalculationText->Draw(amountPos);
utils::SetColor(Colors::GREEN);
utils::DrawRect(Rectf { m_Pos, m_Size });
// utils::SetColor(Colors::GREEN);
// utils::DrawRect(Rectf { m_Pos, m_Size });
}
void SellSreenRow::Update(float elapsedSecs) {
// m_NameText->ChangeText("EXAMPLE");