Fix some spacing and some layout
This commit is contained in:
parent
417544321c
commit
9701cc9e61
16
card.c
16
card.c
@ -45,16 +45,26 @@ void shuffle_hand(Hand *h) {
|
||||
}
|
||||
|
||||
void add_to_hand(Hand *h, Card *c) {
|
||||
h->cards[h->count++] = c;
|
||||
h->cards[h->count] = c;
|
||||
|
||||
c->move.position = &c->position;
|
||||
c->move.origin.x = c->position.x;
|
||||
c->move.origin.y = c->position.y;
|
||||
c->move.destination.x = h->position.x + (h->count * (CARD_WIDTH + 10));
|
||||
c->move.destination.y = h->position.y;
|
||||
switch (h->display_type) {
|
||||
case HAND_DISPLAY_ROW:
|
||||
c->move.destination.x = h->position.x + (h->count * (CARD_WIDTH + 10));
|
||||
c->move.destination.y = h->position.y;
|
||||
break;
|
||||
case HAND_DISPLAY_FIELD:
|
||||
c->move.destination.x = h->position.x + ((h->count / 2) * (CARD_WIDTH + 10));
|
||||
c->move.destination.y = h->position.y + (h->count % 2 * (CARD_HEIGHT + 10));
|
||||
break;
|
||||
}
|
||||
c->move.curve = CURVE_EASE_IN_OUT;
|
||||
c->move.current_time = 0.;
|
||||
c->move.end_time = 0.5;
|
||||
|
||||
h->count++;
|
||||
}
|
||||
|
||||
bool card_done_moving(Card *c) {
|
||||
|
6
card.h
6
card.h
@ -58,10 +58,16 @@ struct Card {
|
||||
Move move;
|
||||
};
|
||||
|
||||
typedef enum HandDisplayType {
|
||||
HAND_DISPLAY_ROW,
|
||||
HAND_DISPLAY_FIELD,
|
||||
} HandDisplayType;
|
||||
|
||||
struct Hand {
|
||||
Card *cards[48];
|
||||
int count;
|
||||
Vector2 position;
|
||||
HandDisplayType display_type;
|
||||
};
|
||||
|
||||
void draw_card(Card *c, Texture2D *cards_texture);
|
||||
|
22
game.c
22
game.c
@ -56,7 +56,7 @@ void initialize_game(Game *g) {
|
||||
g->cards[i] = (Card) { i, t, rt, month, { 800, 100 }, false, false };
|
||||
g->cards[i].move.end_time = 0.;
|
||||
g->cards[i].move.position = &g->cards[i].position;
|
||||
g->cards[i].move.destination = (Vector2) { 800, 200 };
|
||||
g->cards[i].move.destination = (Vector2) { 800, 300 };
|
||||
g->deck.cards[i] = &g->cards[i];
|
||||
g->deck.count++;
|
||||
}
|
||||
@ -64,13 +64,17 @@ void initialize_game(Game *g) {
|
||||
shuffle_hand(&g->deck);
|
||||
|
||||
g->player_hand.count = 0;
|
||||
g->player_hand.position = (Vector2) { 20, 475 };
|
||||
g->player_hand.position = (Vector2) { 300, 550 };
|
||||
g->player_hand.display_type = HAND_DISPLAY_ROW;
|
||||
g->right_hand.count = 0;
|
||||
g->right_hand.position = (Vector2) { 20, 100 };
|
||||
g->right_hand.display_type = HAND_DISPLAY_ROW;
|
||||
g->left_hand.count = 0;
|
||||
g->left_hand.position = (Vector2) { 20, 225 };
|
||||
g->left_hand.position = (Vector2) { 600, 100 };
|
||||
g->left_hand.display_type = HAND_DISPLAY_ROW;
|
||||
g->field.count = 0;
|
||||
g->field.position = (Vector2) { 20, 350 };
|
||||
g->field.position = (Vector2) { 400, 250 };
|
||||
g->field.display_type = HAND_DISPLAY_FIELD;
|
||||
|
||||
strcpy(teyaku_calculation, "");
|
||||
|
||||
@ -119,18 +123,18 @@ void run_calculation(Game *g) {
|
||||
void run_frame_dealing(Game *g) {
|
||||
if (g->player_hand.count < 4) {
|
||||
deal(&g->deck, &g->player_hand, 4, true);
|
||||
} else if (g->right_hand.count < 4) {
|
||||
deal(&g->deck, &g->right_hand, 4, false);
|
||||
} else if (g->left_hand.count < 4) {
|
||||
deal(&g->deck, &g->left_hand, 4, false);
|
||||
} else if (g->right_hand.count < 4) {
|
||||
deal(&g->deck, &g->right_hand, 4, false);
|
||||
} else if (g->field.count < 3) {
|
||||
deal(&g->deck, &g->field, 3, true);
|
||||
} else if (g->player_hand.count < 7) {
|
||||
deal(&g->deck, &g->player_hand, 3, true);
|
||||
} else if (g->right_hand.count < 7) {
|
||||
deal(&g->deck, &g->right_hand, 3, false);
|
||||
} else if (g->left_hand.count < 7) {
|
||||
deal(&g->deck, &g->left_hand, 3, false);
|
||||
} else if (g->right_hand.count < 7) {
|
||||
deal(&g->deck, &g->right_hand, 3, false);
|
||||
} else if (g->field.count < 6) {
|
||||
deal(&g->deck, &g->field, 3, true);
|
||||
} else {
|
||||
@ -182,7 +186,7 @@ void draw_frame(Game *g) {
|
||||
draw_card(&g->cards[i], &g->cards_texture);
|
||||
}
|
||||
|
||||
if (g->field_multiplier) DrawText(g->field_multiplier->name, 600, 385, 40, BLACK);
|
||||
if (g->field_multiplier) DrawText(g->field_multiplier->name, 60, 385, 40, BLACK);
|
||||
if (g->player_teyaku.calculated) {
|
||||
char s[200];
|
||||
teyaku_to_string(&g->player_teyaku, s);
|
||||
|
Loading…
Reference in New Issue
Block a user