| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
#ifndef _cards_h_ |
| 19 |
#define _cards_h_ |
| 20 |
|
| 21 |
#define CARD_WIDTH 73 |
| 22 |
#define CARD_HEIGHT 97 |
| 23 |
#define CARD_MARGIN 6 |
| 24 |
#define CARD_FAN_DOWN 19 |
| 25 |
#define CARD_FAN_RIGHT 16 |
| 26 |
#define CARD_FAN_TBDOWN 6 |
| 27 |
#define CARD_FAN_TBRIGHT 6 |
| 28 |
|
| 29 |
extern void clear(int x, int y, int w, int h); |
| 30 |
extern void flush(); |
| 31 |
extern void flushsync(); |
| 32 |
extern void beep(); |
| 33 |
extern void text(char *s, int x, int y); |
| 34 |
extern int font_width, font_height; |
| 35 |
|
| 36 |
extern void help(char *filename, char *text); |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
static void init(); |
| 42 |
static void redraw(); |
| 43 |
static void resize(int width, int height); |
| 44 |
static void key(int k, int x, int y); |
| 45 |
static void click(int x, int y, int b); |
| 46 |
static void double_click(int x, int y, int b); |
| 47 |
static void drag(int x, int y, int b); |
| 48 |
static void drop(int x, int y, int b); |
| 49 |
|
| 50 |
#define KEY_F(x) (0x100 + (x)) |
| 51 |
#define KEY_DELETE 0x200 |
| 52 |
#define KEY_UP 0x201 |
| 53 |
#define KEY_DOWN 0x202 |
| 54 |
#define KEY_LEFT 0x203 |
| 55 |
#define KEY_RIGHT 0x204 |
| 56 |
#define KEY_PGUP 0x205 |
| 57 |
#define KEY_PGDN 0x206 |
| 58 |
#define KEY_HOME 0x207 |
| 59 |
|
| 60 |
#ifndef STACK_DEF |
| 61 |
typedef struct Stack {void *stack__p;} Stack; |
| 62 |
#endif |
| 63 |
|
| 64 |
#define MAKE_CARD(s, v, f) ((f) + (v)*4 + (s)) |
| 65 |
#define SUIT(c) ((c) & 3) |
| 66 |
#define COLOR(c) ((c) & 2) |
| 67 |
#define VALUE(c) (((c)>>2) & 15) |
| 68 |
#define FACEDOWNP(c) ((c) & FACEDOWN) |
| 69 |
#define FACEUP 0x00 |
| 70 |
#define FACEDOWN 0x40 |
| 71 |
|
| 72 |
#define SUIT_HEARTS 0 |
| 73 |
#define SUIT_DIAMONDS 1 |
| 74 |
#define SUIT_CLUBS 2 |
| 75 |
#define SUIT_SPADES 3 |
| 76 |
|
| 77 |
#define ACE 1 |
| 78 |
#define JACK 11 |
| 79 |
#define QUEEN 12 |
| 80 |
#define KING 13 |
| 81 |
|
| 82 |
#define STACK_OFFSET_NONE 0 |
| 83 |
#define STACK_OFFSET_RIGHT 1 |
| 84 |
#define STACK_OFFSET_DOWN 2 |
| 85 |
#define STACK_OFFSET_TBRIGHT 3 |
| 86 |
#define STACK_OFFSET_TBDOWN 4 |
| 87 |
|
| 88 |
typedef struct { |
| 89 |
int card_width, card_height; |
| 90 |
int fan_down, fan_right, fan_tbdown, fan_tbright; |
| 91 |
} StackSizes; |
| 92 |
|
| 93 |
#ifndef _TABLE_H_ |
| 94 |
|
| 95 |
#error include table.h first |
| 96 |
#endif |
| 97 |
|
| 98 |
Stack * stack_create(int x, int y); |
| 99 |
void stack_destroy(Stack *s); |
| 100 |
void stack_set_pictures(Picture **fronts, Picture *back); |
| 101 |
void stack_load_standard_deck(); |
| 102 |
void stack_move(Stack *s, int x, int y); |
| 103 |
void stack_set_offset(Stack *s, int which_offset); |
| 104 |
void stack_set_card_size(int width, int height); |
| 105 |
void stack_get_card_size(int *width, int *height); |
| 106 |
void stack_get_fans(int *down, int *right, int *tbdown, int *tbright); |
| 107 |
|
| 108 |
void stack_set_empty_picture(Stack *s, Picture *p); |
| 109 |
void stack_redraw(); |
| 110 |
void stack_peek_card(Stack *s, int n, int show); |
| 111 |
|
| 112 |
int stack_count_cards(Stack *s); |
| 113 |
int stack_get_card(Stack *s, int n); |
| 114 |
void stack_add_card(Stack *s, int c); |
| 115 |
int stack_take_card(Stack *s); |
| 116 |
void stack_change_card(Stack *s, int n, int c); |
| 117 |
void stack_shuffle(Stack *s); |
| 118 |
|
| 119 |
int stack_find(int x, int y, Stack **stack_ret, int *n_ret); |
| 120 |
int stack_drag_find(int x, int y, Stack **stack_ret); |
| 121 |
int stack_card_posn(Stack *s, int n, int *x, int *y); |
| 122 |
|
| 123 |
void stack_move_cards(Stack *src, Stack *dest, int num, int flag); |
| 124 |
void stack_move_card(Stack *src, Stack *dest, int flag); |
| 125 |
void stack_flip_cards(Stack *src, Stack *dest, int num, int flag); |
| 126 |
void stack_flip_card(Stack *src, Stack *dest, int flag); |
| 127 |
void stack_flip_stack(Stack *src, Stack *dest, int flag); |
| 128 |
void stack_flip_move_stack(Stack *src, Stack *dest, int flag); |
| 129 |
void stack_animate(Stack *src, Stack *dest, int flag); |
| 130 |
void stack_undo(); |
| 131 |
void stack_undo_reset(); |
| 132 |
|
| 133 |
void stack_begin_drag(Stack *s, int n, int x, int y); |
| 134 |
void stack_continue_drag(int n, int x, int y); |
| 135 |
void stack_drop(Stack *onto, int n, int flag); |
| 136 |
|
| 137 |
#endif |