-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblack.h
62 lines (45 loc) · 1.7 KB
/
black.h
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
#include <gtk/gtk.h>
#define CARDS 52
#define MAX_CARDS_HAND 7
enum players {CPU,PLY};
struct player_data {
unsigned int card_value;
unsigned int total; /* total points */
unsigned int hand; /* card box index */
unsigned int aces; /* number of aces */
GtkWidget *cards[MAX_CARDS_HAND];
};
struct black {
GtkWidget *hbox_dealer, *hbox_player, *hbox_buttons, *hbox_chips, *hbox_endGame, *label_msg,
*label_credit, *label_bet, *label_endGame, *button_start, *button_hit,
*button_stand, *button_playAgain;
int credit;
int bet;
unsigned int cards_dealt;
const char *covered_card;
struct player_data player[2];
_Bool check_stand;
};
struct card {
const char *file;
unsigned int value;
};
void create_window(void);
void destroy (GtkWidget *window G_GNUC_UNUSED, gpointer data G_GNUC_UNUSED);
void activate_about(void);
void buttonAdd (GObject *button, struct black *table);
void updatelabel_bet(struct black *table);
void updatelabel_credit(struct black *table);
void reset (GObject *button, struct black *table);
void init_game(GtkWidget *button G_GNUC_UNUSED, struct black *table);
void shuffle (struct card *xdeck);
void swap (struct card *a, struct card *b);
void assignPoints(struct player_data *player);
void button_hit_clicked(GtkWidget *widget G_GNUC_UNUSED, struct black *table);
void button_stand_clicked(GtkWidget *widget G_GNUC_UNUSED, struct black *table);
void findWinner (struct black *table);
void endHand(gchar *display, struct black *table);
void new_game (GtkWidget *window G_GNUC_UNUSED, struct black *table);
void updateLabelCredit(struct black *table);
gboolean dealer_reply (struct black *table);
void getCard(struct black *table, enum players id);