Skip to content

Commit

Permalink
Showing ATH
Browse files Browse the repository at this point in the history
  • Loading branch information
Brotcrunsher committed Nov 14, 2024
1 parent ad01cb5 commit b7a4eed
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Binary file added Examples/ExampleMother/Assets/NewAth.mp3
Binary file not shown.
32 changes: 32 additions & 0 deletions Examples/ExampleMother/ExampleMother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@
//TODO: Starting a reimagine chain with any arbitrary pic would be super cool - but we'd need to have a base64 encoder for that.
//TODO: Remember news items. Would be nice to hear all the news of the past week or so, not having to listen to them every day.
//TODO: Record Bitcoin history prices
//TODO: Ignore list of messages in console that are not important enough to trigger a warning.
//TODO: Shut down contingent tasks automatically when shutting off the pc

//TODO: Show average driving time
//TODO: ChatGPT Function calling
//TODO: Thickness for mouse wall would be cool


struct ClipboardContent
Expand Down Expand Up @@ -218,6 +221,13 @@ struct MouseWallConfig
float timeOnBorder = 0.0f;
};

struct BitcoinData
{
BBE_SERIALIZABLE_DATA(
((int32_t), allTimeHigh, 0)
)
};

enum class IconCategory
{
NONE,
Expand Down Expand Up @@ -257,6 +267,7 @@ class MyGame : public bbe::Game
bbe::SerializableList<NewsEntry> readNews = bbe::SerializableList<NewsEntry> ("ReadNews.dat", "ParanoiaConfig");
bbe::SerializableObject<DallEConfig> dallEConfig = bbe::SerializableObject<DallEConfig> ("DallEConfig.dat", "ParanoiaConfig");
bbe::SerializableObject<MouseWallConfig> mouseWallConfig = bbe::SerializableObject<MouseWallConfig>("MouseWallConfig.dat", "ParanoiaConfig");
bbe::SerializableObject<BitcoinData> bitcoinData = bbe::SerializableObject<BitcoinData> ("BitcoinData.dat", "ParanoiaConfig");

bbe::ChatGPTComm chatGPTComm; // ChatGPT communication object
std::future<bbe::ChatGPTQueryResponse> chatGPTFuture; // Future for async ChatGPT queries
Expand Down Expand Up @@ -310,6 +321,8 @@ class MyGame : public bbe::Game

size_t readConsoleMessages = 0;

bool silenceBitcoinAth = false;

public:
HICON createTrayIcon(DWORD offset, int redGreenBlue)
{
Expand Down Expand Up @@ -1164,6 +1177,23 @@ class MyGame : public bbe::Game
f = bbe::simpleUrlRequest::urlRequestJsonElementsAsync("https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT", &requestMutex, std::make_pair(&currentPriceBinance, "price"));
}

for (size_t i = 0; i < prices.getLength(); i++)
{
if (prices[i] > bitcoinData->allTimeHigh)
{
bitcoinData->allTimeHigh = prices[i];
bitcoinData.writeToFile();

if (!silenceBitcoinAth)
{
EVERY_MINUTES(5)
{
assetStore::NewAth()->play();
}
}
}
}

std::unique_lock _(requestMutex);
if (prices.getLength() > 0 && prices.getLength() == times.getLength())
{
Expand Down Expand Up @@ -1202,6 +1232,7 @@ class MyGame : public bbe::Game
{
dollar = 0.0f;
}
ImGui::Text("ATH: $%d", bitcoinData->allTimeHigh);
}
return bbe::Vector2(1);
}
Expand Down Expand Up @@ -2449,6 +2480,7 @@ class MyGame : public bbe::Game
serverUnreachableString += (bbe::TimePoint() - lastServerReach).toString();
}
ImGui::Checkbox(serverUnreachableString.getRaw(), &serverUnreachableSilenced);
ImGui::Checkbox("Silence Bitcoin Ath", &silenceBitcoinAth);
ImGui::Checkbox("Show Debug Stuff", &showDebugStuff);

ImGui::Checkbox("Overwrite Monitor Brightness", &monitorBrightnessOverwrite);
Expand Down

0 comments on commit b7a4eed

Please sign in to comment.