Added initial display code.
This commit is contained in:
parent
e7763f86c2
commit
0ea190c39f
21
lib/display.c
Normal file
21
lib/display.c
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include <ncurses.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "card.h"
|
||||||
|
#include "display.h"
|
||||||
|
|
||||||
|
char *card_suit(enum suit suit) {
|
||||||
|
char *card_suit;
|
||||||
|
|
||||||
|
card_suit = malloc(5 * sizeof(card_suit));
|
||||||
|
|
||||||
|
switch(suit) {
|
||||||
|
case DIAMONDS: strcpy(card_suit, DIAMONDS_SYMBOL);
|
||||||
|
case SPADES: strcpy(card_suit, SPADES_SYMBOL);
|
||||||
|
case HEARTS: strcpy(card_suit, HEARTS_SYMBOL);
|
||||||
|
case CLUBS: strcpy(card_suit, CLUBS_SYMBOL);
|
||||||
|
default: strcpy(card_suit, "?");
|
||||||
|
}
|
||||||
|
|
||||||
|
return(card_suit);
|
||||||
|
}
|
11
lib/display.h
Normal file
11
lib/display.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef DISPLAY_H
|
||||||
|
#define DISPLAY_H
|
||||||
|
|
||||||
|
#define DIAMONDS_SYMBOL "\u2666"
|
||||||
|
#define SPADES_SYMBOL "\u2660"
|
||||||
|
#define HEARTS_SYMBOL "\u2665"
|
||||||
|
#define CLUBS_SYMBOL "\u2663"
|
||||||
|
|
||||||
|
char *card_suit(enum suit);
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user