-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameForm.cpp
64 lines (60 loc) · 1.83 KB
/
GameForm.cpp
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "GameForm.h"
namespace oczko {
void GameForm::UpdateComponents()
{
UpdateStartBetButton();
UpdateStartBetLabel();
UpdateStartBetTextbox();
UpdatePlayerWalletLabel();
UpdatePlayerHandListbox();
UpdatePlayerBetsListbox();
UpdatePlayerHandsListbox();
}
void GameForm::UpdateStartBetButton()
{
if (core->GetBets()->size() > 0)
start_bet_button->Hide();
else
start_bet_button->Show();
}
void GameForm::UpdateStartBetLabel()
{
if (core->GetBets()->size() > 0)
start_bet_label->Hide();
else
start_bet_label->Show();
}
void GameForm::UpdateStartBetTextbox()
{
if (core->GetBets()->size() > 0)
start_bet_textbox->Hide();
else
start_bet_textbox->Show();
}
void GameForm::UpdatePlayerWalletLabel()
{
player_wallet_label->Text = "Wallet: " + core->GetPlayer()->GetMoney();
}
void GameForm::UpdatePlayerHandListbox()
{
player_hand_listview->Items->Clear();
if (player_hands_listbox->SelectedIndex >= 0)
for (Card::Card* card : *core->GetBets()->at(player_hands_listbox->SelectedIndex)->GetHand()->GetCards())
player_hand_listview->Items->Add(card->GetColor().ToString() + card->GetValue().ToString());
else if (player_bets_listbox->SelectedIndex >= 0)
for (Card::Card* card : *core->GetPlayer()->GetBets()->at(player_bets_listbox->SelectedIndex)->GetHand()->GetCards())
player_hand_listview->Items->Add(card->GetColor().ToString() + card->GetValue().ToString());
}
void GameForm::UpdatePlayerHandsListbox()
{
player_hands_listbox->Items->Clear();
for (unsigned int i = 0; i < core->GetBets()->size(); i++)
player_hands_listbox->Items->Add("#" + i + " Hand");
}
void GameForm::UpdatePlayerBetsListbox()
{
player_bets_listbox->Items->Clear();
for (unsigned int i = 0; i < core->GetPlayer()->GetBets()->size(); i++)
player_bets_listbox->Items->Add("#" + i + " Bet");
}
}