-
Notifications
You must be signed in to change notification settings - Fork 0
/
card.h
49 lines (41 loc) · 874 Bytes
/
card.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
#ifndef CARD_H
#define CARD_H
#include <SDL2/SDL.h>
#ifdef EMSCRIPTEN
#include <SDL_ttf.h>
#else
#include <SDL2_ttf/SDL_ttf.h>
#endif
#define CARD_WIDTH 150
#define CARD_HEIGHT 200
enum CardType {
ATTACK_CARD,
BLOCK_CARD
};
typedef struct {
float x;
float y;
float w;
float h;
float vx;
float vy;
float cooldown;
int isAnimating;
float startY;
float nextY;
float moveSpeed;
} CardModel;
typedef struct {
int id;
enum CardType type;
int value;
int cost;
CardModel *model;
} Card;
int Card_Init(Card *card, int id, enum CardType type, int value, int cost, CardModel *model);
void Card_Update(Card *card, float deltaTime);
void Card_Render(SDL_Renderer *renderer, Card *card, TTF_Font *font);
int Card_Intersect(Card *card, float x, float y);
void CardModel_Init(CardModel *model);
void Card_Toggle(Card *card, int isActive);
#endif