// Copyright 2025 Bill Rossi // // This file is part of Hanafuda Hachi-Hachi. // // Hanafuda Hachi-Hachi is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. // // Hanafuda Hachi-Hachi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along with Hanafuda Hachi-Hachi. If not, see . #ifndef _HF_CARD_ #define _HF_CARD_ #include #include #include "move.h" typedef struct Card Card; typedef struct Hand Hand; #define CARD_WIDTH 73 #define CARD_HEIGHT 120 #define CARD_BORDER 5 #define CRANE_INDEX 0 #define CURTAIN_INDEX 8 #define MOON_INDEX 28 #define RAINY_MAN_INDEX 40 #define PHOENIX_INDEX 44 typedef enum CardType { CHAFF, RIBBON, ANIMAL, BRIGHT, } CardType; typedef enum RibbonType { RIBBON_NONE, RIBBON_PLAIN, RIBBON_BLUE, RIBBON_POETRY, } RibbonType; typedef enum Month { JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER } Month; struct Card { int index; CardType type; RibbonType ribbon_type; Month month; Vector2 position; bool selected; bool visible; Move move; int order; }; typedef enum HandDisplayType { HAND_DISPLAY_ROW, HAND_DISPLAY_FIELD, HAND_DISPLAY_DECK, HAND_DISPLAY_SCORED, } HandDisplayType; struct Hand { Card *cards[48]; int count; Vector2 position; HandDisplayType display_type; }; void draw_card(Card *c, Texture2D *cards_texture, int index); bool point_within_card(Card *c, Vector2 v); void shuffle_hand(Hand *h); void deal(Hand *from, Hand *to, int count, bool up, float deal_speed); void remove_from_hand(Hand *h, Card *c); void add_to_hand(Hand *h, Card *c, float deal_speed); bool card_done_moving(Card *c); Rectangle next_card_position(Hand *h); #endif