2025-02-01 05:36:42 -05:00
|
|
|
#ifndef _HF_CARD_
|
|
|
|
#define _HF_CARD_
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <raylib.h>
|
|
|
|
|
2025-02-03 20:07:22 -05:00
|
|
|
#include "move.h"
|
|
|
|
|
2025-02-01 05:36:42 -05:00
|
|
|
typedef struct Card Card;
|
2025-02-01 06:40:33 -05:00
|
|
|
typedef struct Hand Hand;
|
2025-02-02 10:21:49 -05:00
|
|
|
#define CARD_WIDTH 73
|
|
|
|
#define CARD_HEIGHT 120
|
2025-02-01 07:33:52 -05:00
|
|
|
#define CARD_BORDER 5
|
2025-02-01 05:36:42 -05:00
|
|
|
|
2025-02-04 18:47:56 -05:00
|
|
|
#define CRANE_INDEX 0
|
|
|
|
#define CURTAIN_INDEX 8
|
|
|
|
#define MOON_INDEX 28
|
|
|
|
#define RAINY_MAN_INDEX 40
|
|
|
|
#define PHOENIX_INDEX 44
|
|
|
|
|
2025-02-01 05:36:42 -05:00
|
|
|
typedef enum CardType {
|
|
|
|
CHAFF,
|
|
|
|
RIBBON,
|
|
|
|
ANIMAL,
|
|
|
|
BRIGHT,
|
|
|
|
} CardType;
|
|
|
|
|
|
|
|
typedef enum RibbonType {
|
|
|
|
RIBBON_NONE,
|
|
|
|
RIBBON_PLAIN,
|
|
|
|
RIBBON_BLUE,
|
|
|
|
RIBBON_POETRY,
|
|
|
|
} RibbonType;
|
|
|
|
|
2025-02-01 06:40:33 -05:00
|
|
|
typedef enum Month {
|
|
|
|
JANUARY,
|
|
|
|
FEBRUARY,
|
|
|
|
MARCH,
|
|
|
|
APRIL,
|
|
|
|
MAY,
|
|
|
|
JUNE,
|
|
|
|
JULY,
|
|
|
|
AUGUST,
|
|
|
|
SEPTEMBER,
|
|
|
|
OCTOBER,
|
|
|
|
NOVEMBER,
|
|
|
|
DECEMBER
|
|
|
|
} Month;
|
|
|
|
|
2025-02-01 05:36:42 -05:00
|
|
|
struct Card {
|
|
|
|
int index;
|
|
|
|
CardType type;
|
|
|
|
RibbonType ribbon_type;
|
2025-02-01 06:40:33 -05:00
|
|
|
Month month;
|
2025-02-01 05:36:42 -05:00
|
|
|
Vector2 position;
|
2025-02-01 07:51:53 -05:00
|
|
|
bool selected;
|
2025-02-02 19:07:49 -05:00
|
|
|
bool visible;
|
2025-02-03 20:07:22 -05:00
|
|
|
Move move;
|
2025-02-12 16:45:31 -05:00
|
|
|
int order;
|
2025-02-01 05:36:42 -05:00
|
|
|
};
|
|
|
|
|
2025-02-05 21:19:05 -05:00
|
|
|
typedef enum HandDisplayType {
|
|
|
|
HAND_DISPLAY_ROW,
|
|
|
|
HAND_DISPLAY_FIELD,
|
2025-02-10 17:27:02 -05:00
|
|
|
HAND_DISPLAY_DECK,
|
2025-02-15 15:48:34 -05:00
|
|
|
HAND_DISPLAY_SCORED,
|
2025-02-05 21:19:05 -05:00
|
|
|
} HandDisplayType;
|
|
|
|
|
2025-02-01 06:40:33 -05:00
|
|
|
struct Hand {
|
2025-02-02 18:13:19 -05:00
|
|
|
Card *cards[48];
|
2025-02-01 06:40:33 -05:00
|
|
|
int count;
|
2025-02-02 19:07:49 -05:00
|
|
|
Vector2 position;
|
2025-02-05 21:19:05 -05:00
|
|
|
HandDisplayType display_type;
|
2025-02-01 06:40:33 -05:00
|
|
|
};
|
|
|
|
|
2025-02-02 05:21:20 -05:00
|
|
|
void draw_card(Card *c, Texture2D *cards_texture);
|
2025-02-01 11:12:07 -05:00
|
|
|
bool point_within_card(Card *c, Vector2 v);
|
2025-02-02 18:30:45 -05:00
|
|
|
void shuffle_hand(Hand *h);
|
2025-02-03 20:07:22 -05:00
|
|
|
void deal(Hand *from, Hand *to, int count, bool up);
|
2025-02-12 16:45:31 -05:00
|
|
|
void remove_from_hand(Hand *h, Card *c);
|
|
|
|
void add_to_hand(Hand *h, Card *c);
|
2025-02-03 20:07:22 -05:00
|
|
|
bool card_done_moving(Card *c);
|
2025-02-08 07:33:23 -05:00
|
|
|
Rectangle next_card_position(Hand *h);
|
2025-02-01 05:36:42 -05:00
|
|
|
|
|
|
|
#endif
|