-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·33 lines (29 loc) · 906 Bytes
/
Copy pathmain.cpp
File metadata and controls
executable file
·33 lines (29 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// (c) 2022 Pttn (https://riecoin.dev/en/rieWallet)
#include <thread>
#include "Wallet.hpp"
#include "Gui/Fltk.hpp"
void walletThread(const std::shared_ptr<WalletWindow> &window) {
auto nextUpdateTp(std::chrono::steady_clock::now());
while (true) {
if (std::chrono::steady_clock::now() >= nextUpdateTp) {
Fl::lock();
window->updateBalance();
window->updateWorth();
Fl::unlock();
Fl::awake();
nextUpdateTp = std::chrono::steady_clock::now() + std::chrono::seconds(30);
}
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
}
int main() {
Wallet wallet;
Fl::background(32U, 32U, 32U);
Fl::foreground(224U, 224U, 224U);
std::shared_ptr<WalletWindow> window(std::make_shared<WalletWindow>(640, 480, "rieWallet", std::make_shared<Wallet>(wallet)));
Fl::lock();
window->show();
std::thread thread(walletThread, window);
thread.detach();
return(Fl::run());
}